Commit graph

241 commits

Author SHA1 Message Date
Sebastian Dröge
6189847ed0 videodecoder: Always drain the decoder after a discont group in reverse playback mode 2014-03-30 18:26:59 +02:00
Sebastian Dröge
5a4fbb1638 videodecoder: Flush the decoder once per discont group, not once per keyframe 2014-03-30 18:00:53 +02:00
Sebastian Dröge
f1f8731ff5 videodecoder: Handle reverse playback with multiple GOPs per discont group properly
baseparse will reverse each GOP for us already, so the segment events can
be after our keyframe. Make sure to get it and all other relevant sticky
events before starting to decode.
2014-03-30 17:59:55 +02:00
Sebastian Dröge
50c2218d4d videodecoder: Log event types of events that are pushed downstream 2014-03-29 10:33:01 +01:00
Sebastian Dröge
1c26e5734c videodecoder: In reverse playback mode we need to finish the subclass after passing all frames to it 2014-03-29 10:33:01 +01:00
Sebastian Dröge
87829debe4 videodecoder: Add API to get the currently pending frame size for parsing
https://bugzilla.gnome.org/show_bug.cgi?id=719890
2014-01-18 13:54:22 +01:00
Thiago Santos
47f720a8f0 videodecoder: plug leak when frames are released on subclass stop
They end up stored in the 'pending_events' list and should be
freed after calling stop
2014-01-17 11:21:33 -03:00
Wim Taymans
ecac298e4e videodecoder: only copy chroma_site when known
Only overwrite the chroma-site if we have a valid value in the reference
format.
2014-01-13 17:24:01 +01:00
Thiago Santos
672cda66db videodecoder: do not lose events when dropping frames
Events must be persisted after a frame is dropped to avoid
losing obligatory information for the stream.

https://bugzilla.gnome.org/show_bug.cgi?id=721835
2014-01-13 06:11:09 -03:00
Thiago Santos
5b8e1925b5 videodecoder: use new segment earlier for reverse playback
For reverse playback, the segment event will only be pushed when
the first buffer is actually pushed. But for decoding frames and storing
those into the list to be pushed the output_segment.rate value is used
to determine if it is forward or reverse playback.

In case a previous segment event (or none) is in use it will mistakenly
think it is doing forward playback and push the buffers immediatelly and
try to clip buffers based on an old segment (or an uninitialized one, leading
to an assertion)

This patch fixes this by copying the segment earlier if on reverse playback

https://bugzilla.gnome.org/show_bug.cgi?id=721666
2014-01-13 06:11:09 -03:00
Julien Isorce
2e38741b94 videodecoder: release buffer pool and allocator on full reset
It allows to release the buffer pool sooner (i.e. when going
to GST_STATE_READY). Previously it was released in finalize.

Fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=720389
2013-12-16 16:07:05 +00:00
Sebastian Dröge
b5d26f3907 videodecoder: gst_video_decoder_release_frame() is available since 1.2.2 2013-12-13 14:37:24 +01:00
Nicolas Dufresne
09a6ca97d2 videodecoder: Add sink_query() src_query() virtual
https://bugzilla.gnome.org/show_bug.cgi?id=720103
2013-12-09 09:41:46 -05:00
Julien Isorce
79ef75888c videodec/enc: clear reconfigure flag if negotiate succeeds
So that it avoids to send an allocation query twice.
One from an early call to gst_video_encoder_negotiate from a
subclass, then one from gst_video_encoder_allocate_output_frame.
Which means that previously gst_video_encoder_negotiate was not
clearing the GST_PAD_FLAG_NEED_RECONFIGURE even on success.

Fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=719684
2013-12-05 15:19:16 +00:00
Sebastian Dröge
5acc099479 videodecoder: Add API to allow subclasses to specify that they needs caps before any buffers 2013-12-05 11:36:54 +01:00
Mark Nauwelaerts
40fc306017 videodecoder: make _release_frame external API
... so subclasses can release a frame all the way (also from frame list)
without having to pass through _finish_frame or _drop_frame.
The latter may not be applicable, or may or may not have already
been called for the frame in question.

See https://bugzilla.gnome.org/show_bug.cgi?id=693772
2013-12-01 12:06:37 +01:00
Mark Nauwelaerts
614d35d795 videodecoder: fix spelling error in debug message 2013-12-01 12:06:36 +01:00
Thiago Santos
81471099d2 videodecoder: error out if no frames are decoded before eos
Raise an error in case no frames are decoded before EOS and we
have input, meaning that data was received but it was somehow invalid.

https://bugzilla.gnome.org/show_bug.cgi?id=711094
2013-11-25 10:53:25 -03:00
Thiago Santos
0765962fbc videodecoder: allow using -1 for infinite tolerated errors
Allows using -1 to make videodecoder never post an error message
after decoding errors.

https://bugzilla.gnome.org/show_bug.cgi?id=711094
2013-11-25 10:53:14 -03:00
Mark Nauwelaerts
ee86a91957 videodecoder: avoid descending output timestamps
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=712796
2013-11-23 19:39:52 +01:00
Sreerenj Balachandran
cd52ff313e videodecoder: try to negotiate the buffer pool even though there is no o/p format
We could have allocation query before caps event and even without caps inside
the query. In such cases , the downstream can return a bufferpool object with
out actually configuring it. This feature is helpful to negotiate the bufferpool
with out knowing the output video format. For eg: some hardware accelerated
decoders can interpret the o/p video format only after it finishes the decoding
of one buffer at least.

https://bugzilla.gnome.org/show_bug.cgi?id=687183
2013-11-11 13:28:11 +01:00
Stefan Sauer
9269bee9bd videodecoder: don't overflow in bytes<->time conversion
fps_n and _d values can be large and this can overflow a uint. Also fix
copy'n'paste mistake in comments.
2013-10-08 09:15:21 +02:00
Olivier Crête
c10311ba70 videodecoder: If there is no PTS at all, assume it starts from the segment start
This is to make the multifilesrc ! pngdec case work

https://bugzilla.gnome.org/show_bug.cgi?id=688043
2013-09-19 09:52:48 +02:00
Sebastian Dröge
35ee4b056b videodecoder/videoencoder: Mark pads as requiring reconfiguration again if negotiation fails
Otherwise we might end up in non-optimal configuration, especially
when a flush happened during reconfiguration.
2013-09-12 09:35:00 +02:00
Sebastian Dröge
b0e4b5f69a videoencoder: Make sure to return TRUE if the same caps are set again 2013-08-25 10:26:30 +02:00
Edward Hervey
d1cf4b2b9a videocoder: Don't push out identical caps
This avoids triggering plenty of extra code/methods/overhead downstream when
we can just quickly check whenever we want to set caps whether they are
identical or not

https://bugzilla.gnome.org/show_bug.cgi?id=706600
2013-08-23 15:22:43 +02:00
Sebastian Dröge
c4d7ffddb5 videodecoder: Don't reset too much if we're resetting because of a soft-flush
Fixes reverse playback with Ogg/Theora.
2013-08-15 14:33:18 +02:00
Sebastian Dröge
695675ab7e videodecoder: Don't reset decoder on segment events
Either there was a flush before that resets everything anyway,
or resetting would make us lose information we might need if
it's just a segment update.
2013-08-15 13:26:39 +02:00
Sebastian Dröge
146bb1a153 video{en,de}coder: Add new flush vfunc as a replacement for reset 2013-08-15 13:26:39 +02:00
Sebastian Dröge
9df036c216 video{en,de}coder: Revert to old ::reset() behaviour and deprecate it 2013-08-15 13:26:38 +02:00
Youness Alaoui
17eb692c6a videodecoder: Clear taglist on reception of a STREAM_START event
https://bugzilla.gnome.org/show_bug.cgi?id=705109
2013-08-12 13:02:28 +02:00
Edward Hervey
b4b9f74f8b videodecoder: Revert previous commit
The 'hard' argument of reset changed signification after the latest
start/stop/reset refactoring.
2013-08-02 08:22:59 +02:00
Edward Hervey
84d476610b videodecoder: Pass on 'hard' argument from _flush to _reset
When most of the code was moved from _flush() to _reset() the 'hard'
argument was no longer propagated.
2013-08-01 16:02:48 +02:00
Sebastian Dröge
047abdc944 videodecoder/encoder: Call reset() always between start() and stop() and never outside 2013-07-26 10:22:32 +02:00
Sebastian Dröge
9259ee6729 videoencoder/decoder: Call reset() before start() too 2013-07-25 14:25:31 +02:00
Sebastian Dröge
612a2cf9d0 videodecoder: Refactor GstVideoDecoder::reset() handling a bit
Let gst_video_decoder_reset() call it as would be intuitive and
only call it indirectly from gst_video_decoder_flush(). Now it
actually makes sense.
2013-07-25 10:25:34 +02:00
Wim Taymans
409cb22253 videodecoder: Take DTS as PTS for keyframes as a last resort if we can't calculate any PTS
https://bugzilla.gnome.org/show_bug.cgi?id=704193
2013-07-24 09:24:45 +02:00
Sebastian Dröge
a00f4f239a videodecoder: Send all pending events with type < CAPS before sending caps 2013-07-01 11:16:34 +02:00
Sebastian Dröge
85eac2c31c video(enc|dec)oder: Don't return not-negotiated if flushing
If the pad is flushing after a failed negotiation, return
GST_FLOW_FLUSHING instead from finish_frame().

https://bugzilla.gnome.org/show_bug.cgi?id=701763
2013-06-30 18:17:47 +02:00
Edward Hervey
65624afd8f videodecoder: Fix drop frame handling at startup
In the unlikely case that the decoder drops a frame before the first
input frame is outputted, use the input segment (since it wasn't
carried over to the output segment yet)

https://bugzilla.gnome.org/show_bug.cgi?id=702502
2013-06-21 15:33:30 +02:00
Sebastian Dröge
bd62595a75 videodecoder: Change GST_WARNING to a GST_DEBUG
It's completely normal for some decoders to queue 50-60 frames without
it causing any problems, e.g. RPi.
2013-06-04 17:49:55 +02:00
Sebastian Dröge
0c2c909497 video: Always provide a buffer in gst_video_(enc|dec)oder_allocate_output_buffer()
We have no way of tell the caller of the exact error (e.g. if we're flushing),
so will have to wait until the caller uses API that returns a GstFlowReturn,
for example when pushing this buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=700006
2013-05-24 16:54:46 +02:00
Mathieu Duponchelle
6f233f67ef videodecoder: don't set the list to NULL after taking its address 2013-05-10 09:22:07 +02:00
Sebastian Dröge
82f1572205 videodecoder: Make sure to not push any post-caps events before we have caps
and that we push pre-caps events before we push caps, even if we don't
have a GstVideoFrame yet.
2013-05-09 16:05:59 +02:00
Sebastian Dröge
ba8e7062a4 Revert "videodecoder: If a frame is to be dropped, don't update timestamps"
This reverts commit c9c5cd8eef.
2013-05-09 10:37:06 +02:00
Sebastian Dröge
c9c5cd8eef videodecoder: If a frame is to be dropped, don't update timestamps 2013-05-09 08:54:45 +02:00
Sebastian Dröge
3e4aec6e7b video: Make sure to push pre-caps events before the caps event
https://bugzilla.gnome.org/show_bug.cgi?id=699894
2013-05-08 15:50:34 +02:00
Sebastian Dröge
0be8d14965 videodecoder: Try harder to push writable buffers downstream
For this release the corresponding GstVideoCodecFrame before
pushing the buffer. The buffer will now be writable unless
the subclass still holds another reference to the buffer or
the frame.
2013-04-25 16:13:10 +02:00
Tom Greenwood
3023521366 videodecoder: Ignore caps events if the caps did not change
https://bugzilla.gnome.org/show_bug.cgi?id=697672
2013-04-15 09:44:36 +02:00
Wim Taymans
c3651a7905 videodecoder: always send the new buffer to parse functions
When we get a new buffer, always call the parse function, even if it is a 0
sized buffer. For theora we need to also decode 0 sized buffers.
Ideally we would like to make theoradec be packetized but that fails currently
because of oggdemux and because of the assumptions that the base class makes.
2013-03-31 18:31:37 +02:00
Wim Taymans
3b8d053232 videodecoder: forward stream-start immediately 2013-03-30 19:14:40 +01:00
Thijs Vermeir
d189beda4d videodecoder: allow parse function to not use all data on adapter 2013-02-12 10:17:46 +01:00
David Schleef
31312d586e videodecoder: Don't blindly assign DTS to PTS
DTS and PTS usually have a non-zero offset between them in MPEG-TS,
so assigning DTS to PTS is almost always wrong.  The other, newer
timestamp recovery code does it correctly if we leave it as invalid.
2013-02-11 11:57:08 -08:00
David Schleef
ceb6585d26 videodecoder: warn if frame list gets long
Decoders that get unparsed input are internally leaking nearly
every incoming buffer.  This checks that case.
2013-02-11 11:56:14 -08:00
Sebastian Dröge
3f82e919dd libs: Use foo/foo.h as single-include header consistently everywhere
https://bugzilla.gnome.org/show_bug.cgi?id=688785
2012-12-12 17:13:10 +00:00
Sebastian Dröge
0bb5c6c012 videodecoder: Only keep track of timestamps if the subclass is parsing data
Otherwise we just pass through the timestamps directly and don't
need to waste additional memory for them.

Fixes bug #689814.
2012-12-10 11:51:02 +00:00
Sebastian Dröge
1990c45b60 videodecoder: Return the proportion directly 2012-11-20 12:21:08 +01:00
Sebastian Dröge
6228872df7 videodecoder: Rename from get_qos_info() to get_qos_proportion()
And only return the proportion. The earliest time already can be
retrieved from get_max_decode_time() and by renaming we allow this
to be more extensible in the future.
2012-11-20 12:08:26 +01:00
Andoni Morales Alastruey
5f55ea1ef3 videodecoder: add getter for QoS proportion and earliest_time
Add a getter for the QoS proportion and earliest_time to help
subclasses do better estimations based on the proportion.

API: gst_video_decoder_get_qos_info()

https://bugzilla.gnome.org/show_bug.cgi?id=687991
2012-11-19 23:57:43 +00:00
Sebastian Dröge
d697dd6d39 videodecoder: Reset the error count to 0 after successfully decoding a frame 2012-11-09 16:47:37 +01:00
Tim-Philipp Müller
5f59b4f7ee Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 23:05:09 +00:00
Sreerenj Balachandran
f816f94995 videodecoder: fix inappropriate compiler optimization hint macro usage
https://bugzilla.gnome.org/show_bug.cgi?id=679456
2012-10-28 23:09:36 +00:00
Tim-Philipp Müller
6c0c3eb967 videodecoder: don't leak message strings when error is not fatal 2012-10-20 11:37:33 +01:00
Tim-Philipp Müller
efff57d497 videodecoder: return NULL from _allocate_output_buffer() if alloc fails
.. instead of garbage pointer. Also log failure in debug log.
Should've returned the flow return like _allocate_output_frame().

https://bugzilla.gnome.org/show_bug.cgi?id=683098
2012-10-17 10:55:01 +01:00
Mark Nauwelaerts
706498cb6e videodecoder: finetune missing timestamp estimating
Monitor for reordered output timestamps, and then avoid oldest DTS
as PTS approach, and try for an oldest PTS as out PTS approach,
if at least all valid PTS available.

Avoids bogus estimating upon sparse available input PTS, and tries
to handle all-keyframe input, or input PTS which are actually DTS.
2012-10-10 15:04:10 +02:00
Sebastian Dröge
9d59b789c7 videodecoder: Fix unused variable compiler warning if debugging is disabled 2012-10-02 09:29:49 +02:00
Olivier Crête
531a5af30c videodecoder: Also use the object lock to protect the output_state
Hold both the stream and the object lock to modify the output_state,
this way it can be safely modified while hold either one or the other.

Also, only hold the object lock in the query

https://bugzilla.gnome.org/show_bug.cgi?id=684832
2012-10-01 14:43:29 -04:00
Mark Nauwelaerts
4adfff03ef video{de,en}coder: fix missing timestamp estimating
... by having some more timestamp tracking in a private frame field.
Not doing so would lead to (a.o.) losing the needed minimum timestamp in
an earlier sent frame.
2012-09-28 13:59:24 +02:00
Mark Nauwelaerts
dc2f2c9a40 videodecoder: use oldest frame DTS to estimate missing outgoing PTS 2012-09-27 11:31:34 +02:00
Tim-Philipp Müller
62c111f1e4 videodecoder: don't take STREAM_LOCK on upstream events
Don't try to take STREAM_LOCK on upstream events such as QOS.
Protect qos-related variables with object lock instead. Fixes
possible deadlock when shutting down in certain situations.

https://bugzilla.gnome.org/show_bug.cgi?id=684658
2012-09-24 10:56:35 +01:00
Sebastian Dröge
1e8f5a0b06 videodecoder: Update comments about forwarding/not-forwarding serialized events immediately 2012-09-20 10:04:30 +02:00
Olivier Crête
ebae8ffa71 videodecoder: Protect all accesses to priv->output_frame with the stream lock
Fixes segfault as queries/events can happen after a reset
2012-09-19 21:16:01 -04:00
Jan Schmidt
6159817c95 videodecoder: Handle GAP events
Drain out the decoder when encountering a gap. Needed for DVD 'still'
sequences which consist of a single video frame, and a large gap
while audio plays.
2012-09-12 23:07:29 -07:00
Jan Schmidt
52cfce851a Fix still-frame handling.
Still frame events are not OOB downstream. Also, always send
immediately downstream.
2012-09-12 23:07:28 -07:00
Jan Schmidt
041c16b47d On a still-frame begin message, drain out the decoder and send it.
Fixes still frame handling on DVDs
2012-09-02 23:19:09 -07:00
Jan Schmidt
acadc94279 Revert "videodecoder: Send serialised events immediately, after we're pre-rolled."
This reverts commit ef5316fbb0.
2012-09-02 22:59:58 -07:00
Jan Schmidt
ef5316fbb0 videodecoder: Send serialised events immediately, after we're pre-rolled.
Only hold back events until the first buffer is generated, then just
send them directly. Otherwise, important events like 'still-frame' are
held forever, waiting for a frame that'll never arrive.
2012-08-31 12:40:36 -07:00
Mark Nauwelaerts
9262e00007 videodecoder: parsing loop must ensure for a current frame 2012-08-28 14:31:06 +02:00
Sebastian Dröge
bdc056c12d video: Add methods to return a list of all pending GstVideoCodecFrames 2012-08-16 12:13:25 +02:00
Víctor Manuel Jáquez Leal
efe9e31b34 videodecoder: getters for pool and allocator
Sometimes the decoder would need to use the pool or the allocator for
something else than just allocating output buffers. For example, the querying
for different parameters, such as asking for a bigger number of buffers to
allocate in the pool.

This patch expose a two getters accessors: one for the buffer pool and the
other for the memory allocator.
2012-08-14 15:47:04 +02:00
Tim-Philipp Müller
d1299d1357 videodecoder: fix seeking again
Add missing break in FLUSH_STOP case.
2012-08-09 19:57:49 +01:00
Sebastian Dröge
b141bfed60 video: Merge upstream stream tags 2012-08-09 16:24:24 +02:00
Sebastian Dröge
9ffb579b75 videodecoder: Add API to conveniently handle tags 2012-08-09 16:02:42 +02:00
Sebastian Dröge
7cb22ef241 videodecoder: Add negotiate vfunc that is used to negotiate with downstream
The default implementation negotiates a buffer pool and allocator
with downstream.
2012-08-09 14:47:46 +02:00
Wim Taymans
683a38ad65 update for new variable names 2012-07-27 15:24:43 +02:00
Edward Hervey
6423a4027e video: Make all frame_number guint32
Unifies the code and ensures that:
* subclasses needing to use the frame_number on a void* field will
  always work
* wraparounds will be automatically taken care of if we have to deal
  with more than 2**32 frames
2012-07-26 18:38:42 +02:00
Mark Nauwelaerts
7b135e8810 video{de,en}coder: delay input caps processing until processing data
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=680614
2012-07-26 14:35:45 +02:00
Sebastian Dröge
df08e333d2 video: Correct usage of the base class stream lock
And also renegotiate if the srcpad requires reconfiguration
2012-07-23 11:50:11 +02:00
Sebastian Dröge
1645ea4a90 video: Rename alloc_output_buffer() to allocate_output_buffer() 2012-07-23 10:18:41 +02:00
Edward Hervey
8feaebb6eb videodecoder: Expose _negotiate function
This is to be called by decoders once they have set the output format
in order for (re)negotiation to be triggered as early as possible.

https://bugzilla.gnome.org/show_bug.cgi?id=679878
2012-07-18 18:17:57 +02:00
Edward Hervey
2817bdadc9 libs: Remove "Since" markers and minor doc fixups 2012-07-13 12:11:06 +02:00
Wim Taymans
0dd87d7eb7 fix for allocator API changes 2012-07-09 16:28:25 +02:00
Sebastian Dröge
9002471c93 video: Document buffer ownership of the GstVideoCodecFrame more explicit
And also the implications of calling the finish() functions.
2012-07-05 14:29:42 +02:00
Sebastian Dröge
7803ae97e9 videodecoder: Make sure the buffer is writable before changing fields in finish_frame() too
We can't be sure that we have the one and only reference here either.
2012-07-05 13:38:48 +02:00
Sebastian Dröge
8e15a2c28d videodecoder: Create a complete subbuffer before pushing
Otherwise we can't be sure that we are allowed to change the
buffer fields later for clipping.
2012-07-05 13:37:37 +02:00
Wim Taymans
676375ecfe videodec: add some assert 2012-07-04 09:15:26 +02:00
Wim Taymans
c7cfb66467 videodec: clear the right variable 2012-07-04 09:15:26 +02:00
Wim Taymans
c68683c15f videodecoder: avoid crash when getting duration
Check that we have a valid output_state before attempting to use it to calculate
the duration of a buffer. It is possible that we don't have a state yet, for
example when we are dropping the first buffers.
2012-06-27 16:56:22 +02:00
Sebastian Dröge
43e94eea98 videodecoder: Use GSlice to allocate the timestamp tracking structures 2012-06-27 16:42:10 +02:00
Wim Taymans
3327d13f1b videodecoder: small cleanups 2012-06-27 14:13:02 +02:00
Wim Taymans
9f591a0bd1 videodecoder: improve PTS and DTS handling
Also keep track of the DTS and use it to set PTS on keyframes.
Set DTS on outgoing buffers.
2012-06-27 13:48:58 +02:00
Jan Schmidt
1718697ae2 videodecoder: Don't leak a ref to frames in reverse playback 2012-06-26 22:26:57 +10:00
Jan Schmidt
b7759a4d42 videodecoder: Don't give out bogus frame deadlines
Make sure the frame deadline was set before calculating the
max_decode_time. Fixes problems with ffmpeg skipping frames when
it doesn't need to, when the input doesn't have full timestamping
(divx in avi)
2012-06-20 03:45:14 +10:00
Jan Schmidt
9a79a145b1 videodecoder: Remove gst_video_decoder_get_timestamp function
Interpolating the timestamps from the picture numbers
does more harm than good, getting it wrong in a lot of
cases (especially reverse playback). Removing it in favour
of simply incrementing the timestamps until there's
something better
2012-06-20 03:40:29 +10:00
Jan Schmidt
45cf9f651b videodecoder: EOS handling for reverse mode.
Handle EOS correctly in reverse mode by treating it
as a final discont and flushing out whatever we can.
2012-06-20 01:43:36 +10:00
Jan Schmidt
6718f0cfff videodecoder: misc improvements/changes
Use g_list_free_full instead of walking lists twice when freeing
them.

Remove pointless clause in gst_video_decoder_chain that doesn't
actually have any effect.

Other changes to make the code slightly more like the 0.11
version.
2012-06-20 01:43:31 +10:00
Jan Schmidt
ffd0f28460 videodecoder: Improve timestamp handling.
Fix problems with timestamp calculations when the incoming
buffers have sparse timestamps (as for theora) and reverse
playback. Fixes #675773
2012-06-20 01:43:26 +10:00
Jan Schmidt
1935cf0022 videodecoder: Re-work reverse playback handling
Move processing of the gather list into the flush_parse function.

Add a last ditch attempt to apply timestamps to outgoing buffers
when walking backwards through decoded frames. Requires that each
gathered region has at least one timestamp.

Make sure to remove decoded packets from the decode list when
they are sent - otherwise the list just grows on each cycle, with
more and more frames being decoded and then clipped away.

Break out of the processing loop early on a bad flow return to make
seeking more responsive.

Use the gst_video_decoder_clip_and_push_buf function in reverse
mode, instead of pushing all buffers arbitrarily.

A couple of small efficiency gains in the list handling, by moving
list elements directly and not reallocating, and by reversing
and concatenating the gather list instead of moving it one node
at a time.

Rename the gst_video_decoder_do_finish_frame function to
gst_video_decoder_release_frame.
2012-06-20 01:34:44 +10:00
Jan Schmidt
5dc7d4ea3a videodecoder: Split gst_video_decoder_finish_frame
Split the 2nd half of the gst_video_decoder_finish_frame function
out to gst_video_decoder_clip_and_push_buf.
2012-06-20 01:32:05 +10:00
Jan Schmidt
c977aa2c01 videodecoder: Rename queued list to output_queued for clarity.
Use g_list_free_full instead of g_list_foreach + g_list_free
2012-06-20 01:32:05 +10:00
Jan Schmidt
487e5348e0 videodecoder: Small cleanups
Remove extra deref using a local var, and add/change some doc comments
and debug statements
2012-06-20 01:32:05 +10:00
Jan Schmidt
2d770ac406 videodecoder: Rename gst_video_decoder_have_frame_2 function
Rename gst_video_decoder_have_frame_2 to
gst_video_decoder_decode_frame and pass the frame to process
directly, rather than using the current_frame pointer as a holding
pen.

Move the negative rate handling out of the function to where it
is needed, and remove the process flag.
2012-06-20 01:32:05 +10:00
Jan Schmidt
ca09aaabc7 videodecoder: Extend docs and add comments
Update the documentation block for the base class, and add a comment
block about the reverse-playback logic and implementation.
2012-06-20 01:32:03 +10:00
Edward Hervey
4b946e8cee videodecoder: Ensure buffers don't disappear early
The frames are the owners of the buffers. In cases where a decoder
would keep around reference frames, we need to ensure they don't
disappear early.
To handle this, we pass downstream a complete sub-buffer of the output
buffer, ensuring that the buffer will only be released when downstream
is done with it *AND* the frame is no longer used.

Conflicts:

	gst-libs/gst/video/gstvideodecoder.c
2012-06-19 09:33:03 +01:00
Sebastian Dröge
4119246081 videoencoder,videodecoder: Return new references from _get_frame() 2012-06-19 09:26:36 +01:00
Sebastian Dröge
1e635f682f videodecoder: Add GstVideoDecoder::propose_allocation() vfunc 2012-06-15 16:38:16 +02:00
Jan Schmidt
f865729e95 videodecoder: Fix initial timestamp in ogg, and a warning.
Don't replace the initial frame's timestamp with a bogus
one calculated from the (incorrect for Ogg) frame number just
because the 'sync time' hasn't changed.

Also, don't output a bogus warning about the output_frame being
NULL when it's being dropped/skipped due to QoS.
2012-06-13 01:58:05 +10:00
Vincent Penquerc'h
8b10be67e4 videodecoder: use GST_CLOCK_TIME_IS_VALID where appropriate 2012-06-08 13:59:53 +01:00
Vincent Penquerc'h
d7ee6a9c57 videodecoder: do not do timestamp arithmetic from an invalid timestamp
This fixes untimestampped buffers from being rejected by the segment clipper.

https://bugzilla.gnome.org/show_bug.cgi?id=676022
2012-06-07 16:59:09 +01:00
Wim Taymans
d923f9fe70 videodecoder: only copy known colorimetry values
Avoid overriding the default colorimetry values.
2012-06-04 18:17:42 +02:00
Matej Knopp
e316ff5435 videodecoder: Do not unref frame if not in the list 2012-06-04 10:43:56 +02:00
Raimo Järvi
d42a197c04 video: Fix printf format warnings on mingw-w64
https://bugzilla.gnome.org/show_bug.cgi?id=676442
2012-05-24 10:57:21 +02:00
Sreerenj Balachandran
38a2fe673e videodecoder: improve doc 2012-05-23 10:16:25 +02:00
Tim-Philipp Müller
c1bc70300d docs: fix up video decoder/encoder docs a bit
Makes gtk-doc happy.
2012-05-16 12:40:07 +01:00
Sebastian Dröge
ecd061e48c videodecoder: Also change gst_video_decoder_get_oldest_frame() to return a new reference 2012-05-01 16:59:10 +02:00
Edward Hervey
8217575af1 videodecoder: Add a reference to frame passed to subclass
We have one reference owned by the internal frame list and one reference
passed to the subclass.
2012-05-01 16:58:55 +02:00
Wim Taymans
34bfcb2af9 videodecoder: don't leak events
When need to push out all the previously received events, concatenate all the
events from the previous frames (instead of leaking the old ones)
Improve debugging a little

Conflicts:

	gst-libs/gst/video/gstvideodecoder.c
2012-05-01 16:58:48 +02:00
Wim Taymans
8fde7850c0 videodecoder: don't leak frames
Frames receive a refcount when added to the frames list so release that refcount
in gst_video_decoder_do_finish_frame(). Also release the ref on the frame
because gst_video_decoder_do_finish_frame() takes ownership of the passed frame.
2012-05-01 15:03:40 +02:00
Wim Taymans
e8c7f57a0a videodecoder: avoid double unlock 2012-05-01 15:03:21 +02:00
Sebastian Dröge
cb04d8e003 videodecoder: Do bufferpool configuration inside the default decide_allocation() implementation
This allows subclasses to override it, as is necessary for e.g. the
video-crop meta. It is now necessary that after decide_allocation()
there is always a allocator and a configured buffer pool inside the
query.
2012-05-01 13:33:20 +02:00
Sebastian Dröge
f9facc6a4a video: Remove interlaced handling from the video base classes
This must be handled by the subclasses in 0.11 because interlacing
is much more complex now and can't be handled in a generic way.
2012-04-25 18:21:03 +02:00
Wim Taymans
777d044357 videodec: remove some FIXMEs 2012-04-25 14:57:40 +02:00
Sebastian Dröge
bcef106f73 video: Fix latency query handling if the element's own max_latency is GST_CLOCK_TIME_NONE 2012-04-25 13:53:29 +02:00
Sebastian Dröge
7c165187af videodecoder: Change configure_buffer_pool() vfunc to decide_allocation() with same semantics as in basetransform 2012-04-25 13:19:11 +02:00
Sebastian Dröge
1483997207 videodecoder: Add support for subclasses to configure the buffer pool 2012-04-24 22:35:29 +02:00
Sebastian Dröge
a8c40a658c video: Some porting bugfixes 2012-04-24 21:32:08 +02:00
Sebastian Dröge
b945c01549 videodecoder: Add minimal support for buffer pools 2012-04-24 20:04:48 +02:00
Sebastian Dröge
63563e3d5e videodecoder: Require to chain up to the parent classes event functions 2012-04-24 19:51:30 +02:00
Sebastian Dröge
f7bc9cc5ba video: Initial port of video base classes and related things to 0.11 2012-04-24 19:35:24 +02:00
Edward Hervey
a744c98985 videodecoder: Detect buffers inputted with DTS
Some container formats (like AVI) set DTS on the buffers instead of
PTS.
We detect this by:
* detecting if input timestamps are non-increasing
* detecting if the order the frames come out is the same as the order
  they were inputted (meaning the implementation is reordering frames).

If the decoder reorders frames, but input buffer timestamps were not
reordered, that means the buffers has DTS and not PTS as their timestamp.
If this is the case, we use set the PTS of the outgoing frames in the
same order as they were given to the decoder.

This fixes the issue for any decoder using this base class (yay).
2012-04-24 17:03:40 +02:00
Edward Hervey
f6cfd763e4 video: Base classes for video decoders and encoders 2012-04-24 17:03:40 +02:00