Commit graph

61 commits

Author SHA1 Message Date
Arun Raghavan
557c2c9be1 audiobasesink: Reset audio clock if necessary
When the ringbuffer is deactivated and then acquired, if the audio clock
provided by the sink gets reset to zero, we need to add an offset to the
clock to make sure that subsequent samples are written out at the right
times. While we need to leave this to derived classes to take care of
when they provide their own clock (since that clock may or may not be
reset to zero), we can do this ourselves if we know the provided clock
is our own (which does reset to zero on a re-acquire).
2015-03-03 23:26:54 +05:30
Thomas Roos
f0f854d501 audiosink: Fill in the correct silence
For unsigned raw formats this is not all zeroes, and for non-raw formats
we just continue to assume all zeroes for now.

https://bugzilla.gnome.org/show_bug.cgi?id=739446
2015-01-21 09:35:55 +01:00
Thiago Santos
8242676dc2 audiosink: compensate for segment restart with clock's time_offset
When playing chained data the audio ringbuffer is released and
then acquired again. This makes it reset the segbase/segdone
variables, but the next sample will be scheduled to play in
the next position (right after the sample from the previous media)
and, as the segdone is at 0, the audiosink will wait the duration
of this previous media before it can write and play the new data.

What happens is this:
pointer at 0, write to 698-1564, diff 698, segtotal 20, segsize 1764, base 0

it will have to wait the length of 698 samples before being able to write.

In a regular sample playback it looks like:
pointer at 677, write to 696-1052, diff 19, segtotal 20, segsize 1764, base 0

In this case it will write to the next available position and it
doesn't need to wait or fill with silence.

This solution is borrowed from pulsesink that resets the clock to
start again from 0, which makes it reset the time_offset to the time
of the last played sample. This is used to correct the place of
writing in the ringbuffer to the new start (0 again)

https://bugzilla.gnome.org/show_bug.cgi?id=737055
2014-09-24 10:22:54 -03:00
Tim-Philipp Müller
bcb8068e27 docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-26 23:28:57 +01:00
Reynaldo H. Verdejo Pinochet
aa1883d5d7 audiobase*: Drop trailing withespaces 2013-12-27 01:36:09 -03:00
Sebastian Dröge
3f82e919dd libs: Use foo/foo.h as single-include header consistently everywhere
https://bugzilla.gnome.org/show_bug.cgi?id=688785
2012-12-12 17:13:10 +00:00
Sebastian Dröge
32139f9a3d audio: Use new GType for GThread instead of just G_TYPE_POINTER 2012-11-12 11:45:47 +01:00
Tim-Philipp Müller
5f59b4f7ee Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 23:05:09 +00:00
Thibault Saunier
dc5bb008a3 audio: port to the new GLib thread API 2012-09-09 20:41:06 -03:00
Tim-Philipp Müller
2079a8c12b Remove glib-compat-private.h stuff we don't need any more
It's all been ported to the latest GLib API now.
2012-09-09 18:36:49 +01:00
Tim-Philipp Müller
576bbb4fd8 Remove compatibility code cruft for old GLib versions 2012-01-18 17:22:21 +00:00
Tim-Philipp Müller
fb6d09055a Merge remote-tracking branch 'origin/master' into 0.11
Conflicts:
	ext/alsa/gstalsadeviceprobe.c
	ext/alsa/gstalsamixer.c
	ext/pango/gsttextoverlay.c
	ext/pango/gsttextoverlay.h
	gst-libs/gst/audio/gstaudiobasesink.c
	gst-libs/gst/audio/gstaudioringbuffer.c
	gst-libs/gst/audio/gstaudiosrc.c
	gst-libs/gst/video/Makefile.am
	gst-libs/gst/video/video.c
	gst/encoding/gststreamcombiner.c
	gst/encoding/gststreamsplitter.c
	gst/playback/gstplaybasebin.c
	gst/playback/gststreamsynchronizer.c
	gst/playback/gstsubtitleoverlay.c
	gst/playback/gsturidecodebin.c
	sys/xvimage/xvimagesink.c
	tests/examples/Makefile.am
	win32/common/libgstvideo.def

Video overlay composition disabled for now, needs
porting to buffer meta.
2011-12-08 01:19:03 +00:00
Tim-Philipp Müller
0d98aa25b8 Work around deprecated thread API in glib master
Add private replacements for deprecated functions such as
g_mutex_new(), g_mutex_free(), g_cond_new() etc., mostly
to avoid the deprecation warnings. We'll change these
over to the new API once we depend on glib >= 2.32.

Replace g_thread_create() with g_thread_try_new().
2011-12-04 17:16:30 +00:00
Wim Taymans
a3416bc11f rename baseaudio* -> audiobase* 2011-11-11 12:00:52 +01:00
Wim Taymans
ee7072fe7e rename GstBaseAudio* ->GstAudioBase* 2011-11-11 11:52:47 +01:00
Wim Taymans
6511f36fdb audio: GstRingBuffer -> GstAudioRingBuffer 2011-11-11 11:21:41 +01:00
Wim Taymans
b81af23992 audio: rename internal audio ringbuffer 2011-11-11 10:54:39 +01:00
Wim Taymans
95281cc306 Merge branch 'master' into 0.11 2011-10-28 16:24:44 +02:00
Mersad Jelacic
d430eb65c5 audiosink: avoid deadlocking audioringbuffer thread
... when it goes into wait for ringbuffer starting just after such
having been signalled.

Fixes #661738.
2011-10-28 14:07:40 +02:00
Wim Taymans
2e837743c3 audio: clean up audiosink headers 2011-06-21 18:13:48 +02:00
Sebastian Dröge
f50b3af5d7 audio: Use G_DEFINE_TYPE instead of GST_BOILERPLATE 2011-04-19 10:52:00 +02:00
Wim Taymans
3d25a4b470 libs: port to new data API 2011-03-27 13:55:15 +02:00
Tim-Philipp Müller
6f4c1ac583 Remove GST_DEBUG_FUNCPTR where they're pointless
There's not much point in using GST_DEBUG_FUNCPTR with GObject
virtual functions such as get_property, set_propery, finalize and
dispose, since they'll never be used by anyone anyway. Saves a
few bytes and possibly a sixteenth of a polar bear.
2009-10-28 00:59:35 +00:00
Edward Hervey
9329b8be72 gst-libs: Remove dead assignments and resulting unused variables. 2009-08-08 15:54:57 +02:00
Olivier Crête
4e88633de4 audiosink: Add stream-status messages
Fixes #587695
2009-07-20 12:54:37 +02:00
Wim Taymans
e4492c24ea audio: correctly handle short read/writes 2009-06-17 13:17:30 +02:00
Tim-Philipp Müller
70089160f8 audiosink, audiosrc: do the class_ref()s in the right class_init functions
Spotted by Philip Jägenstedt. Hopefully fixes #585970 for real.
2009-06-16 14:14:26 +01:00
Tim-Philipp Müller
3767cb6005 audiosink,audiosrc: ref the audio ring buffer class and type in class_init
Hack around thread-safety issues in GObject and our racy _get_type()
functions (we could easily fix the _get_type() functions, but we still
need to hack around the GObject class races until we require a newer
GLib version, I think).
2009-06-15 15:39:09 +01:00
Stefan Kost
486fe43cb9 Add a FIXME 0.11. Make the log message a bit more detailed and add comments. 2009-02-02 18:05:42 +02:00
Wim Taymans
6eed8ca285 gst-libs/gst/audio/gstaudiosink.c: Implement a separate activate functions to start monitoring the segments or, in pu...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_activate), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Implement a separate activate functions to start monitoring the segments
or, in pull mode, pulling in data.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_init), (gst_base_audio_sink_dispose),
(gst_base_audio_sink_query_pad), (gst_base_audio_sink_query),
(gst_base_audio_sink_setcaps), (gst_base_audio_sink_callback),
(gst_base_audio_sink_activate_pull),
(gst_base_audio_sink_async_play),
(gst_base_audio_sink_change_state):
Implement pad and element convert query function.
Activate the ringbuffer.
Use the segment last_stop value as the offset to pull.
Use new basesink _do_preroll() method to preroll in the pulling thread.
Take appropriate locking in the pulling thread.
* gst-libs/gst/audio/gstringbuffer.h:
Update some docs.
2008-10-20 15:35:37 +00:00
Wim Taymans
927999603a gst-libs/gst/audio/gstaudiosink.c: Signal thread startup earlier so that we can immediatly go into pull mode when we ...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c: (audioringbuffer_thread_func),
(gst_audioringbuffer_acquire), (gst_audioringbuffer_release),
(gst_audioringbuffer_stop):
Signal thread startup earlier so that we can immediatly go into pull
mode when we have to and block on preroll.
2008-10-16 15:44:37 +00:00
Wim Taymans
da76d5e7cb gst-libs/gst/audio/gstaudiosink.c: Since we now call stop, we trigger this code path that causes a deadlock is appare...
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c: (gst_audioringbuffer_stop):
Since we now call stop, we trigger this code path that causes a deadlock
is apparently not needed.
2008-08-26 17:24:31 +00:00
Wim Taymans
fc523e047c gst-libs/gst/audio/gstaudiosink.c: Choose to allocate one less segment but require one additional segment as latency.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c: (gst_audioringbuffer_acquire):
Choose to allocate one less segment but require one additional segment
as latency.
* gst-libs/gst/audio/gstaudiosrc.c: (gst_audioringbuffer_acquire):
No need to increment the number of segments in the source.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (clock_convert_external),
(gst_base_audio_sink_resample_slaving),
(gst_base_audio_sink_skew_slaving),
(gst_base_audio_sink_none_slaving), (gst_base_audio_sink_render),
(gst_base_audio_sink_async_play):
Remove adding latency when returning the internal time while subtracting
it again when we use the value a little later.
When calculating the end timestamp, we are making a rounding error
with the current algorithm. Ensure that we don't accumulate these
rounding errors when aligning samples by not resampling at all if we
don't need to. Fixes #419351.
Make the initial calibration of the clock slaving a little more
predictable and accurate. Also handle the case where we don't do
clock slaving.
2008-05-09 16:38:10 +00:00
Sebastian Dröge
83f0729394 Remove some unused code.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c: (audioringbuffer_thread_func):
* gst-libs/gst/audio/gstaudiosrc.c: (audioringbuffer_thread_func):
* gst/tcp/gsttcp.c: (gst_tcp_socket_write):
* sys/v4l/v4lsrc_calls.c: (gst_v4lsrc_get_fps_list):
Remove some unused code.
* gst/audioconvert/gstaudioquantize.c:
(gst_audio_quantize_free_noise_shaping):
Don't return before freeing the noise shaping history.
2008-05-04 15:02:20 +00:00
Wim Taymans
877a45b791 gst-libs/gst/audio/gstaudiosink.c: Small debug improvement.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c: (gst_audioringbuffer_release):
Small debug improvement.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render):
Fix bug in determining the sample start/stop position, we want to base
this decision on the fact that we are going forwards or backwards, not
slower or faster. This fixes some ugly resync warnings when playing at
very slow speeds.
2008-03-24 11:24:22 +00:00
Wim Taymans
355e8a940d gst-libs/gst/audio/gstaudiosink.c: Improve debug output.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c: (audioringbuffer_thread_func),
(gst_audioringbuffer_open_device),
(gst_audioringbuffer_close_device), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_release), (gst_audioringbuffer_start),
(gst_audioringbuffer_pause), (gst_audioringbuffer_stop),
(gst_audio_sink_create_ringbuffer):
Improve debug output.
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_start),
(gst_ring_buffer_pause), (gst_ring_buffer_delay):
Prevent some functions from doing things and failing when the
ringbuffer is not yet acquired.
2007-12-18 15:56:51 +00:00
Wim Taymans
85c7eeecc3 gst-libs/gst/audio/: Improve debugging.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c: (audioringbuffer_thread_func):
* gst-libs/gst/audio/gstaudiosrc.c: (audioringbuffer_thread_func):
Improve debugging.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_query), (gst_base_audio_sink_event),
(gst_base_audio_sink_render), (gst_base_audio_sink_async_play):
Improve latency and clock slaving calculations.
Improve slave clock calibration.
* gst-libs/gst/audio/gstringbuffer.c:
(gst_ring_buffer_commit_full):
When we are asked to render N sample to 0 bytes, return N.
2007-03-01 17:01:43 +00:00
Tim-Philipp Müller
7298ebaa61 gst-libs/gst/audio/: Use g_strerror instead of strerror so we get UTF-8.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c: (audioringbuffer_thread_func):
* gst-libs/gst/audio/gstaudiosrc.c: (audioringbuffer_thread_func):
Use g_strerror instead of strerror so we get UTF-8.
2006-11-06 18:24:59 +00:00
Wim Taymans
7367722509 Added docs for the audio libs.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-docs.sgml:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/audio/gstaudioclock.c:
* gst-libs/gst/audio/gstaudioclock.h:
* gst-libs/gst/audio/gstaudiosink.c:
* gst-libs/gst/audio/gstaudiosink.h:
* gst-libs/gst/audio/gstaudiosrc.c:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstbaseaudiosrc.c: (gst_base_audio_src_init):
* gst-libs/gst/audio/gstbaseaudiosrc.h:
* gst-libs/gst/audio/gstringbuffer.h:
Added docs for the audio libs.
2006-09-27 11:05:08 +00:00
Stefan Kost
267a068e70 ext/gnomevfs/gstgnomevfssrc.c: Add docs about icydemux usage in connection with gnomevfssrc
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c:
Add docs about icydemux usage in connection with gnomevfssrc
* ext/libvisual/visual.c:
* ext/ogg/gstoggaviparse.c:
* ext/ogg/gstoggdemux.c:
* ext/ogg/gstoggmux.c:
* ext/ogg/gstoggparse.c:
* gst-libs/gst/audio/gstaudiofiltertemplate.c:
* gst-libs/gst/audio/gstaudiosink.c:
* gst-libs/gst/audio/gstaudiosrc.c:
* gst/audiorate/gstaudiorate.c:
More G_OBJECT macro fixing.
* gst/audiotestsrc/gstaudiotestsrc.h:
Fix wrong info in header due to copy & paste
2006-09-16 21:54:48 +00:00
Wim Taymans
843202b51c gst-libs/gst/audio/gstaudiosink.c: Fix leak.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c: (audioringbuffer_thread_func),
(gst_audioringbuffer_finalize), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_release), (gst_audioringbuffer_stop):
Fix leak.
Avoid type casting when we can.
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_dispose):
Fix mem leak.
2006-07-21 10:43:54 +00:00
Stefan Kost
0afac375b4 Fix #337365 (g_type_class_ref <-> g_type_class_peek_parent)
Original commit message from CVS:
* ext/alsa/gstalsamixeroptions.c:
(gst_alsa_mixer_options_class_init):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_class_init):
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_class_init):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init):
* ext/ogg/gstoggparse.c: (gst_ogg_parse_class_init):
* gst-libs/gst/audio/gstaudioclock.c: (gst_audio_clock_class_init):
* gst-libs/gst/audio/gstaudiofilter.c:
(gst_audio_filter_class_init):
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init):
* gst-libs/gst/audio/gstaudiosrc.c:
(gst_audioringbuffer_class_init):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_class_init):
* gst-libs/gst/interfaces/colorbalancechannel.c:
(gst_color_balance_channel_class_init):
* gst-libs/gst/interfaces/mixeroptions.c:
(gst_mixer_options_class_init):
* gst-libs/gst/interfaces/mixertrack.c:
(gst_mixer_track_class_init):
* gst-libs/gst/interfaces/tunerchannel.c:
(gst_tuner_channel_class_init):
* gst-libs/gst/interfaces/tunernorm.c: (gst_tuner_norm_class_init):
* gst-libs/gst/netbuffer/gstnetbuffer.c:
(gst_netbuffer_class_init):
* gst-libs/gst/rtp/gstbasertppayload.c:
(gst_basertppayload_class_init):
* gst/playback/gstdecodebin.c: (gst_decode_bin_class_init):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init):
* gst/playback/gstplaybin.c: (gst_play_bin_class_init):
* gst/playback/gststreaminfo.c: (gst_stream_info_class_init):
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init):
* gst/subparse/gstsubparse.c: (gst_sub_parse_class_init):
* gst/tcp/gsttcpclientsink.c: (gst_tcp_client_sink_class_init):
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_channel_class_init):
* sys/v4l/gstv4ljpegsrc.c: (gst_v4ljpegsrc_class_init):
* sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_class_init):
* sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_class_init):
* sys/v4l/gstv4ltuner.c: (gst_v4l_tuner_channel_class_init),
(gst_v4l_tuner_norm_class_init):
* sys/ximage/ximagesink.c: (gst_ximagesink_class_init):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_class_init):
* tests/old/testsuite/alsa/sinesrc.c: (sinesrc_class_init):
Fix #337365 (g_type_class_ref <-> g_type_class_peek_parent)
2006-04-08 21:02:53 +00:00
Wim Taymans
a169abc679 gst-libs/gst/audio/gstaudiosink.c: Implement pause that does not wait for completion.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (gst_audioringbuffer_release),
(gst_audioringbuffer_pause):
Implement pause that does not wait for completion.

* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render), (gst_base_audio_sink_change_state):
Don't drop buffers when going to PAUSED but perform preroll on
remaining samples now that core base class supports this.

* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_release),
(gst_ring_buffer_pause_unlocked), (gst_ring_buffer_stop),
(gst_ring_buffer_commit):
Pause should not signal waiters.
Implement return value of _commit correctly.
2006-01-30 16:19:33 +00:00
Thomas Vander Stichele
5f83aa7dfa expand tabs
Original commit message from CVS:
expand tabs
2005-12-06 19:42:02 +00:00
Wim Taymans
3f05db1828 gst-libs/gst/audio/TODO: Updated TODO
Original commit message from CVS:
* gst-libs/gst/audio/TODO:
Updated TODO

* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_open_device),
(gst_audioringbuffer_close_device), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_release):
Small cleanups.

* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_class_init), (gst_base_audio_sink_render),
(gst_base_audio_sink_change_state):
Slave to the master clock when going to PLAYING and unslave when
going to PAUSED.

* gst-libs/gst/audio/gstringbuffer.c:
(gst_ring_buffer_open_device), (gst_ring_buffer_close_device),
(gst_ring_buffer_acquire), (gst_ring_buffer_release),
(gst_ring_buffer_samples_done), (gst_ring_buffer_set_sample),
(gst_ring_buffer_clear_all), (wait_segment),
(gst_ring_buffer_commit), (gst_ring_buffer_read),
(gst_ring_buffer_advance):
* gst-libs/gst/audio/gstringbuffer.h:
Add some docs and cleanups.
2005-11-28 15:53:55 +00:00
Andy Wingo
f405e12b4a *.*: Ran scripts/update-macros. Oh yes.
Original commit message from CVS:
2005-11-21  Andy Wingo  <wingo@pobox.com>

* *.h:
* *.c: Ran scripts/update-macros. Oh yes.
2005-11-21 16:35:24 +00:00
Wim Taymans
d920233a73 gst-libs/gst/audio/gstaudiosink.c: Only actually wait for the thread to be stopped if it's running.
Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c: (gst_audioringbuffer_stop):
Only actually wait for the thread to be stopped if it's
running.
2005-10-08 12:02:08 +00:00
Andy Wingo
721c97d438 gst-libs/gst/audio/gstringbuffer.c (gst_ring_buffer_clear)
Original commit message from CVS:
2005-10-02  Andy Wingo  <wingo@pobox.com>

* gst-libs/gst/audio/gstringbuffer.c (gst_ring_buffer_clear)
(gst_ring_buffer_prepare_read):
* gst-libs/gst/audio/gstaudiosink.c (audioringbuffer_thread_func):
Demote to LOG.
2005-10-02 15:58:57 +00:00
Wim Taymans
b17856db22 Fix sync again. Moved sample alignment to basesink.
Original commit message from CVS:
* ext/alsa/gstalsasink.c: (gst_alsasink_reset):
* gst-libs/gst/audio/gstaudiosink.c:
(gst_audioringbuffer_class_init), (audioringbuffer_thread_func),
(gst_audioringbuffer_stop):
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_event), (gst_base_audio_sink_render),
(gst_base_audio_sink_change_state):
* gst-libs/gst/audio/gstbaseaudiosink.h:
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_stop),
(gst_ring_buffer_set_sample), (gst_ring_buffer_clear_all),
(gst_ring_buffer_commit), (gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
Fix sync again. Moved sample alignment to basesink.
2005-09-24 13:06:03 +00:00
Andy Wingo
c32721723b Updates for two-arg init from GST_BOILERPLATE_FULL.
Original commit message from CVS:
2005-08-28  Andy Wingo  <wingo@pobox.com>

* Updates for two-arg init from GST_BOILERPLATE_FULL.
2005-08-28 17:52:45 +00:00