Commit graph

296 commits

Author SHA1 Message Date
Aaron Boxer
46989dca96 documentation: fix a number of typos 2019-10-05 22:38:11 +00:00
Amr Mahdi
cbe61c4ff5 wavparse: Fix push mode ignoring audio with a size smaller than segment buffer
In push mode (streaming), if the audio size is smaller than segment buffer size, it would be ignored.
This happens because when the plugin receives an EOS signal while a single audio chunk that is less than the segment buffer size is buffered, it does not
flush this chunk. The fix is to flush the data chunk when it receives an EOS signal and has a single (first) chunk buffered.

How to reproduce:
1. Run gst-launch with tcp source
```
gst-launch-1.0  tcpserversrc port=3000 !  wavparse ignore-length=0 ! audioconvert ! filesink location=bug.wav
```
2. Send a wav file with unspecified data chunk length (0). Attached a test file
```
cat test.wav | nc localhost 3000
```
3. Compare the length of the source file and output file
```
ls -l test.wav bug.wav
-rw-rw-r-- 1 amr amr    0 Aug 15 11:07 bug.wav
-rwxrwxr-x 1 amr amr 3564 Aug 15 11:06 test.wav
```

The expected length of the result of the gst-lauch pipeline should be the same as the test file minus the headers (44), which is ```3564 - 44 = 3520``` but the actual output length is ```0```

After the fix:
```
ls -l test.wav fix.wav
-rw-rw-r-- 1 amr amr 3520 Aug 15 11:09 fix.wav
-rwxrwxr-x 1 amr amr 3564 Aug 15 11:06 test.wav
```
2019-08-19 07:30:17 +00:00
Amr Mahdi
5f01b9da05 wavparse: Fix ignoring of last chunk in push mode
In push mode (streaming), if the last audio payload chunk is less than the segment rate buffer size, it would be ignored since the plugin waits until it has at least segment rate bufer size of audio.

The fix is to introduce a flushing flag that indicates that no more audio will be available so that the plugin can recognize this condition and flush the data is has even if it is less
than the desired segment rate buffer size.
2019-08-07 12:09:46 +00:00
Thibault Saunier
0a6a62aa76 docs: Port all docstring to gtk-doc markdown 2019-05-13 10:24:40 -04:00
Jan Schmidt
098f936be8 wavparse: Declare support for RF64
RF64 encode support was added to wavenc quite some time
ago, but not declared in wavparse. It seems wavparse can
decode it though, so add it to the sink pad.

The RF64 support was added in
https://bugzilla.gnome.org/show_bug.cgi?id=735627
2019-02-24 14:29:27 +00:00
Sebastian Dröge
2415d517f1 wavparse: Implement SEGMENT query
https://bugzilla.gnome.org/show_bug.cgi?id=797313
2018-10-28 17:52:18 +00:00
Edward Hervey
14a9cc603e wavparse: Don't set invalid seqnum on events
Some codepath will call gst_wavparse_perform_seek without an event
and therefore without a valid seqnum
2018-06-06 07:48:32 +02:00
Eduard Sinelnikov
6d61471da6 wavparse: Add support for growing WAV files
With some fixes by me.
2017-08-14 16:02:35 +03:00
Deepak Srivastava
059420b678 wavparse: Fix memory leak in wavparse element
Fixing of leaking the text field of the GstWavParseNote and
GstWavParseLabl structure.

https://bugzilla.gnome.org/show_bug.cgi?id=785429
2017-08-10 13:23:47 +03:00
Sebastian Dröge
a82e38d607 wavparse: Actually clip to upstream size instead of size of the data chunk
There might be other chunks after the data chunk, so clipping the chunk
size with the data size can lead to a negative number and all following
calculations go wrong and cause crashes or worse.

This was introduced in 3ac119bbe2.

https://bugzilla.gnome.org/show_bug.cgi?id=783760
2017-06-14 00:11:17 +03:00
Rahul Bedarkar
f05c0c036e wavparse: check for not NULL before clearing adapter
In case wavparse receives a manually injected FLUSH_STOP event
while operating in pull mode we get criticals because we'd try
to clear a NULL adapter.

https://bugzilla.gnome.org/show_bug.cgi?id=777123
2017-01-25 09:59:50 +00:00
Sebastian Dröge
aecc31ab7b wavparse: Don't set caps to NULL after setting them on the srcpad
We would like to check later on EOS if we found a known stream type or
not, to possibly post an error message.

https://bugzilla.gnome.org/show_bug.cgi?id=773861
2016-11-03 12:34:51 +02:00
Sebastian Dröge
9ba6fb86d8 wavparse: Don't try to add srcpad if we don't know valid caps yet
Otherwise we'll run into an assertion on specially crafted files.

https://bugzilla.gnome.org/show_bug.cgi?id=773643
2016-10-31 11:11:32 +02:00
Thibault Saunier
150edef830 Use the new API to post flow ERROR messages on the bus
https://bugzilla.gnome.org/show_bug.cgi?id=770158
2016-08-26 19:23:26 -03:00
Carlos Rafael Giani
91e302e00d wavparse: Add tags for container format and bitrate for uncompressed PCM
The PCM bitrate is added to help downstream elements (like uridecodebin)
figure out a proper network buffer size

https://bugzilla.gnome.org/show_bug.cgi?id=769390
2016-08-02 15:22:25 +03:00
Stefan Sauer
36597cf201 wavparse: simplify and correct header scanning
The wav spec tells that 'fmt' (and 'bext' if present) must come before 'data'.
There is no requirement for 'fmt' to be first. We already had a list of chunks
to skip, but it is easier to just skip any chunk while seeking for 'fmt'.

This fixes reading files generated by ProTools.
2016-05-03 23:03:14 -07:00
Vineeth TM
1071309870 good: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763076
2016-03-24 14:32:20 +02:00
Sebastian Dröge
7927f49ca0 wavparse: Don't play anything after the end of the data chunk even when seeking
Especially in push mode we would completely ignore the size of the data chunk
when not stop position is given for the seek. Instead make sure that the end
offset is at most the end of the data chunk if known.

Without this we would output anything after the data chunk, possibly causing
loud noises if the media file is followed by an INFO chunk or an ID3 tag.
2016-01-19 14:57:03 +02:00
Sebastian Dröge
322bdf5136 wavparse: Don't do calculations with -1 offsets when handling SEGMENT events
We use that to signal "infinity", taking the difference between that and some
other value is not going to give us any useful result for the end offsets of
segments.
2016-01-19 14:55:57 +02:00
Sebastian Dröge
53c797d604 wavparse: When flushing on EOS, don't process more data than the "data" size
Even if we have more data queued up when flushing than the size of the data
chunk, don't process and output it. If the data size is known, this likely
contains another chunk (e.g. an INFO chunk) or things like ID3 tags. Just
outputting them as if they were data is going to cause unexpected behaviour
and unpleasant audio noises.
2016-01-13 23:42:31 +01:00
Thiago Santos
5e00c012d2 wavparse: remove extra variable to improve readability
Makes it easier to see that the event is being replaced/unrefed
2015-12-01 00:30:08 -03:00
Thiago Santos
d55458135a wavparse: respect seqnum in seek events
Propagate the original seek seqnum to events originated from
seeking to make sure they have the same value
2015-12-01 00:22:44 -03:00
Thiago Santos
763a7e5265 wavparse: flush upstream when seeking in pull mode
Makes sure upstream will unblock and return the thread so that
seeking can continue

https://bugzilla.gnome.org/show_bug.cgi?id=758861
2015-12-01 00:04:09 -03:00
Reynaldo H. Verdejo Pinochet
678e45a8f7 wavparse: remove unnecessary NULL checks before g_free() 2015-11-15 01:43:08 -08:00
Vincent Penquerc'h
8cfebfec8c wavparse: clip chunk size above the valid maximum (0x7fffffff)
https://bugzilla.gnome.org/show_bug.cgi?id=722567
2015-04-07 12:12:44 +01:00
Vincent Penquerc'h
3ac119bbe2 wavparse: clip chunk length to available data (when known)
This prevents silly chunk lengths from possibly overflowing
(at least when we know the actual data length).

https://bugzilla.gnome.org/show_bug.cgi?id=722567
2015-04-07 12:12:44 +01:00
David Schleef
59756c1898 wavparse: Fix up comments regarding DTS 2015-03-26 16:24:52 -07:00
David Schleef
c3bb399fd3 wavparse: be more strict about typefinding DTS
Code now matches comments.
2015-03-26 12:22:43 -07:00
Luis de Bethencourt
eb975ce880 wavparse: fix which stop variable is used in assignment
Assignment is done to variable segment.stop when the intention was to assign to
local variable stop. Instead of overwriting it, the value is now clamped and
segment.stop is set to it soon after.

CID #1265773
2015-02-06 14:46:14 +00:00
Sebastian Dröge
d5aab81a77 Constify some static arrays everywhere 2015-01-21 09:55:53 +01:00
Michael Smith
e8f3d596bc wavparse: skip an additional uninteresting chunk type before the fmt chunk. 2015-01-07 16:20:03 -08:00
Sebastian Dröge
a9d7c1d95e wavparse: Fix parsing of adtl chunks
We have to skip 12 bytes of data for the chunk, and the data size
passed to the sub-chunk parsing functions should have 4 bytes less
than the data size.

Also when parsing the sub-chunks, check if we actually have enough
data to read instead of just crashing.

https://bugzilla.gnome.org/show_bug.cgi?id=736266
2014-09-12 15:08:23 +03:00
Sebastian Dröge
f5df8af59e wavparse: Store size of data tag in a 64 bit integer locally too
Otherwise we will clip the DS64 value of RF64 files to 32 bits again.
2014-08-29 11:55:26 +03:00
Sebastian Dröge
d924f8a955 wavparse: Use 64 bit scaling functions now that fact is a 64 bit integer 2014-08-29 11:53:23 +03:00
Peter G. Baum
5c838af300 wavparse: support rf64 format
https://bugzilla.gnome.org/show_bug.cgi?id=735627
2014-08-29 11:49:42 +03:00
Sebastian Rasmussen
d33d8cf026 avidemux, wavparse: Print invalid fourcc in hex
Previously this was printed as characters which caused later processing
of the error message to sometimes warn about non-UTF-8 characters.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=732714
2014-07-04 09:21:07 +01:00
Sebastian Dröge
efaf996b1a wavparse: Update offset after parsing adtl chunk
Otherwise we will parse it over and over again without ever
getting past it.

https://bugzilla.gnome.org/show_bug.cgi?id=731533
2014-06-23 20:53:50 +02:00
Vincent Penquerc'h
40ae581ef2 wavparse: do not include codec_data on raw audio caps
If the wav header contains an extended chunk, we want to keep
the codec_data field, but not for raw audio.

This fixes some elements (such as adder) from failing to intersect
raw audio caps which would otherwise be intersectable.
2014-06-05 10:34:49 +01:00
Vincent Penquerc'h
218294b9f3 wavparse: avoid dividing by a 0 blockalign
This can be 0. In that case, do not try to cut off the last few
bytes from the last buffer.

Coverity 1146971
2014-05-02 14:49:27 +01:00
Tim-Philipp Müller
b1473491cf wavparse: pass on tags from upstream if there are any
Don't just ignore upstream tags from e.g. an ID3 tag before
the .wav data, pass them on downstream.

https://bugzilla.gnome.org/show_bug.cgi?id=729223
2014-04-30 01:08:41 +01:00
Tim-Philipp Müller
c9597298f9 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:35:17 +01:00
Vincent Penquerc'h
7ebfdbeaf8 wavparse: do not rely on call failure keeping return data unmodified
This is clearer this way too.

Coverity 206029
2014-04-16 17:44:50 +01:00
Mike Sheldon
659939f0f0 wavparse: Ignore Broadcast Wave Format (BWF) tags when searching for 'fmt' chunk
https://bugzilla.gnome.org/show_bug.cgi?id=723125
2014-01-29 20:16:48 +01:00
Stefan Sauer
73fe1d1f6f wavparse: remove ifdef'ed code
We do have adtl and cue parse as part of toc handling alreday. The fmt code is a left over from <0.10 times.
2014-01-06 13:55:36 +01:00
Stefan Sauer
9dde5e29da avidemux, waveparse: more logging for unhandled chunks
Always print a warning with the tag and if possible do a memdump.
2014-01-06 13:55:36 +01:00
Stéphane Cerveau
e7912641c3 wavparse: Skip id3 tag
Skip id3 tag during wav parse.

https://bugzilla.gnome.org/show_bug.cgi?id=721241
2013-12-31 10:39:21 +01:00
Stefan Sauer
2e277bb341 wavparse: emit midi-base-note tag from data in 'smpl' chunk
Add parsing of the 'smpl' chunk. Right now we only grab the midi-base-note and
emit it as a tag.
2013-12-30 14:41:47 +01:00
Tim-Philipp Müller
d506409af5 docs: get rid of 'Since: 0.10.x' markers
And some gtk-doc markup fixes.
2013-11-18 14:47:35 +00:00
Sebastian Dröge
0c2ff91a5c wavparse: Add support for group-id in the stream-start event 2013-07-22 15:30:13 +02:00
Sebastian Dröge
db1c2a28a6 wavparse: Push stream-start event in pull mode before anything else 2013-06-07 13:27:07 +02:00