Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Jan Schmidt
gst-plugins-good
Commits
ee063a57
Commit
ee063a57
authored
Aug 14, 2017
by
Eduard Sinelnikov
Committed by
Sebastian Dröge
Aug 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wavparse: Add support for growing WAV files
With some fixes by me.
parent
4abc746f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
3 deletions
+31
-3
gst/wavparse/gstwavparse.c
gst/wavparse/gstwavparse.c
+28
-3
gst/wavparse/gstwavparse.h
gst/wavparse/gstwavparse.h
+3
-0
No files found.
gst/wavparse/gstwavparse.c
View file @
ee063a57
...
...
@@ -227,6 +227,7 @@ gst_wavparse_reset (GstWavParse * wav)
wav
->
dataleft
=
0
;
wav
->
datasize
=
0
;
wav
->
datastart
=
0
;
wav
->
chunk_size
=
0
;
wav
->
duration
=
0
;
wav
->
got_fmt
=
FALSE
;
wav
->
first
=
TRUE
;
...
...
@@ -1336,6 +1337,8 @@ gst_wavparse_stream_headers (GstWavParse * wav)
GST_DEBUG_OBJECT
(
wav
,
"Using ds64 datasize"
);
size64
=
wav
->
datasize
;
}
wav
->
chunk_size
=
size64
;
/* If size is zero, then the data chunk probably actually extends to
the end of the file */
if
(
size64
==
0
&&
upstream_size
)
{
...
...
@@ -1978,9 +1981,31 @@ iterate_adapter:
"offset: %"
G_GINT64_FORMAT
" , end: %"
G_GINT64_FORMAT
" , dataleft: %"
G_GINT64_FORMAT
,
wav
->
offset
,
wav
->
end_offset
,
wav
->
dataleft
);
/* Get the next n bytes and output them */
if
(
wav
->
dataleft
==
0
||
wav
->
dataleft
<
wav
->
blockalign
)
goto
found_eos
;
if
((
wav
->
dataleft
==
0
||
wav
->
dataleft
<
wav
->
blockalign
))
{
/* In case chunk size is not declared in the begining get size from the
* file size directly */
if
(
wav
->
chunk_size
==
0
)
{
gint64
upstream_size
=
0
;
/* Get the size of the file */
if
(
!
gst_pad_peer_query_duration
(
wav
->
sinkpad
,
GST_FORMAT_BYTES
,
&
upstream_size
))
goto
found_eos
;
if
(
upstream_size
<
wav
->
offset
+
wav
->
datastart
)
goto
found_eos
;
/* If file has updated since the beggining continue reading the file */
wav
->
dataleft
=
upstream_size
-
wav
->
offset
-
wav
->
datastart
;
wav
->
end_offset
=
upstream_size
;
/* Get the next n bytes and output them, if we can */
if
(
wav
->
dataleft
==
0
||
wav
->
dataleft
<
wav
->
blockalign
)
goto
found_eos
;
}
else
{
goto
found_eos
;
}
}
/* scale the amount of data by the segment rate so we get equal
* amounts of data regardless of the playback rate */
...
...
gst/wavparse/gstwavparse.h
View file @
ee063a57
...
...
@@ -122,6 +122,9 @@ struct _GstWavParse {
gboolean
discont
;
gboolean
ignore_length
;
/* Size of the data as written in the chunk size */
guint32
chunk_size
;
};
struct
_GstWavParseClass
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment