Commit graph

160 commits

Author SHA1 Message Date
Tim-Philipp Müller
736a484129 More printf format warning fixes 2011-11-22 01:40:39 +00:00
Vincent Penquerc'h
8548b2c777 flacdec: fix spurious timestamp discontinuity
We need to tell the base class that we're dropping buffers,
so it drops the input timestamps corresponding to these.
Otherwise, the first actual audio buffers we output will be
stamped with those - GST_CLOCK_TIMESTAMP_NONE. That mismatch
between input buffer count and output buffer count will stay
while playing. With enough headers and long enough buffer
durations, the sink will have played enough before receiving
the first valid timestamp (usually 0), and will trigger an
audible discontinuity.
2011-11-15 13:36:15 +00:00
Tim-Philipp Müller
a49818f876 flacdec: parse stream headers from caps in set_format function
Not that this seems to be actually needed, libflac happily decodes
stuff even if we just drop all headers and never feed it to the
library.
2011-10-30 19:12:44 +00:00
Tim-Philipp Müller
ab591b6d53 flacdec: don't extract metadata, leave that to the parser or container 2011-10-30 19:12:44 +00:00
Tim-Philipp Müller
5ab43cdf91 flacdec: we expect framed input now, remove some more code 2011-10-30 19:12:39 +00:00
Tim-Philipp Müller
92361863e6 flacdec: naive port to GstAudioDecoder
This would probably have been too invasive to do in the 0.10
branch, with all the pull-mode and parser handling code in
there.
2011-10-30 17:39:40 +00:00
Tim-Philipp Müller
9cd17092d8 ext, gst: update for taglist API changes 2011-10-30 11:44:53 +00:00
Tim-Philipp Müller
3d01b9f398 flacdec: get rid of granulepos handling
Leave that to the parser or demuxer. There's still some
code for operating in DEFAULT (samples) format, but that
will be removed later.
2011-09-28 19:10:27 +01:00
Tim-Philipp Müller
5c28f426d7 flacdec: get rid of pull-mode support and focus on being a decoder
Leave all the other stuff to flacparse.
2011-09-28 19:03:13 +01:00
Wim Taymans
b4524858be flac: port to 0.11 2011-09-28 17:40:01 +02:00
Wim Taymans
e9df54819c Merge branch 'master' into 0.11 2011-08-24 14:16:44 +02:00
Monty Montgomery
799c8e3d04 flacdec: Correct sample number rounding resulting in timestamp jitter
flacdec converts the src timestamp to a sample number, uses that internally, then reconverts the sample number to a timestamp for the output buffer.  Unfortunately, sample numbers can't be represented in an integer number of nanoseconds, and the conversion process was truncating rather than rounding, resulting in sample numbers and output timestamps that were often off by a full sample.

This corrects the time->sample convesion
2011-08-23 10:09:41 +02:00
Wim Taymans
ce1e7cb108 Merge branch 'master' into 0.11
Conflicts:
	ext/flac/gstflacdec.c
2011-08-17 15:52:18 +02:00
Vincent Penquerc'h
3e0134f51f flacdec: avoid timestamp/offset tracking going out of sync
The libFLAC API is callback based, and we must only call it to
output data when we know we have enough input data. For this
reason, a single processing step is done when receiving a buffer.
However, if there were metadata buffers still pending, a step
intended for the first audio frame might end up writing that
leftover metadata. Since a single step is done per buffer, this
will cause every buffer to be written one step late.

This would add some latency (a bufferfull's worth), possibly
lose a buffer when seeking or the like, and also cause timestamp
and offset to be applied to the wrong buffer, as updates to
the "current" segment last_stop (from incoming buffer timestamp)
will be applied to an output buffer originating from the previous
incoming buffer.

This fixes the issue by ensuring that, upon receiving the first
audio frame, processing is done till all metadata is processed,
so the next "single step" done will be for the audio frame. After
this, we should keep to 1 input buffer -> 1 output buffer and so
avoid getting out of sync.

https://bugzilla.gnome.org/show_bug.cgi?id=650960
2011-08-17 13:40:59 +01:00
Vincent Penquerc'h
e09eb95a5f flacdec: bail on reserved value
Now that we look at the right bits, we can test against the reserved
value as we do for other fields.

https://bugzilla.gnome.org/show_bug.cgi?id=650960
2011-08-17 00:02:38 +01:00
Vincent Penquerc'h
64beef4610 flacdec: fix bit twiddling
Right shifting a 8 bit value by 8 bits is twice too much
to get the high 4 bits.

https://bugzilla.gnome.org/show_bug.cgi?id=650960
2011-08-17 00:01:37 +01:00
Vincent Penquerc'h
1549aaba27 flacdec: warn if we see a variable block size where unsupported
https://bugzilla.gnome.org/show_bug.cgi?id=650960
2011-08-17 00:01:07 +01:00
Wim Taymans
d89790d545 Merge branch 'master' into 0.11
Conflicts:
	gst/avi/gstavidemux.c
	gst/rtp/gstrtpac3depay.c
	gst/rtp/gstrtpg726depay.c
	gst/rtp/gstrtpmpvdepay.c
	gst/videofilter/gstgamma.c
2011-05-24 17:34:19 +02:00
Tim-Philipp Müller
900b2fb63d flacdec: also try upstream first for duration query in DEFAULT format
https://bugzilla.gnome.org/show_bug.cgi?id=650785
2011-05-23 13:25:44 +01:00
Wim Taymans
cf1248e566 Merge branch 'master' into 0.11
Conflicts:
	configure.ac
2011-05-16 17:52:11 +02:00
Sebastian Dröge
d4b9cbc1ae flacdec: Send EOS when seeking after the end of file instead of failing
Fixes bug #649780.
2011-05-14 11:52:13 +02:00
Wim Taymans
2f9a7b1a1b flac: port to 0.11 2011-04-19 18:55:31 +02:00
Tim-Philipp Müller
c365fbddba flacdec: fix issues with large metadata blocks when streaming unframed flac
Parse metadata blocks when handling unparsed flac in push mode. This
works around a bunch of issues with the flac decoder when handling
metadata blocks that are larger than the max. flac framesize, which
coverart blocks often are. We need to have all the data for these
blocks available when we pass data to libflac.

http://gstreamer-devel.966125.n4.nabble.com/Flac-files-that-will-playback-but-not-stream-td3338198.html#a3395276

https://bugzilla.gnome.org/show_bug.cgi?id=566769
2011-03-28 23:46:47 +01:00
Sebastian Dröge
2f7c0d21b6 flacenc/dec: Don't use GST_FLOW_IS_FATAL()
And properly handle UNEXPECTED and WRONG_STATE.
2010-09-04 14:52:10 +02:00
Mark Nauwelaerts
eb4afca554 flacdec: fix event leak 2010-07-22 16:25:38 +02:00
Sebastian Dröge
e9b267ae02 flacdec: Improve debugging and add some FIXMEs 2010-03-26 14:55:53 +01:00
Sebastian Dröge
b139cad3aa flacdec: Sample rate markers 0x01, 0x02 and 0x03 are valid
They are for 88.2kHz, 176.4kHz and 192kHz.
2010-03-26 14:42:06 +01:00
Sebastian Dröge
2e42e82037 flacdec: Take samplerate, width and number of channels from the STREAMINFO
...and update it from the frame headers if it should change for some reason.

This allows playback of files with odd sample rates.
2010-03-26 14:16:39 +01:00
Benjamin Otte
1055aaa9cb Add -Wredundant-decls warning flag
Also fix compile issues
2010-03-17 19:35:10 +01:00
Tim-Philipp Müller
de56a874ae flacdec: don't send second newsegment event in framed mode, fixes long playback delay
Don't send another newsegment event if the upstream muxer/parser has already
sent one (otherwise the sink will wait for $duration before starting playback).
Fixes long delay until playback starts with flac-in-ogg files.

Fixes #610959.
2010-03-08 17:10:31 +00:00
Sebastian Dröge
27b203b030 flacdec: Only flush the FLAC decoder if it wasn't created right before
If the FLAC decoder is flushed, its state will be set to frame-sync mode,
which will sync to the next *audio* frame and makes it ignore all headers.
This prevented tags and everything else to show up when using flacdec
in push mode.

Fixes bug #608843.
2010-02-12 10:54:18 +01:00
Mark Nauwelaerts
a76af918d0 flacdec: really use upstream timestamp if there is one
See/fixes #603471.
2010-01-06 14:14:28 +01:00
Mark Nauwelaerts
636738d9f2 flacdec: use a single decoder field for both push and pull mode 2009-12-23 19:39:56 +01:00
Mark Nauwelaerts
d6633d6edc flacdec: fix possible hanging in pull mode seeking
A seek in multi-sink pipeline typically leads to several seek events in a row,
which could lead to sending several newsegments in a row without intermediate
flushing.  These would then accumulate, distort rendering times and as such
lead to 'hanging'.
2009-12-23 19:39:54 +01:00
Stefan Kost
f1fe1f52fd flac: apparently on some platforms a FLAC__uint64!=guint64 2009-10-09 14:37:32 +03:00
Stefan Kost
f41d7e7bd5 build: don't cast, but use the right format specified instead
This correct some of the previous macos fixes.
2009-10-09 13:54:24 +03:00
Josep Torra
133ebe76a3 flac: fix warnings on macosx 2009-10-09 12:25:19 +02:00
Tim-Philipp Müller
cee10cb439 flacdec: send newsegment event when operating push-based and unframed
For some reason flac doesn't call our metadata callback when we operate
in push mode with unframed input, but that's where we set up the
newsegment event (since that's where we'd get the duration from the
stream info header), so we didn't send a newsegment event at all in this
case. Hack around this by storing a generic newsegment event for now
which will be used if we don't replace it with a better one that
includes the duration.
2009-08-01 17:07:42 +01:00
Tim-Philipp Müller
3cf8790906 flacdec: small cleanups
Remove some callback indirections which are no longer needed because
there's only one decoder object type now. Also remove unused variable.
2009-08-01 16:48:36 +01:00
Tim-Philipp Müller
e8badc0686 flacdec: use gst_adapter_copy() to avoid unnecessary buffer merges
gst_adapter_peek() will merge buffers as needed, which we can avoid
here since we're doing a memcpy anyway and then flush the copied
data from the adapter right away.
2009-08-01 15:22:49 +01:00
Tim-Philipp Müller
33b686974e flacdec: repair some broken indenting 2009-08-01 12:30:32 +01:00
Sebastian Dröge
169283dfc2 flacdec: Implement SEEKING query
Fixes bug #589423.
2009-07-23 12:07:33 +02:00
Tim-Philipp Müller
375976c847 flacdec: fix intermittent FLAC__STREAM_DECODER_ABORTED errors when seeking
When seeking in a local flac file (ie. operating pull-based), the decoder
would often just error out after the loop function sees a DECODER_ABORTED
status. This, however, is the read callback's way of telling our loop
function that pull_range failed and streaming should stop, in this case
because of the flush-start event that the seek handler pushed upstream
from the seeking thread. Handle this slightly better by storing the last
flow return from pull_range, so the loop function can evaluate it properly
when it encounters a DECODER_ABORTED and take the right action.

Fixes #578612.
2009-07-21 19:58:04 +01:00
Edward Hervey
f2ba1229ba flacdec: Don't send empty string tags 2009-07-01 08:40:40 +02:00
Tim-Philipp Müller
8accf2704b flacdec: fix buffer leak
gst_buffer_replace() will take its own ref, so we still have
to unref the buffer if we don't need it any longer.
2009-05-13 09:18:07 +01:00
Edward Hervey
e8cbbd22f8 flacdec: Actually output the pending buffer.. and not a blank one.
It was previously sending the bogus buffer which was returned from
the bufferalloc (required for reverse negotiation apparently) instead
of the pending buffer.
2009-05-08 16:40:57 +02:00
Jan Schmidt
c41d3d87fa flac: Make buffers created during seek act like normal buffers.
Store the offset and caps when allocating a buffer during seeking, and then
allocate a new buffer with buffer_alloc before we push it out. This ensures
that in all respects the first buffer decoded during seeking behaves like
all other buffers, including allowing downstream re-negotiation.
2009-05-06 14:24:20 +01:00
Thomas Vander Stichele
71acf2e900 flacdec: don't use pad_alloc when decoding while seeking. Fixes #579422 2009-05-06 15:28:46 +02:00
Thomas Vander Stichele
8009fcf547 add pending_samples so that we only update segment's last stop after really sending the samples 2009-04-04 15:14:32 +02:00
Thomas Vander Stichele
fb4953a68d add debugging 2009-04-04 15:14:31 +02:00