Commit graph

135 commits

Author SHA1 Message Date
Tim-Philipp Müller
29afa75858 multifilesrc: fix regression with starting from index set via index property
When we haven't started yet, set the start_index when we set the index property,
so that we start at the right index position after the initial seek. The index
property was never really meant to be for writing, but it used to work, so let's
support it for backwards compatibility.

https://bugzilla.gnome.org/show_bug.cgi?id=739472
2015-08-18 13:17:34 +01:00
Thiago Santos
72212198c7 splitmuxsink: remove extra \n at debug message 2015-08-03 13:46:16 -03:00
Thiago Santos
a930a1364a splitmuxsink: prevent deadlock when states change too fast
If the GOP is completed, pads have to start gathering for the
next one but it is possible that the the state might go to
COLLECTING_GOP_START and back to WAITING_GOP_COMPLETE before the
thread has a chance to wake up and proceed, leaving it trapped in
the check_completed_gop loop and deadlocking the other threads
waiting for it to advance.

To solve it, this patch also checks that tha input running time
hasn't changed to prevent this scenario.
2015-08-03 13:46:16 -03:00
Jan Schmidt
a0182dd943 splitmuxsink: Support mpegtsmux as a muxer.
As a fallback, look for a pad template sink_%d on
the muxer when requesting pads, to support mpegtsmux

https://bugzilla.gnome.org/show_bug.cgi?id=752999
2015-07-29 23:03:30 +10:00
Jan Schmidt
e7ec32801a splitmuxsrc: Use a separate lock to delay typefind.
Don't hold the main splitmux part lock over
the parent state change function, as it prevents
posting error messages that happen. Since the purpose
is to prevent typefinding from proceeding, use a
separate mutex just for that.
2015-07-29 23:03:18 +10:00
George Kiagiadakis
bbfa46363c splitmuxsink: add a "format-location" signal that allows better control over filenames
In certain applications, splitting into files named after a base
location template and an incremental sequence number is not enough.

This signal gives more fine-grained control to the application to
decide how to name the files.

https://bugzilla.gnome.org/show_bug.cgi?id=750106
2015-07-14 18:45:49 +02:00
Thiago Santos
121fcbf7da splitmuxsrc: sticky events are sent automatically from the pad
No need to send them explicitly from the element

https://bugzilla.gnome.org/show_bug.cgi?id=751240
2015-06-25 17:13:43 -03:00
Thiago Santos
af6a09ae4c splitmuxsrc: make sure to push sticky events before adding pad
It allows the caps to be set on the pad before being added for
dynamic autoplugging to work.

https://bugzilla.gnome.org/show_bug.cgi?id=751240
2015-06-25 17:13:43 -03:00
Jan Schmidt
b26bbae695 Revert "splitmuxsink: Mask async-start/done while switching files."
This reverts commit d61e5393f1.

Causes failures muxing larger GOP sizes for some reason. Reverting
while I figure it out
2015-06-23 17:33:03 +10:00
Jan Schmidt
600bab0056 splitmuxsrc: Fix startup and shutdown races.
Fix 2 startup races when things happen too quickly, and 1
at shutdown by holding a ref to the pads in use until the
loop functions exit.

Handle errors activating file parts and publish them on
the bus.

https://bugzilla.gnome.org/show_bug.cgi?id=750747
2015-06-23 12:03:14 +10:00
Jan Schmidt
d61e5393f1 splitmuxsink: Mask async-start/done while switching files.
Sometimes, extra async-start/done from the internal sink
while the element is still starting up can cause splitmuxsink
to stall in PAUSED state when it has been set to PLAYING
by the app. Drop the child's async-start/done messages while
switching, so they don't cause state changes at the
splitmuxsink level.

https://bugzilla.gnome.org/show_bug.cgi?id=750747
2015-06-23 12:03:14 +10:00
Jan Schmidt
3f39d06338 splitmuxsink: Take released-but-not-yet-output bytes into account
When deciding whether it's time to switch to a new file, take into
account data that's been released for pushing, but hasn't yet
been pushed - because downstream is slow or the threads haven't been
scheduled.

Fixes a race in the unit test and probably in practice - sometimes
failing to switch when it should for an extra GOP or two.

Also fix a problem in splitmuxsrc where playback sometimes
stalls at startup if types are found too quickly.

https://bugzilla.gnome.org/show_bug.cgi?id=750747
2015-06-12 01:57:36 +10:00
Jan Schmidt
d78502deb1 splitmuxsink: Don't accumulate more than 2 GOPs
Don't allow large amounts of data to queue up - we only need
the GOP we're writing, and the GOP we're accumulating.
2015-06-08 18:58:43 +10:00
Jan Schmidt
94e113c6c6 splitmuxsrc: Protect total_duration state variable with the object lock.
Prevent deadlocks from downstream querying duration from the streaming thread.
2015-06-08 14:16:36 +10:00
Jimmy Ohn
d3997773fc splitfilesrc: Implement binary search in find_part_for_offset
Implement binary search using gst_util_array_binary_search

https://bugzilla.gnome.org/show_bug.cgi?id=749690
2015-05-25 14:23:32 +10:00
Edward Hervey
27c91bc881 multifilesink: Add a new max-duration file switching mode
This new mode ensures that files will never exceed a certain duration
based on incoming buffer PTS (and duration if present)

Note:
* You need timestamped buffers (duh). If some of the incoming buffers don't
  have PTS, then it will just accept them in the current file
2015-05-20 15:50:07 +02:00
Edward Hervey
f1ceaab02f multifilesink: streamline the file-switch code a bit
Use the same functions regardless of the mode we are using
2015-05-20 15:50:07 +02:00
Edward Hervey
db0abbd531 multifilesink: add "aggregate-gops" property to process GOPs as a whole
This property can be used in combination with next-file=max-size
(and perhaps a future next-file=max-duration) to make sure that
each file part starts cleanly with a key frame and the appropriate headers.

In order for this property to work correctly, upstream elements should make
sure than any headers that need to be written in a standalone file are:
1) in the streamheader caps field
2) and/or in the stream as one or more buffers marked with GST_BUFFER_FLAG_HEADER
   that are just before the keyframe buffer

This is useful for MPEG-TS/MPEG-PS file segmenting in
combination with mpegtsmux or mpegpsmux.

Original patch by: Tim-Philipp Müller <tim@centricular.com>
2015-05-20 15:49:57 +02:00
Stefan Sauer
168881a186 Revert "doc: Workaround gtkdoc issue"
This reverts commit 1797c8f8b1.

This is fixed by the gtk-doc 1.23 release.
<para> cannot contain <refsect2>:
http://www.docbook.org/tdg/en/html/para.html
http://www.docbook.org/tdg/en/html/refsect2.html
2015-05-18 20:13:01 +02:00
Nicolas Dufresne
1797c8f8b1 doc: Workaround gtkdoc issue
With gtkdoc 1.22, the XML generator fails when a itemizedlist is
followed by a refsect2. Workaround the issue by wrapping the
refsect2 into para.
2015-05-16 23:37:06 -04:00
Tim-Philipp Müller
3755409409 splitmuxsrc: minor error message clean-up
Don't put filename in error message shown to user.
2015-05-10 10:53:13 +01:00
Luis de Bethencourt
9391622579 Rename property enums from ARG_ to PROP_
Property enum items should be named PROP_ for consistency and readability.
2015-04-27 11:22:11 +01:00
Tim-Philipp Müller
d753a3eeb1 Remove obsolete Android build cruft
This is not needed any longer.
2015-04-26 17:55:07 +01:00
Luis de Bethencourt
671b4d25cd remove unused enum items PROP_LAST
This were probably added to the enums due to cargo cult programming and are
unused. Removing them.
2015-04-24 17:01:12 +01:00
George Kiagiadakis
97c03449a4 splitmuxsink: do not access property variable without the object lock, use the local stack copy instead 2015-04-15 13:30:19 +02:00
George Kiagiadakis
1954726328 splitmuxsink: add probe on the multiqueue's sink pad instead of the ghost pad
because _release_pad tries to release it from ctx->sinkpad, which is
multiqueue's sink pad, and currently fails because the probe is not
installed there
2015-04-15 13:30:19 +02:00
Tim-Philipp Müller
b745cb8a47 multifilesink: minor docs improvement 2015-04-13 14:31:17 +01:00
Vincent Penquerc'h
a862db33b6 splitmuxsink: fix mutex leak 2015-04-09 13:01:23 +01:00
Thiago Santos
cf7d9f676d multifilesink: close files before posting message
Makes sure the files were properly flushed and closed before
the message reaches the application
2015-04-04 11:55:00 -03:00
Thiago Santos
e00f0de4f3 multifilesink: post file message on EOS
When multifilesink is operating in any mode other than one file
per buffer, the last file created won't have a file message posted
as multifilesink doesn't handle the EOS event.

This patch fixes it by using the last position to post a file
message when EOS is received. This should ensure at least the
time related data and the filename are posted to the application
or other elements

https://bugzilla.gnome.org/show_bug.cgi?id=747000
2015-04-04 07:58:44 -03:00
Jan Schmidt
d441140cd6 splitmux: Shut down element before downward state change
Make sure the state change won't hang trying to shut down pads
by making sure the streaming has stopped before chaining up.
2015-03-10 15:49:33 +11:00
Jan Schmidt
b0ce43cde3 splitmuxsink: Protect property variables with the object lock.
Use the object lock instead of the splitmux lock to protect
internal property variables, so they're not locked when
switching to a new file.

https://bugzilla.gnome.org/show_bug.cgi?id=744420
2015-03-07 00:55:47 +11:00
Tim-Philipp Müller
f5b511b42b multifile: attempt to fix docs build issue on build bot 2015-02-26 19:48:33 +00:00
Luis de Bethencourt
4af5a2b760 splitmuxsin: remove dead code
Every instance of goto beach has buf_info equal NULL. Don't check
for a condition that never happens.

CID #1268399
2015-02-16 13:59:17 +00:00
Tim-Philipp Müller
3f5b690e78 splitmuxsink: flag as sink from the start 2015-02-13 20:40:48 +00:00
Tim-Philipp Müller
90badeebad splitmuxsink: fix example pipeline properly
x264enc might not have a max-key-int property, but it
has a key-int-max property...
2015-02-10 16:00:07 +00:00
Luis de Bethencourt
102ae8511a splitmux: fix typo 2015-02-10 14:57:55 +00:00
Luis de Bethencourt
12aa2428e0 splitmux: update example pipeline
Element x264enc doesn't have a max-key-int property
2015-02-10 14:56:23 +00:00
Luis de Bethencourt
0373fd8f65 splitmux: fix memory leak
If execution goes to the beach in line 981, buf_info goes out of scope without
the memory being free'd. Handle this case.

CID #1268403
2015-02-10 13:33:09 +00:00
Jan Schmidt
8ceb58122e splitmux: Add unit test for file splitting
Add a unit test for file splitting, and fix the leaks in the
splitmuxsink it found
2015-02-07 03:58:30 +11:00
Jan Schmidt
aa4c29c5d6 splitmux: Fix memory leaks until the test valgrinds clean 2015-02-07 00:19:36 +11:00
Jan Schmidt
ace6be8abb splitmux: Handle early EOS during part preparation
Handle the case where a short file reaches EOS while we're still
waiting for no-more-pads, and make sure we continue to the internal
READY state for real playback to work properly later.
2015-02-06 06:42:17 +11:00
Jan Schmidt
5e2214d309 splitmux: Implement new elements for splitting files at mux level.
Implement 2 new elements - splitmuxsink and splitmuxsrc.

splitmuxsink is a bin which wraps a muxer and takes 1 video stream,
plus audio/subtitle streams, and starts a new file
whenever necessary to avoid overrunning a threshold of either bytes
or time. New files are started at a keyframe, and corresponding audio
and subtitle streams are split at packet boundaries to match
video GOP timestamps.

splitmuxsrc is a corresponding source element which handles
the splitmux:// URL and plays back all component files,
reconstructing the original elementary streams as it goes.
2015-02-06 04:26:59 +11:00
Anuj Jaiswal
86579c59bf multifilesink: don't OR the same flag twice
https://bugzilla.gnome.org/show_bug.cgi?id=736462
2014-09-11 11:05:35 +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
Thibault Saunier
1fc591238b multifilesrc: Implement seeking in case of multiple images
https://bugzilla.gnome.org/show_bug.cgi?id=712254
2013-11-22 18:52:54 -03: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
Olivier Crête
4f0fdabf10 multifilesink: Let the base class do get_times
This will make sync=TRUE work, the default is still sync=FALSE
2013-05-13 13:34:22 -04:00
Sebastian Dröge
b0b0557c48 gst: Add better support for static plugins 2013-04-15 15:54:11 +02:00
Tim-Philipp Müller
6f1aa3e4d5 multifilesink: post messages in max-size mode as well
No reason not to really.
2012-11-16 09:13:22 +00:00