Commit graph

90 commits

Author SHA1 Message Date
Tim-Philipp Müller
67a49be61f openh264enc: fix broken header AU emission by base class
This encoder advertises alignment=au as output format, which means
each output frame should contain a full decodable access unit.

The video encoder base class is not aware of our output alignment
and will output spurious buffers with just the SPS/PPS inside when
we call gst_video_encoder_set_headers(), which is broken because
each buffer is supposed to contain a full decodable access unit
in our case.

Just don't tell the base class about our headers, they will be
sent at the beginning of each IDR frame anyway.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2178>
2021-08-24 23:42:27 +01:00
Tim-Philipp Müller
90c1732849 openh264enc: fix caps and header buffer leak
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2178>
2021-08-24 23:42:27 +01:00
Tim-Philipp Müller
42a7edd40f openh264enc: fix broken sps/pps header generation
This was putting a truncated SPS into the initial header instead
of the PPS because it was always reading from the beginning of the
bitstream buffer (pBsBuf) and not from the offset where the current
NAL is at in the bitstream buffer (psBsBuf + nal_offset).

This was broken in commit 17113695.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1576

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2178>
2021-08-24 23:42:27 +01:00
Thibault Saunier
e4c82f450d openh264: Respect level set downstream
We were not specifying the requested level to openh264  meaning that
it was choosing anything and was not respecting what was specified\
downstream

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2289>
2021-08-09 20:17:54 +00:00
Olivier Crête
761206291b openh264: Don't use GOnce for ABI check
It turns out the value used for g_once_* APIs can't be
zero. And this is a very cheap check, so let's just do it every time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2240>
2021-05-13 21:40:02 +00:00
Stéphane Cerveau
8fa3dd4bf3 openh264: allow per feature registration
Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2038>
2021-03-23 14:19:17 +00:00
Thibault Saunier
927bd289e5 openh264enc: Add support for main and high profiles
Those are supported (to a certain extent) so we should not limit
ourself to baseline

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1789>
2021-02-11 14:58:35 +00:00
Olivier Crête
03d710bd40 openh264dec: Accept constrained-high and progressive-high profiles
They're just subsets of the high profile.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1634>
2020-11-18 15:47:36 -05:00
Mathieu Duponchelle
c096d30f6b openh264dec: port to new request_sync_point() API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1571>
2020-09-10 23:44:50 +02:00
Mathieu Duponchelle
a048ce81d4 plugins: uddate gst_type_mark_as_plugin_api() calls 2020-06-06 00:40:42 +02:00
Sebastian Dröge
74f2f733be plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-06-04 13:33:16 -04:00
Seppo Yli-Olli
90f374dd0c openh264: memcmp return value 0 means match
Commit e2aa76db79 introduced version
check guard for OpenH264 binary. There was a boolean error in
memcmp so matching OpenH264 was erroneously rejected.
Fixes #1278

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1219>
2020-04-27 15:40:10 +00:00
Seppo Yli-Olli
e2aa76db79 Have strict version check for OpenH264 to avoid ABI issues
This fixes #1274 and no longer trusts soname alone

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1206>
2020-04-23 22:52:23 +00:00
Stéphane Cerveau
1711369526 openh264enc: keep the headers
be able to resend the headers on demand after a key-unit request
2019-12-06 08:35:00 +00:00
Tim-Philipp Müller
f218ec2794 Remove autotools build system 2019-10-14 13:54:27 +01:00
Thibault Saunier
47a49f3381 docs: Build documentation with hotdoc 2019-05-13 17:00:00 -04:00
Víctor Manuel Jáquez Leal
d2f6facbfb openh264enc: Fix compilation with openh264 v2.0
As OpenH264 increased its version to 2.0 the guard for structure
member is not valid.

This patch will fix the compilation with gst-build and openh264.
2019-05-08 12:02:50 +00:00
Tim-Philipp Müller
d6bae53e6b openh264: fix build with gstreamer debug system disabled
See https://gitlab.freedesktop.org/gstreamer/gst-ci/merge_requests/89
2019-03-21 11:45:08 +00:00
Seungha Yang
f1d5f1faab openh264dec: Fix build with msvc
Fix following build error
../subprojects/gst-plugins-bad/ext/openh264/gstopenh264dec.cpp(76): error C2121:

Note that msvc usually complains #if inside macro
2019-02-11 21:21:52 +09:00
Jan Schmidt
19382f1e91 openh264: Conditionally support the main and high profiles
openh264 added main/high profile support upstream after the 1.8.0
release, so detect a version higher than that and support main/high
stream input
2019-01-30 14:53:02 +11:00
Jan Schmidt
40de7e5b98 openh264: Use DecodeFrameNoDelay() API instead of DecodeFrame2
Replace legacy usage of DecodeFrame2 API in favour of the
recommended DecodeFrameNoDelay()

This fixes problems with DecodeFrame2() not (currently) returning
all frames in main/high streams with B-frames, and reduces latency -
previously openh264 would not return a decoded frame until the next
call to DecodeFrame2(). DecodeFrameNoDelay() returns them immediately.
2019-01-30 14:53:02 +11:00
Jan Schmidt
278cd35695 openh264dec: Hook up openh264 messages to GStreamer logging
Use the OpenH264 callback to pass Openh264 internal warning/error
messages through the GStreamer logging framework
2019-01-30 14:53:02 +11:00
Jan Schmidt
d4594c5c75 openh264dec: Handle B frame decoding
Support out-of-order decoding in OpenH264 by tracking
our internal frame reference in the OpenH264 timestamp
field.

Drain any pending frames at EOS.
2019-01-30 14:53:02 +11:00
Jan Schmidt
e75e637531 Add OpenH264 version check macro 2019-01-30 14:43:22 +11:00
Jan Schmidt
984b150e65 openh264dec: Fix up EOS handling
If the last frame(s) produce errors, then we need to drop them
or else we spin forever failing to decode a frame and thinking
it'll get better if we wait for more data that's never coming.
2019-01-30 03:00:49 +11:00
Nirbheek Chauhan
b55dfb5313 Add feature options for almost all plugins
The only plugins remaining are those that haven't been ported to Meson
yet, and msdk. Also, the tests are still automagic.

https://bugzilla.gnome.org/show_bug.cgi?id=795107
2018-07-27 19:04:38 +05:30
Thibault Saunier
a387f4bc33 meson: Add fallback for openh264 dependency 2018-06-28 15:21:54 -04:00
Xavier Claessens
83d0623293 Meson: Generate pc file for all plugins in bad
https://bugzilla.gnome.org/show_bug.cgi?id=794568
2018-04-25 11:08:09 +01:00
Edward Hervey
80b17c179a openh264dec: Remove useless check
We are sure to have a frame at this point

CID #1427138
2018-01-03 16:07:24 +01:00
Sebastian Dröge
d1eb5f727c openh264dec: Drop current frame if passing it to the decoder caused an error
Otherwise we will get it again later for output, however this frame will
never actually be output so we will shift timestamps.

This is especially bad if we're handling a live stream where the first
frames are not keyframes. We would output the keyframe with the
timestamp of the first frame, and everything would be too late when
arriving in the sink.
2017-08-10 23:25:13 +03:00
Sebastian Dröge
a04c48fec1 openh264dec: Don't unref NULL frame on EOS decoding error 2017-08-10 23:21:46 +03:00
Nicola Murino
e8f11615bd openh264enc: set GST_PARAM_MUTABLE_PLAYING for bitrate/max-bitrate properties
This way is documented that these properties can be changed in any state

https://bugzilla.gnome.org/show_bug.cgi?id=784988
2017-07-17 19:13:19 -04:00
Nicola Murino
11e8cf92f2 openh264enc: allow to dynamically change bitrate
https://bugzilla.gnome.org/show_bug.cgi?id=784988
2017-07-17 19:13:18 -04:00
Nicola Murino
20b5db0615 openh264enc: fix indentation
https://bugzilla.gnome.org/show_bug.cgi?id=784988
2017-07-17 19:13:18 -04:00
Tim-Philipp Müller
80d66dfec8 Fix up package name and origin in some plugins 2017-05-18 10:58:20 +01:00
Nicolas Dufresne
4261692187 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:05:52 -04:00
Tim-Philipp Müller
538c4456aa openh264: add "qp-min" and "qp-max" properties 2017-01-24 14:39:35 +00:00
Nirbheek Chauhan
bb0a83b018 plugins: Use explicit type conversion from enums
MSVC warns about this because it's a C++ compiler, and this actually
results in useful things such as the incorrect 'gboolean' return value
for functions that return GstFlowReturn, so let's do explicit
conversions to reduce the noise and increase its efficacy.
2016-10-27 23:06:26 +05:30
Nirbheek Chauhan
42af2d66d8 Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.com>
Matej Knopp <matej.knopp@gmail.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)

Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded

... and many more. For more details see:

http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
2016-08-20 11:35:54 +01:00
Tim-Philipp Müller
9f2dfaaa7a openh264: fix up for API changes in v1.6.0
Update for API changes in v1.6.0.

https://bugzilla.gnome.org/show_bug.cgi?id=768771
2016-07-18 18:36:42 +01:00
Sebastian Dröge
659032b3d9 openh264enc: Set frame timestamps before sending to the encoder 2016-06-30 23:38:26 +02:00
Sebastian Dröge
27c0a9306e openh264enc: Fix initial time-per-frame calculation 2016-06-30 23:35:33 +02:00
Sebastian Dröge
593ed6f3d7 openh264enc: Remove meaningless drop bitrate handling
This doesn't even have a property.
2016-06-30 23:33:38 +02:00
Sebastian Dröge
1e242edeb4 openh264enc: Expose maximum bitrate setting 2016-06-30 23:30:13 +02:00
Sebastian Dröge
c8666c58e8 openh264enc: Actually hook up the rate-control property 2016-06-30 23:30:13 +02:00
Sebastian Dröge
f5f437b707 openh264enc: Use a constant SPS/PPS ID no matter if openh264 older or newer than 1.4 is used 2016-06-30 23:30:13 +02:00
Sebastian Dröge
4cba0d5fab openh264enc: Make slice settings more explicit and don't set any number if not a fixed number of slices is selected 2016-06-30 23:30:13 +02:00
Sebastian Dröge
e7f8c62d42 openh264enc: Remove broken byte-stream to avc conversion and just output byte-stream as generated by the encoder
The byte-stream to avc conversion did not consider NAL sizes bigger than 2^16,
multiple layers, multiple NALs per layer, and various other things. This
caused corrupted streams in higher bitrates and other circumstances.

Let's just forward byte-stream as generated by the encoder and let h264parse
handle conversion to avc if needed. That way we only have to keep around one
version of the conversion and don't have to fix it in multiple places.
2016-06-30 10:37:08 +02:00
Tim-Philipp Müller
cc2b604b3b openh264dec: minor clean-ups
Remove unused property getters, setters; outdated comment.
2016-04-11 20:23:45 +01:00
Tim-Philipp Müller
9617a371ca openh264: remove unnecessary instance private structures
Element instance structures are not public API, so no need
for the extra indirection to hide the data.
2016-04-11 20:11:53 +01:00