Commit graph

25 commits

Author SHA1 Message Date
Stefan Kost
fb071dd89e spectrum: refactor processing loop for block based operation
Previously the chain function was working sample frame based. In each cycle it
was checking if it is time to run a fft or if it is time to send a message.
Now we changed the data transform functions to work on a block of data and
calculate the max length until either {end-of-data, do-fft, do-msg}. This allows
us also to avoid the duplicated code for the single and multi-channel case (as
the transformers have the same signature now).
2011-03-25 00:15:48 +02:00
Stefan Kost
3b552ae6f8 spectrum: simplify the have_interval calculation
Move some of the conditions to the places where the dependent variables change.
2011-03-24 11:27:34 +02:00
Stefan Kost
5bf267c485 spectrum: put number of channels to instance variable
When freeing data the format might have changed. Thus we need to remember for
which format we allocated memory.
2011-03-10 14:10:25 +02:00
Stefan Kost
b792b100e2 spectrum: use function pointers for data readers
Don't check the format for each sample frame to read. We can make that decission
in _setup already. This is still not ideal as we call the function per frame.
Ideally we determine how many samples we can copy and have a loop in the input
reader. As an alternative we might also consider to use the fft variants for the
various formats and not convert to float for all cases - we would still need to
mix or deinterleave though.
2011-03-10 10:27:41 +02:00
Stefan Kost
c622477a92 spectrum: multi-channel support
Add a boolean multi-channel property with a default of FALSE. When set to TRUE
the element won't mix all input channels to mono, but instead run a FFT on each
channel. In that case the result message would contain a 2 dimensional array
of channel x data for magnitude and phase.

API: GstSpectrum:multi-channel
https://bugzilla.gnome.org/show_bug.cgi?id=593482
2011-03-09 17:01:47 +02:00
Stefan Kost
787aca6898 spectrum: add a GstSpecrtumChannel context structure
We now keep the fft data that is related to one channel in a separate structure
to prepare for multichannel support. We also refactor the code to operate more
often on the channel context.
2011-03-09 17:00:57 +02:00
Stefan Kost
34bdec3d58 spectrum: more comments 2010-09-06 09:53:00 +03:00
Wim Taymans
445236a769 spectrum: add post-messages property
Add a post-messages property and deprecate the less descriptive message
property.
2009-09-11 13:28:35 +02:00
Sebastian Dröge
d912a42065 gst/spectrum/gstspectrum.*: Implement a simple compensation algorithm for rounding errors.
Original commit message from CVS:
* gst/spectrum/gstspectrum.c: (gst_spectrum_reset_state),
(gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
Implement a simple compensation algorithm for rounding errors.
This makes sure that a spectrum message is posted on the bus
every interval nanoseconds. Fixes bug #567955.
2009-01-19 10:13:53 +00:00
Sebastian Dröge
f4b2d38c87 gst/spectrum/gstspectrum.*: Use correct types for frame/fft counters and some minor cleanup.
Original commit message from CVS:
* gst/spectrum/gstspectrum.c: (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
Use correct types for frame/fft counters and some minor
cleanup.
2009-01-14 15:44:18 +00:00
Sebastian Dröge
5d001b3ab6 gst/spectrum/: Post a spectrum message on the bus for every interval, even if the interval is small than the length o...
Original commit message from CVS:
* gst/spectrum/Makefile.am:
* gst/spectrum/README:
* gst/spectrum/gstspectrum.c: (gst_spectrum_base_init),
(gst_spectrum_class_init), (gst_spectrum_init),
(gst_spectrum_reset_state), (gst_spectrum_finalize),
(gst_spectrum_set_property), (gst_spectrum_start),
(gst_spectrum_stop), (gst_spectrum_setup),
(gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
Post a spectrum message on the bus for every interval, even
if the interval is small than the length of the FFT.
Fixes bug #567642.
Major cleanup of the spectrum element.
2009-01-14 10:46:54 +00:00
Stefan Kost
20b5b4c2d9 gst/level/gstlevel.c: Little renaming (l -> level).
Original commit message from CVS:
* gst/level/gstlevel.c:
Little renaming (l -> level).
* gst/spectrum/gstspectrum.c:
* gst/spectrum/gstspectrum.h:
Also send full timestamp/duration details here.
2008-08-10 15:52:42 +00:00
Stefan Kost
098c8faefb ChangeLog: Add missing newline.
Original commit message from CVS:
* ChangeLog:
Add missing newline.
* gst/librfb/rfbdecoder.c:
Fix the build (missing stdlib.h).
* gst/spectrum/gstspectrum.c:
* gst/spectrum/gstspectrum.h:
Use basetransform segment so that it is correctly managed on flushes
and start/stop. Report message timestamp as stream time, which is what
an application can understand. (Yes these are adapted from wim recent
level element changes)
2007-09-18 11:45:06 +00:00
Sebastian Dröge
f5a3e61e69 Port GstSpectrum to GstAudioFilter and libgstfft, add support for int32, float and double, use floats for the message...
Original commit message from CVS:
* configure.ac:
* gst/spectrum/Makefile.am:
* gst/spectrum/demo-audiotest.c: (draw_spectrum),
(message_handler), (main):
* gst/spectrum/demo-osssrc.c: (draw_spectrum), (message_handler):
* gst/spectrum/gstspectrum.c: (gst_spectrum_base_init),
(gst_spectrum_class_init), (gst_spectrum_init),
(gst_spectrum_dispose), (gst_spectrum_set_property),
(gst_spectrum_get_property), (gst_spectrum_start),
(gst_spectrum_setup), (gst_spectrum_message_new),
(gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
Port GstSpectrum to GstAudioFilter and libgstfft, add support
for int32, float and double, use floats for the message contents,
average all FFTs done in one interval for better results, use
a better windowing function, allow posting the phase in the message
and actually do an FFT with the requested number of bands instead
of interpolating.
* tests/check/elements/spectrum.c: (GST_START_TEST),
(spectrum_suite):
Improve the units tests by checking for a 11025Hz sine wave
and add unit tests for all 4 supported sample types.
2007-09-06 07:21:22 +00:00
Stefan Kost
28114d571f gst/spectrum/gstspectrum.*: One FIXME less, by resolving message timestamps against the playback segment.
Original commit message from CVS:
* gst/spectrum/gstspectrum.c: (gst_spectrum_start),
(gst_spectrum_event), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
One FIXME less, by resolving message timestamps against the playback
segment.
2007-03-07 11:23:20 +00:00
Stefan Kost
0ed39caa1a gst/spectrum/gstspectrum.*: Fix type mixup in spectrum->interval (gdouble<->guint64). Spotted by
Original commit message from CVS:
* gst/spectrum/gstspectrum.c: (gst_spectrum_init),
(gst_spectrum_set_property):
* gst/spectrum/gstspectrum.h:
Fix type mixup in spectrum->interval (gdouble<->guint64). Spotted by
René Stadler
2006-09-11 18:23:59 +00:00
Stefan Kost
584c231629 gst/spectrum/demo-osssrc.c: Use more defines
Original commit message from CVS:
* gst/spectrum/demo-osssrc.c: (draw_spectrum), (main):
Use more defines
* gst/spectrum/gstspectrum.c: (gst_spectrum_init),
(gst_spectrum_dispose), (gst_spectrum_set_caps),
(gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
Apply some of the spectrum cleanup changes suggested in #348085.
2006-09-11 18:02:39 +00:00
Stefan Kost
2787798482 gst/spectrum/: port to use message to get results, cleanly exit when closing the window
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (on_window_destroy),
(draw_spectrum), (message_handler), (main):
* gst/spectrum/demo-osssrc.c: (on_window_destroy), (draw_spectrum),
(message_handler), (main):
port to use message to get results, cleanly exit when closing the window
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_get_property),
(gst_spectrum_set_caps), (gst_spectrum_start),
(gst_spectrum_message_new), (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
port to derive from basetransform and send results via messages
(like level element)
2006-06-16 09:49:07 +00:00
Stefan Kost
7174c10edf Fix more gobject macros: obj<->klass, GstXXX<->GstXXXClass
Original commit message from CVS:
* ext/alsaspdif/alsaspdifsink.h:
* ext/amrwb/gstamrwbdec.h:
* ext/amrwb/gstamrwbenc.h:
* ext/amrwb/gstamrwbparse.h:
* ext/arts/gst_arts.h:
* ext/artsd/gstartsdsink.h:
* ext/audiofile/gstafparse.h:
* ext/audiofile/gstafsink.h:
* ext/audiofile/gstafsrc.h:
* ext/audioresample/gstaudioresample.h:
* ext/bz2/gstbz2dec.h:
* ext/bz2/gstbz2enc.h:
* ext/dirac/gstdiracdec.h:
* ext/directfb/dfbvideosink.h:
* ext/divx/gstdivxdec.h:
* ext/divx/gstdivxenc.h:
* ext/dts/gstdtsdec.h:
* ext/faac/gstfaac.h:
* ext/gsm/gstgsmdec.h:
* ext/gsm/gstgsmenc.h:
* ext/ivorbis/vorbisenc.h:
* ext/libfame/gstlibfame.h:
* ext/nas/nassink.h:
* ext/neon/gstneonhttpsrc.h:
* ext/polyp/polypsink.h:
* ext/sdl/sdlaudiosink.h:
* ext/sdl/sdlvideosink.h:
* ext/shout/gstshout.h:
* ext/snapshot/gstsnapshot.h:
* ext/sndfile/gstsf.h:
* ext/swfdec/gstswfdec.h:
* ext/tarkin/gsttarkindec.h:
* ext/tarkin/gsttarkinenc.h:
* ext/theora/theoradec.h:
* ext/wavpack/gstwavpackdec.h:
* ext/wavpack/gstwavpackparse.h:
* ext/xine/gstxine.h:
* ext/xvid/gstxviddec.h:
* ext/xvid/gstxvidenc.h:
* gst/cdxaparse/gstcdxaparse.h:
* gst/cdxaparse/gstcdxastrip.h:
* gst/colorspace/gstcolorspace.h:
* gst/festival/gstfestival.h:
* gst/freeze/gstfreeze.h:
* gst/gdp/gstgdpdepay.h:
* gst/gdp/gstgdppay.h:
* gst/modplug/gstmodplug.h:
* gst/mpeg1sys/gstmpeg1systemencode.h:
* gst/mpeg1videoparse/gstmp1videoparse.h:
* gst/mpeg2sub/gstmpeg2subt.h:
* gst/mpegaudioparse/gstmpegaudioparse.h:
* gst/multifilesink/gstmultifilesink.h:
* gst/overlay/gstoverlay.h:
* gst/playondemand/gstplayondemand.h:
* gst/qtdemux/qtdemux.h:
* gst/rtjpeg/gstrtjpegdec.h:
* gst/rtjpeg/gstrtjpegenc.h:
* gst/smooth/gstsmooth.h:
* gst/smoothwave/gstsmoothwave.h:
* gst/spectrum/gstspectrum.h:
* gst/speed/gstspeed.h:
* gst/stereo/gststereo.h:
* gst/switch/gstswitch.h:
* gst/tta/gstttadec.h:
* gst/tta/gstttaparse.h:
* gst/videodrop/gstvideodrop.h:
* gst/xingheader/gstxingmux.h:
* sys/directdraw/gstdirectdrawsink.h:
* sys/directsound/gstdirectsoundsink.h:
* sys/dxr3/dxr3audiosink.h:
* sys/dxr3/dxr3spusink.h:
* sys/dxr3/dxr3videosink.h:
* sys/qcam/gstqcamsrc.h:
* sys/vcd/vcdsrc.h:
Fix more gobject macros: obj<->klass, GstXXX<->GstXXXClass
2006-06-01 22:00:26 +00:00
Stefan Kost
58139f4877 gst/spectrum/Makefile.am: Link to base libraries
Original commit message from CVS:
* gst/spectrum/Makefile.am:
Link to base libraries
* gst/spectrum/demo-osssrc.c: (main):
use new threshhold property
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_set_sink_caps),
(gst_spectrum_get_sink_caps), (gst_spectrum_chain),
(gst_spectrum_change_state):
* gst/spectrum/gstspectrum.h:
Use gst_adapter, support multiple-channels, add threshold property for
result, add docs, fix resulting spectrum range (was including mirrored
results)
2006-05-21 16:23:23 +00:00
Stefan Kost
83b3960a08 Initial port of the spectrum element
Original commit message from CVS:
* configure.ac:
* gst/spectrum/demo-osssrc.c: (spectrum_chain), (main):
* gst/spectrum/fix_fft.c: (gst_spectrum_fix_dot):
* gst/spectrum/gstspectrum.c: (gst_spectrum_get_type),
(gst_spectrum_base_init), (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_dispose),
(gst_spectrum_set_property), (gst_spectrum_chain):
* gst/spectrum/gstspectrum.h:
Initial port of the spectrum element
2006-05-20 22:42:15 +00:00
Johan Dahlin
5acffea623 *.h: Revert indenting
Original commit message from CVS:
* *.h: Revert indenting
2004-03-15 16:32:54 +00:00
Thomas Vander Stichele
5d25c00e4b gst-indent
Original commit message from CVS:
gst-indent
2004-03-14 22:34:33 +00:00
Andy Wingo
d8e18eb071 s/Gnome-Streamer/GStreamer/
Original commit message from CVS:
s/Gnome-Streamer/GStreamer/
2002-03-20 21:45:03 +00:00
Andy Wingo
185612aae3 Initial revision
Original commit message from CVS:
Initial revision
2001-12-22 23:27:31 +00:00