Commit graph

158 commits

Author SHA1 Message Date
Sebastian Dröge
bec7f4ad5e videorate: In reverse playback mode, don't output the first buffer with ts=segment.stop
Instead go backwards before segment.stop based on the framerate or the
next buffers end timestamp. Otherwise the first buffer will usually be
dropped because outside the segment.

https://bugzilla.gnome.org/show_bug.cgi?id=781899
2018-03-29 20:48:27 +03:00
Mathieu Duponchelle
875af55937 videorate: flush remaining buffers on SEGMENT_DONE
Just as we do on EOS.

https://bugzilla.gnome.org/show_bug.cgi?id=784666
2017-07-21 14:22:07 -04:00
Guillaume Desmottes
36b7e5890f videorate: stop copying buffers in drop-only mode
gst_video_rate_flush_prev() ensures that the pushed buffer is writable
by calling gst_buffer_make_writable() on videorate->prevbuf.

In drop-only mode we always push buffers directly when they are received
from GstBaseTransform (gst_video_rate_transform_ip()) and do not keep them
around. GstBaseTransform already ensures that those buffers are
writable so there is no need to do it twice.

This change saves us from copying buffers in drop-only mode as we no longer
calls gst_buffer_make_writable() with a buffer having a refcount of 2
(one ref owned by GstBaseTransform and one in videorate->prevbuf).

https://bugzilla.gnome.org/show_bug.cgi?id=780767
2017-05-20 16:35:53 +02:00
Guillaume Desmottes
2c2d2a444c videorate: factor out gst_video_rate_push_buffer()
No semantic change, just factor out this function from
gst_video_rate_flush_prev().

I'm about to use it to change the 'drop-only' code path.

https://bugzilla.gnome.org/show_bug.cgi?id=780767
2017-05-20 16:35:53 +02:00
Sebastian Dröge
0be4504b10 Revert "videorate: In reverse playback mode, don't output the first buffer with ts=segment.stop"
This reverts commit e6736e9925.

This one is for after 1.12.0 and shouldn't have been merged yet.
2017-05-02 14:32:02 +03:00
Sebastian Dröge
e6736e9925 videorate: In reverse playback mode, don't output the first buffer with ts=segment.stop
Instead go backwards before segment.stop based on the framerate or the
next buffers end timestamp. Otherwise the first buffer will usually be
dropped because outside the segment.

https://bugzilla.gnome.org/show_bug.cgi?id=781899
2017-05-02 14:05:39 +03:00
Thibault Saunier
099ac9faf2 docs: Convert gtkdoc comments to markdown
Modernizing the documentation, making it simpler to read an
modify and allowing us to possibly switch to hotdoc in the
future.
2017-03-10 18:19:17 -03:00
Tim-Philipp Müller
f9d110f596 videorate: fix LATENCY query
The latency query originally had a fallthrough to the default
label at the end as fallback, but that got messed up when the
DURATION and POSITION queries were added, so it then fell through
to the duration query handler instead. Restore original behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=699077
2017-01-24 01:04:53 +00:00
Tim-Philipp Müller
d6c0e9072b videorate: fix duration and position query handling
Duration query would return TRUE and duration=-1. This
worked in the unit test because the unit test implementation
was a bit broken.

Both queries need to access rate with a lock.

Fix broken duration query test as well. It relied on broken
behaviour by the videorate query handler, and also it was
implemented as a downstream query rather than an upstream
query. And we must return HANDLED from the probe so that the
query we intercept actually returns TRUE.

https://bugzilla.gnome.org/show_bug.cgi?id=699077
2017-01-24 01:04:39 +00:00
Joris Valette
658ee6f0db videorate: Add fixed rate property
https://bugzilla.gnome.org/show_bug.cgi?id=699077
2016-11-04 14:01:54 -03:00
Sebastian Dröge
2ebbd1c9fa videorate: Implement basic support for reverse playback
This is enough for making it work in GES, but it's unclear if all the various
property combinations are working correctly. It's an improvement over what was
there before in any case, which was to just drop all buffers if rate < 0.0.

https://bugzilla.gnome.org/show_bug.cgi?id=769624
2016-08-19 15:57:01 +03:00
Sebastian Dröge
6788003912 videorate: Don't fill up the segment with duplicate buffers if drop_only==TRUE 2016-04-03 11:40:50 +03:00
Sebastian Dröge
eda44c640e videorate: Remove dead code
We never get into this code path at all if drop_only==TRUE.
2016-04-03 11:38:28 +03:00
Frédéric Bertolus
2626c02149 videorate: avoid useless buffer copy in drop-only mode
Make writable the buffer before pushing it lead to a buffer copy. It's
because a reference is keep for the previous buffer.
The previous buffer reference is only need to duplicate the buffer. In
drop-only mode, the previous buffer is release just after pushing the
buffer so a copy is done but it's useless.

https://bugzilla.gnome.org/show_bug.cgi?id=764319
2016-04-03 11:37:52 +03:00
Vineeth TM
44b70ca3a1 base: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763075
2016-03-24 14:25:41 +02:00
Thiago Santos
5ef0a09794 videorate: replace accept-caps with a caps query
accept-caps is only a shallow check, it needs to know
whether downstream as a whole accepts the framerate
2016-01-08 15:05:38 -03:00
Vincent Penquerc'h
033ce9b20d videorate: remove dead code
Since the loops increasing count from 0 are always run at least
once (if count < 1), count will always be at least one when
compared to the drop/dup conditions.

Coverity 1139674
2015-12-16 11:00:22 +00:00
Vineeth T M
a1d84edd16 videorate: remove unnecessary break statement
Trivial patch to remove unncessary break statement used after
goto statement.

https://bugzilla.gnome.org/show_bug.cgi?id=754054
2015-10-02 17:27:13 +03:00
Thiago Santos
909f494a5a videorate: fixate the pixel-aspect-ratio
If the pixel-aspect-ratio is not fixed, try to get it as close
to 1/1 as possible

https://bugzilla.gnome.org/show_bug.cgi?id=748635
2015-08-13 14:11:37 -03:00
Joan Pau Beltran
5070d6367e videorate: add support for bayer formats
Since the videorate element just duplicates or drops frames
to achieve the desired framerate, it can accept video/x-bayer media
(in any format), which are not present in the current caps.
Just add "video/x-bayer(ANY);" to the caps of the static pad template
(fixing line style to pass the indent commit hook).

https://bugzilla.gnome.org/show_bug.cgi?id=753483
2015-08-10 17:21:03 -04:00
George Kiagiadakis
c84f911cee videorate: update the caps framerate only in the GST_PAD_SINK transform_caps direction
When a stream has a variable framerate, videorate calculates it and
forces it on the output caps. However, the code in _transform_caps()
currently also does that if the transform is going in the opposite
direction (GST_PAD_SRC), so during a renegotiation it tries to force
upstream to use the calculated framerate and it fails.

https://bugzilla.gnome.org/show_bug.cgi?id=750032
2015-05-29 15:03:05 +02:00
Tim-Philipp Müller
ec5c93f169 docs: update element example pipelines
- gst-launch -> gst-launch-1.0
- use autoaudiosink and audiovideosink more often
- review pipeline examples and descriptions
2015-05-10 11:38:19 +01:00
Tim-Philipp Müller
609d021f96 videorate: downgrade left-over ERROR debug message 2015-04-04 00:49:23 +01:00
Tim-Philipp Müller
413fc30235 videorate: fix a couple of memory leaks
tests: videorate: fix leak in unit test
2015-04-04 00:49:21 +01:00
Thibault Saunier
ae86dec9ca videorate: Detect framerate if not forced to variable downstream
In case upstream does not provide videorate with framerate information,
it will detect the current framerate from the buffer it received,
but if downstream forces the use of variable framerate (most probably
through the use of a caps filter with framerate = 0 / 1), videorate will
respect that.

And add some unit tests

https://bugzilla.gnome.org/show_bug.cgi?id=734424
2015-04-02 17:13:24 -04:00
Thibault Saunier
1cda538e00 videorate: Do not loop forever pushing first buffer when variable framerate
In the case the framerate is variable (represented by framerate=0/1),
we currently end up loop pushing the first buffer and then recompute
diff1 and diff2 without updating the videorate->next_ts at all
leading to infinitely looping pushing that first buffer.

In the case of variable framerate, we should just compute the next_ts
as previous_pts + previous_duration.

https://bugzilla.gnome.org/show_bug.cgi?id=734424
2015-04-02 17:13:24 -04:00
Nicolas Dufresne
9695222b0f videorate: Don't leak the pools
gst_query_set_nth_alloction_pool() is transfer none on the pool, so we must
unref the pool when done.
2015-03-24 15:23:34 -04:00
Olivier Crete
124b6ee03c videorate: Accept any capsfeatures 2015-03-09 21:39:02 -04:00
Nicolas Dufresne
e60158c98f videorate: Implement allocation query
The videorate element keeps 1 buffer internally. This buffer need
to be requested during allocation query otherwise the pipeline may
stall.

https://bugzilla.gnome.org/show_bug.cgi?id=738302
2015-01-18 14:58:36 -05:00
Nicolas Dufresne
2e264103e1 Revert "videorate: Implement allocation query"
This reverts commit 3c04db4a30.
2015-01-18 14:17:07 -05:00
Nicolas Dufresne
3c04db4a30 videorate: Implement allocation query
VideRate keeps 1 buffer in order to duplicate base on closest buffer
relative to targeted time. This extra buffer need to be request
otherwise the pipeline may stall when fixed size buffer pool is used.

https://bugzilla.gnome.org/show_bug.cgi?id=738302
2015-01-18 11:02:00 -05:00
Sebastian Dröge
cefc518494 videorate: Operate in a zero-latency mode if drop-only is set to TRUE
There's no reason why we would have to wait for the next buffer to decide
whether to output the current one or not. We just have to check if the
current one is earlier than our expected next time, which is the previous
frame timestamp plus the expected frame duration.

https://bugzilla.gnome.org/show_bug.cgi?id=740018
2014-11-19 15:10:48 +01:00
Vineeth T M
302f123c62 videorate: GstStructure refcount critical message
s3 is not being initialized when run in a loop
and the same was being freed, which resulted in the crash

https://bugzilla.gnome.org/show_bug.cgi?id=735952
2014-09-03 12:56:31 +03:00
Tim-Philipp Müller
bcb8068e27 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:28:57 +01:00
Edward Hervey
ed59e06c57 videorate: Remove useless assignement
Was already set before
2013-12-30 13:45:04 +01:00
Tim-Philipp Müller
b1ff48c1a1 docs: remove old 0.10 Since markers
They're just confusing.
2013-11-16 16:10:07 +00:00
Matej Knopp
496dd67859 videorate: ignore GAP event
videorate automatically fills gaps with the previous frames.

https://bugzilla.gnome.org/show_bug.cgi?id=705048
2013-07-29 08:24:06 +02:00
Mathieu Duponchelle
aec0e48aa1 videorate: Reset base timestamp and out_frame_count in any case on SEGMENT_EVENT
Fixes #699187
2013-05-09 16:22:13 +02: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
Tim-Philipp Müller
3c6a3ad629 Use new gst_element_class_set_static_metadata() 2012-04-10 00:45:16 +01:00
Sebastian Dröge
ad42b16375 gst: Update for GST_PLUGIN_DEFINE() API change 2012-04-05 15:11:05 +02:00
Wim Taymans
25137962ad fix for caps API changes 2012-03-11 19:04:41 +01:00
Wim Taymans
14387953a0 update for basetransform change 2012-02-24 11:03:16 +01:00
Wim Taymans
9212619549 update for new fixate_caps function 2012-02-22 12:32:44 +01:00
Tim-Philipp Müller
576bbb4fd8 Remove compatibility code cruft for old GLib versions 2012-01-18 17:22:21 +00:00
Wim Taymans
30a66af4e2 videorate: chain up to parent event function 2012-01-02 17:42:11 +01:00
Wim Taymans
f4e58e3e8e videorate: fix caps negotiation function 2012-01-02 17:28:12 +01:00
Tim-Philipp Müller
fb6d09055a Merge remote-tracking branch 'origin/master' into 0.11
Conflicts:
	ext/alsa/gstalsadeviceprobe.c
	ext/alsa/gstalsamixer.c
	ext/pango/gsttextoverlay.c
	ext/pango/gsttextoverlay.h
	gst-libs/gst/audio/gstaudiobasesink.c
	gst-libs/gst/audio/gstaudioringbuffer.c
	gst-libs/gst/audio/gstaudiosrc.c
	gst-libs/gst/video/Makefile.am
	gst-libs/gst/video/video.c
	gst/encoding/gststreamcombiner.c
	gst/encoding/gststreamsplitter.c
	gst/playback/gstplaybasebin.c
	gst/playback/gststreamsynchronizer.c
	gst/playback/gstsubtitleoverlay.c
	gst/playback/gsturidecodebin.c
	sys/xvimage/xvimagesink.c
	tests/examples/Makefile.am
	win32/common/libgstvideo.def

Video overlay composition disabled for now, needs
porting to buffer meta.
2011-12-08 01:19:03 +00:00
Tim-Philipp Müller
99c7a51908 videorate: don't leak previous buffer when shutting down
Implement stop vfunc after port to basetransform, so we
can clean up properly. Fixes make elements/videorate.valgrind
2011-12-06 21:57:32 +00:00
Vincent Penquerc'h
96374054ac various: fix pad template leaks
https://bugzilla.gnome.org/show_bug.cgi?id=662664
2011-11-28 13:09:02 +00:00