Commit graph

267 commits

Author SHA1 Message Date
Thiago Santos
b7516dbf7c baseparse: avoid returning _OK for _NOT_LINKED
When the parser receives non-aligned packets it can push a buffer
and get a not-linked return while still leaving some data still to
be parsed. This remaining data will not form a complete frame and
the subclass likely returns _OK and baseparse would take that
as the return, while it the element is actually not-linked.

This patch fixes this by storing the last flow-return from a push
and using that if a parsing operation doesn't result in data being
flushed or skipped.

https://bugzilla.gnome.org/show_bug.cgi?id=731474
2014-06-25 12:13:07 -03:00
Evan Nemerson
25af4ad652 base: use correct syntax in documentation more consistently
Previously, many constants were prefixed with # or unprefixed,
some functions and macros were prefixed with # instead of suffixed
with (), etc.

https://bugzilla.gnome.org/show_bug.cgi?id=731293
2014-06-06 15:09:21 -04:00
zhouming
2793f808ee baseparse: Pass rate of input segment to output segment
https://bugzilla.gnome.org/show_bug.cgi?id=729701
2014-06-06 13:53:35 +03:00
Jose Antonio Santos Cadenas
f880742638 baseparse: Fix memory leak
Queued frames were not released after being pushed, this
caused a leak of the GstBaseParseFrame structure.

https://bugzilla.gnome.org/show_bug.cgi?id=727883
2014-04-09 10:47:39 +02:00
Edward Hervey
6c2c49a590 baseparse: Remove always-true-checks
a gsize is guaranteed to be positive on all systems since it's an
unsigned value.

CID #1037147
2014-04-05 11:52:03 +02:00
Sebastian Dröge
37670af79c baseparse: Make sure to set the DISCONT flag on the first buffer of each GOP in reverse playback mode 2014-04-03 20:32:02 +02:00
Sebastian Dröge
a76db74496 baseparse: Fix splitting and reversing of GOPs in reverse playback mode
We iterate the current discont group backwards and push each GOP forwards,
starting from the last one. However if the first buffer in the current
discont group is a keyframe, we will keep it around until next time,
which is far from ideal. Just push it.
2014-03-29 10:32:25 +01:00
Thiago Santos
a3ff2976cc baseparse: do not accumulate buffers on passthrough mode
If on passthrough during reverse playback, do not accumulate buffers as
baseparse will never check for DISCONT flag to push those buffers.
So just push buffers downstream as if it was forward playback.

https://bugzilla.gnome.org/show_bug.cgi?id=721941
2014-01-13 08:43:28 -03:00
Thiago Santos
51fa54a281 baseparse: do not ignore TIME segments
TIME segments are being ignored and a standard initialized
segment is used instead. This causes issues as not properly detecting
reverse playback or not cliping output based on the segment.

This seems to be a regression from one of the GstSegment/GstEvent
redesigns on the 0.10 -> 1.0 transition
2014-01-08 16:40:23 -03:00
Thiago Santos
e02c00a58a baseparse: remove pending_segment as it was being misused
It wasn't required, instead baseparse was using it to check the media
caps to identify if it was handling audio or video.

The pending_segment was removed and a checked_media boolean
replaced it for a more accurate naming.

https://bugzilla.gnome.org/show_bug.cgi?id=721350
2014-01-02 16:48:23 -03:00
Thiago Santos
accaadf52a baseparse: push pending events before GAP event
A GAP event is handled as an empty buffer by sinks and they expect
to receive start up events before GAP events (like a segment).

This is important specially if there is a GAP at the beginning of
a stream (before any buffers) so that the segment event can be
pushed downstream before the GAP

https://bugzilla.gnome.org/show_bug.cgi?id=721350
2014-01-02 16:38:40 -03:00
Thiago Santos
d917eb7160 baseparse: refactor pending events pushing
Refactor code repeated 3 times to a common function

https://bugzilla.gnome.org/show_bug.cgi?id=721350
2014-01-02 16:38:40 -03:00
Sebastian Rasmussen
53ae1b2c9c docs: Fix typos in function/object descriptions
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=720029
2013-12-07 17:11:12 +00:00
Sebastian Rasmussen
e8ecf3c407 Fix some typos in code comments and debug messages
https://bugzilla.gnome.org/show_bug.cgi?id=720029
2013-12-07 17:09:39 +00:00
Mark Nauwelaerts
e24722c52c baseparse: ensure to preserve upstream timestamps
... rather than have subclass coming up with an internally parsed one.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=707230
2013-11-16 15:17:57 +01:00
Mark Nauwelaerts
8da78d1595 baseparse: try first frame pts and dts for a valid start timestamp 2013-11-02 16:13:27 +01:00
Mark Nauwelaerts
3aaa3fcf92 baseparse: print proper variable in debug statement 2013-11-02 16:13:27 +01:00
Edward Hervey
3c49b5d23b baseparse: Add a property to disable passthrough
In some specific cases (like transmuxing) we want to force the element
to actually parse all incoming data even if the element deems it is not
necessary.

This property simply ignores requests from the element to enable passthrough
mode which results in processing always being enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=705621
2013-08-13 17:11:35 +02:00
Sebastian Dröge
ef8455d395 base: Fix handling of SEGMENT query
The values should be in stream-time, and start/stop should not
be swapped for negative rates.
2013-07-29 12:10:45 +02:00
Sebastian Dröge
eb67ca7625 baseparse: Implement SEGMENT query 2013-07-29 10:49:18 +02:00
Thiago Santos
aa5ea6d80e baseparse: fix seqnum handling for seeks
Use the same seqnum as the seek for flushes/segments that are
caused by the seek. Also do the same for segment events

Fixes #676242
2013-07-25 15:19:35 -03:00
Sebastian Dröge
6363216e43 base: Use new group-id field in stream-start event and message 2013-07-22 15:30:10 +02:00
Wim Taymans
97b1e17b09 baseparse: reset PTS after seek
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=702778
2013-07-03 21:26:18 +02:00
Sebastian Dröge
f27a3e12f6 baseparse: Only infer TS if PTS interpolation is enabled
Otherwise this is breaking timestamps of formats that
need reordering.

https://bugzilla.gnome.org/show_bug.cgi?id=597662
2013-04-23 11:49:15 +02:00
Mark Nauwelaerts
6ddbaaa95c baseparse: reset next_pts upon SEGMENT event
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=691481
2013-03-27 18:26:30 +01:00
Mark Nauwelaerts
76acdee908 baseparse: more inter-timestamp tracking
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=691481
2013-03-27 18:26:30 +01:00
David Schleef
9ceb52d334 baseparse: Fix doc typo 2013-02-12 12:31:42 -08:00
David Schleef
2a8c95ff3b baseparse: add gst_base_parse_set_ts_at_offset()
Sets the buffer timestamps based on last seen timestamps at a
particular offset into the frame.

API: gst_base_parse_set_ts_at_offset()
2013-02-12 12:16:27 -08:00
Mark Nauwelaerts
314400d45a baseparse: improve PTS interpolating
... and tracking of DTS.  Fixes cases where PTS is locked on to the
DTS of an incoming buffer with no PTS with invalid data, leading to
no outgoing PTS (since it is not allowed smaller than DTS).

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=691481
2013-02-09 12:32:02 +01:00
Tim-Philipp Müller
5ea8937f56 docs: minor GstBaseParse docs fixes
Expose docs for gst_base_parse_finish_frame().
2013-01-14 20:05:23 +00:00
Tim-Philipp Müller
1702623b20 baseparse: add vfuncs to intercept queries
Useful for video parses that want to attach matter or
find out if downstream supports certain metas.

API: GstBaseParseClass::src_query()
API: GstBaseParseClass::sink_query()

https://bugzilla.gnome.org/show_bug.cgi?id=691475
2013-01-13 14:45:31 +00:00
Tim-Philipp Müller
2b1facfe1d baseparse: fix up name of default event vfuncs 2013-01-12 20:54:26 +00:00
Arnaud Vrac
4a1ff7fa95 baseparse: fix invalid output timestamps in some cases 2012-12-17 12:26:14 +01:00
Wim Taymans
fac7eb0a50 NEWSEGMENT -> SEGMENT 2012-12-14 15:24:30 +01:00
Wim Taymans
7518960829 baseparse: pass DTS and PTS to handle_buffer
This makes it handle the timestamps correctly and avoids using a wrong timestamp
for the output.
2012-12-11 16:46:18 +01:00
Wim Taymans
6c99839d89 baseparse: improve debug
Add pts and dts in debug log
2012-12-11 16:46:01 +01:00
Arnaud Vrac
94185ec94a baseparse: forward stream-start event in push mode 2012-11-20 12:46:31 +01:00
Tim-Philipp Müller
666c8c11c6 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 20:44:48 +00:00
Vincent Penquerc'h
37a72b1a82 baseparse: prevent excessively high memory usage with long streams
Large streams would index one frame every second, which can get quite
large with multi-hour streams, so add an additional byte-based
minimum distance as well, which will kick in for long streams
and make sure we never have more than a couple of thousand index
entries.

https://bugzilla.gnome.org/show_bug.cgi?id=666053
2012-10-28 19:49:37 +00:00
Mark Nauwelaerts
bd3a27f24c docs: adjust some parameter mismatches 2012-10-10 11:43:25 +02:00
Jan Schmidt
d08d3d8227 baseparse: Move some run of the mill debug statements to LOG level 2012-09-26 15:04:14 +10:00
Jan Schmidt
a663a4b9a0 baseparse: Output timestamps after a seek.
Reinitialise the DTS after a seek so as to continue
generating timestamps when baseparse is not downstream
of a demuxer.

Fixes: #684538
2012-09-26 15:04:04 +10:00
Jan Schmidt
196caf5ed6 baseparse: Add a mode/flag for disabling PTS interpolation
To be used by sub-classes implementing video formats with reordering
such as MPEG.
2012-09-12 22:44:37 -07:00
Jan Schmidt
f4b530ed9e baseparse: Handle GAP and still-frame events.
Hacky, because the still-frame code all lives in -base, where we
can't use it - so this is a hacky duplication of -base code. Not
sure which way to fix this: Move baseparse to -base, or move still-frame
events to core?
2012-09-12 22:38:40 -07:00
Jan Schmidt
257ad2c79e baseparse: Restructure event handling
Make the event handling more like what videodecoder does,
to ensure that all events are passed to child classes before being
placed on the pending queue or pushed onward.
2012-09-12 22:38:40 -07:00
Jan Schmidt
dbf4c13489 baseparse: Store incoming cached events in reverse order
Reverse the list just before sending. Prepending is more efficient
than appending, so this saves some cycles.
2012-09-12 22:38:40 -07:00
Jan Schmidt
3226160b31 baseparse: First attempt at handling both DTS and PTS 2012-09-12 22:38:36 -07:00
Tim-Philipp Müller
221d46f438 pad: expose gst_pad_mode_get_name() and use it in baseparse 2012-09-11 19:51:02 +01:00
Tim-Philipp Müller
a85991eeb8 baseparse, typefind: only activate in pull mode if upstream is seekable
Upstream might support pull mode, but only sequential pulls,
which isn't gonna do much for us.

https://bugzilla.gnome.org/show_bug.cgi?id=634927
2012-09-11 01:40:53 +01:00
Tim-Philipp Müller
dcacfb17cb baseparse: update for gst_message_new_duration -> _duration_changed() 2012-09-02 02:04:14 +01:00
Tim-Philipp Müller
b94e46b8b4 baseparse: make seeking in DEFAULT format work if the subclass can convert for us
We only deal in TIME format ourselves, but if the subclass can handle
converting other formats into TIME format, we can support that too.

Fixes seeking in DEFAULT (sample) format with flacparse,
and the flacdec unit test.
2012-08-19 17:51:00 +01:00
Tim-Philipp Müller
83870cf581 baseparse: fix reverse playback with upstream demuxers that support it
Don't just return FALSE for seek events with negative rates when
operating in push mode. An upstream demuxer may support this just
fine, so if we're not operating in pull mode always check upstream
first if it can handle the seek event. This fixes reverse playback
where the upstream demuxer supports it (e.g. with qtdemux). The
same code would work fine in 0.10, because baseparse will just
call the default pad event handler if FALSE was returned from the
baseparse event handler, and the pad event handler will just
forward it upstream. In 0.11 the baseclass or subclass is
responsible for chaining up to the parent class or forwarding the
event upstream in any case.

Disable reverse playback in pull mode for now, there seems to
be something going wrong with the segment configuration in that
case.
2012-08-10 23:18:33 +01:00
Sebastian Dröge
0d22988e5c event: Update for stream-start event API changes 2012-08-06 14:00:56 +02:00
Sebastian Dröge
826a8d643d tag: Add a scope to taglists
This specifies if a given taglist applies to the complete
medium or only this specific stream. By default a taglist
has a stream scope.

Fixes bug #677619.
2012-07-28 00:34:41 +02:00
Wim Taymans
f05b0e222f Update for new seeking variable name
When seeking, the start value and type are now called start and start_type.
2012-07-27 15:24:52 +02:00
Mark Nauwelaerts
363293731e baseparse: also account for frame size when merely scanning for frame
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=680495
2012-07-24 13:50:03 +02:00
Mark Nauwelaerts
2decf696e7 baseparse: remove obsolete function parameter 2012-07-24 13:50:02 +02:00
Tim-Philipp Müller
49ab4d9a45 baseparse: fix seekability querying with formats with headers like FLAC
Move code that checks for upstream seekability and all that to
the right place, otherwise it will never be done for formats
that have headers such as FLAC, as handle_and_push frame will
be called the first time only after headers have been processed
(and framecount is > 0). This then makes us report that we
can't seek, which disables the seek bar in totem.
2012-07-15 12:59:44 +01:00
Wim Taymans
35dbbdb50e baseparse: send seek event upstream first
First try to let upstream handle the seek event, then fail if the event is
something we don't understand.
2012-07-13 12:05:15 +02:00
Edward Hervey
042d1ff398 baseparse: Push STREAM_START in pull-mode 2012-07-11 10:26:13 +02:00
Edward Hervey
d3ffa82639 Remove 0.10-related documentation and "Since" markers 2012-07-10 12:03:27 +02:00
Tim-Philipp Müller
c51a2c1ddf basesrc, basesink, baseparse, typefind: use GST_SEGMENT_FLAG with segment flags 2012-07-09 21:51:07 +01:00
Sebastian Dröge
aa2309e54a event: Add format and position to the segment-done event 2012-07-05 13:04:31 +02:00
Sebastian Dröge
49d2ad5633 event: Implement segment-done event 2012-07-05 12:52:51 +02:00
Wim Taymans
76e8b2ecda task: add GDestroyNotify to _new
Add a GDestroyNotify to the user_data we pass to gst_task_new()
Change gst_pad_start_task() to also take the notify
2012-06-20 10:31:49 +02:00
Wim Taymans
c10d39a804 event: add name to sticky_multi events
The name of the event is used to store multiple sticky events of a certain type
on a pad.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=676859
2012-06-06 12:52:09 +02:00
Mark Nauwelaerts
584892bf79 baseparse: also perform state processing upon non-OK return
... since processing might still continue (if e.g. NOT_LINKED)
and then proper state (e.g. offset) needs to be maintained
(e.g. to arrange for a new frame setup).
2012-06-04 11:47:55 +02:00
Edward Hervey
98e1463411 baseparse: always attempt to push if not-linked
This avoids ending up with plenty of pending data (since we'll only
 try to parse/push one frame from the incoming buffer).

Fixes increasing memory consumption when parsers aren't linked

Conflicts:

	libs/gst/base/gstbaseparse.c
2012-04-02 15:27:14 +02:00
Sebastian Dröge
eadebb172d baseparse: Rename ::event() to ::sink_event() for consistency 2012-03-30 12:03:40 +02:00
Wim Taymans
e017498cb0 baseparse: do queries more directly
Just call our internal query function instead of going through the pad and the
query handler etc.
2012-03-20 17:11:19 +01:00
Wim Taymans
83af60019e query: rework the ALLOCATION query
Separate the bufferpool and allocator hints in the allocation query, some
of the values don't always make sense together.
Keep the bufferpool and its configuration together.
Keep the allocator and its parameters together.
Allow for multiple bufferpool configurations in the query.
2012-03-15 20:23:59 +01:00
Sebastian Dröge
38d398448a baseparse: Fix merge mistake 2012-03-08 10:32:02 +01:00
Sebastian Dröge
6b4091a30d Merge branch 'master' into 0.11
Conflicts:
	libs/gst/base/gstbaseparse.c
	libs/gst/base/gstbasetransform.c
	plugins/elements/gsttee.c
2012-03-08 10:19:52 +01:00
Sebastian Dröge
ed7f480222 baseparse: Fix 'self-comparison always evaluates to true'
This was really a bug.
2012-03-06 12:28:02 +01:00
Sebastian Dröge
495aca4905 baseparse: Fix handling of multiple newsegment events
Previously only the last would be pushed, which would cause
invalid running times downstream. This also fixes the handling
of update newsegment events.
2012-03-05 14:41:12 +01:00
Sebastian Dröge
563ba031a2 baseparse: Also flush the close_segment
Pushing this after flushing will confuse downstream.
2012-03-05 14:37:57 +01:00
Sebastian Dröge
747dfc09b2 baseparse: Remove obsolete code and move gap handling to the correct place
The segment start adjustment code in pull mode should never trigger
anymore because the bisection code earlier would have already made
sure that we're at the desired position.

Also move the gap handling some lines below after sending the currently
configured segments. Otherwise we might fill gaps in a segment that is
not configured downstream yet.
2012-03-05 14:23:17 +01:00
Sebastian Dröge
13930dad53 baseparse: Clear some more state when receiving FLUSH_STOP
Like pending serialized events and the currently cached buffer.
2012-03-05 13:12:18 +01:00
Sebastian Dröge
cd195f2143 baseparse: Only queue serialized events for sending them later 2012-03-05 13:01:14 +01:00
Wim Taymans
7b0e4f27fb memory: make _new_wrapped take user_data and notify
Make it possible to configure a GDestroyNotify and user_data for
gst_memory_new_wrapped() this allows for more flexible wrapping of foreign
memory blocks.
2012-02-22 02:10:21 +01:00
Mark Nauwelaerts
d95d2cfa1b baseparse: tweak some documentation 2012-02-15 17:12:09 +01:00
Mark Nauwelaerts
bfa4bb7150 baseparse: simplify and improve frame state handling
Use a frame flag to signal to subclass it should reset any retained
state w.r.t. frame parsing since the frame being passed is 'new',
i.e. not related to previously passed and processed data.
2012-02-15 17:11:54 +01:00
Wim Taymans
2609c7b452 baseparse: don't leak event
In the unlikely case where the subclass set the event function to NULL, don't
leak the event.
2012-02-15 13:15:55 +01:00
Wim Taymans
b6b239ceaa baseparse: make activation code more like other
Make the pad activation code look more like other activation code.
Only start the sinkpad task when we decide to activate in pull mode, when we
later add srcpad pullmode this will be needed.
2012-02-15 12:19:13 +01:00
Wim Taymans
49a7832499 baseparse: add some more debug 2012-02-15 11:11:11 +01:00
Mark Nauwelaerts
d148569cd4 baseparse: track consumed input size
... as used by subsequent input data rate estimation (and seeking).
2012-02-15 11:00:36 +01:00
Wim Taymans
63ba55865c baseparse: chain up to parent for defaults
Chain up to the parent instead of using the FALSE return value from the event
function (because it's otherwise impossible to return an error).
2012-02-15 10:13:37 +01:00
Mark Nauwelaerts
36cc9efa80 baseparse: Revert "baseparse: really provide upstream ts to subclass"
This reverts commit 2363490ef5.
2012-02-14 20:17:37 +01:00
Mark Nauwelaerts
a40b993bc3 baseparse: remove dead code and superfluous loop level 2012-02-14 19:33:50 +01:00
Mark Nauwelaerts
193e1cf16e baseparse: modify reverse playback handling
... so as to allow the push-mode case to provide data to subclass
on a buffer by buffer basis (as in regular forward case), rather
than all buffers of a fragment chucked together.

Also refactor buffer handling some more, and add some debug.
2012-02-14 19:33:46 +01:00
Mark Nauwelaerts
2363490ef5 baseparse: really provide upstream ts to subclass 2012-02-14 19:33:33 +01:00
Wim Taymans
ebf502d1c6 Merge branch 'master' into 0.11 2012-02-14 10:35:06 +01:00
Mark Nauwelaerts
b761f5479a baseparse: modify API to a _finish_frame based approach
... which aligns it with other baseclass in the wild, and should give
converter parsers a bit cleaner freedom.
2012-02-13 18:41:00 +01:00
Mark Nauwelaerts
c8ea9994aa baseparse: fix reverse playback
... especially for all-keyframe (audio) cases.
2012-02-13 18:14:02 +01:00
Wim Taymans
5fbdd763bb Merge branch 'master' into 0.11 2012-02-10 15:03:03 +01:00
Mark Nauwelaerts
954dd59fdd baseparse: bitrate mechanics should not deal with duration update
... since that is already handled by _update_duration, or should not be done
altogether if the duration is determined by non-estimated means.

Fixes #669502.
2012-02-10 14:47:00 +01:00
Mark Nauwelaerts
a306518cee baseparse: clean up a few minor extraneous tokens 2012-02-08 15:38:28 +01:00
Mark Nauwelaerts
2aaa475a4f baseparse: remove closing segment handling 2012-02-08 15:38:07 +01:00
Olivier Crête
e234a10c63 Use macros to register boxed types thread safely 2012-01-28 16:42:38 +00:00
Wim Taymans
21455d35b1 tests: fix some more leaks 2012-01-27 12:52:01 +01:00