Commit graph

326 commits

Author SHA1 Message Date
Jérôme Laheurte
44d4eaab7c jpegdec: check buffer size before dereferencing. Fixes #541
Some cameras (Panacast) have buggy drivers/firmware which send
invalid JPEG frames, containing no data, which makes jpegdec
crash because it assumes the frame is at least 2 bytes long.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/723>
2020-09-10 09:47:35 +00:00
Mathieu Duponchelle
f63299ff2f plugins: uddate gst_type_mark_as_plugin_api() calls 2020-06-06 00:42:25 +02:00
Mathieu Duponchelle
37c619f995 plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-06-03 22:44:09 -04:00
nian.yan
1944564d76 jpegenc: remove meta copy in jpegenc
GstVideoEncoder takes care of the Meta copy, so there is no need in
jpegenc

Fixes http://gstreamer-devel.966125.n4.nabble.com/jpegenc-copy-GstMeta-twice-tt4693981.html

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/576>
2020-05-06 08:38:46 +00:00
Sebastian Dröge
fc3bb4c549 jpegdec: Configure JPEG chroma-siting for YUV formats 2020-03-09 21:34:08 +02:00
Nicolas Dufresne
83e9d4f70d jpegdec: Check return value of gst_buffer_map()
Without this check, the element will crash instead of returning an
error.
2020-01-27 22:59:34 +00:00
Scott Kanowitz
7606c0eb7c jpegdec: Fix incorrect logic in EOI tag detection
This change fixes the reversed logic in the EOI tag detection
code.
2019-11-17 18:22:25 +00:00
Michael Olbrich
0b25487cd1 jpegdec: don't overwrite the last valid line
If the the height is not a multiple of the macro block size then the memory
of the last line is reused for all extra lines. This is no problem if the
last line is duplicated properly. However, if the extra lines are not
initialized properly during encoding, then the last visible line is
overwritten with undefined data.
Use a extra buffer to avoid this problem.
2019-11-10 11:24:40 +01:00
Tim-Philipp Müller
c9a47c0c8d Remove autotools build system 2019-10-14 11:04:18 +01:00
Aaron Boxer
46989dca96 documentation: fix a number of typos 2019-10-05 22:38:11 +00:00
Sebastian Dröge
4911ac38ac jpegdec: Don't dereference NULL input state if we have no caps in TIME segments
Simply assume that the JPEG frame is not going to be interlaced instead
of crashing.
2019-07-25 15:08:54 +03:00
Thibault Saunier
af01988534 doc: Port documentation to hotdoc 2019-05-13 11:34:56 -04:00
Thibault Saunier
0a6a62aa76 docs: Port all docstring to gtk-doc markdown 2019-05-13 10:24:40 -04:00
Tim-Philipp Müller
8305cb2995 meson: find libjpeg via pkg-config
This effectively (but optionally) requires libjpeg-turbo which
ships with a .pc file and is what pretty much everyone these days
uses anyway for libjpeg, so shouldn't be a problem hopefully.

https://bugzilla.gnome.org/show_bug.cgi?id=796947
2018-08-18 21:01:52 +01:00
Nirbheek Chauhan
8f807477eb meson: Add feature options for all plugins
Checks for GL, Qt5, and C++ are still automagic. FIXMEs have been
added for these so they can be fixed later.

https://bugzilla.gnome.org/show_bug.cgi?id=795107
2018-07-27 18:42:54 +05:30
Xavier Claessens
edd9c8f6b8 Meson: Generate pc file for all plugins in good
https://bugzilla.gnome.org/show_bug.cgi?id=794568
2018-04-25 11:07:06 +01:00
Thibault Saunier
1914b9d4e2 jpegenc: Accept sof-marker=4
sof-marker is 4 when input is in the RGB colorspace.

https://bugzilla.gnome.org/show_bug.cgi?id=795463
2018-04-23 07:55:30 -03:00
Matthieu Crapet
ba86a1d99c jpegenc: add snapshot property
Like pngenc, automatically send an EOS message.

Example of bin:
appsrc ! jpegenc snapshot=true ! filesink location=out.jpg

This is especially useful for limited/slow hardware.

Otherwise calling gst_video_convert_sample() is a better option
(internally uses videoconvert and videoscale).

https://bugzilla.gnome.org/show_bug.cgi?id=755453
2018-01-31 17:51:16 +00:00
Ezequiel Garcia
10ff3c8e14 jpeg: Fixup frames without an EOI marker
Some cameras fail to send an end-of-image marker (EOI)
and can't be properly decoded by either JPEG or libjpeg.

This commit parses the frame, making sure it has an EOI.
If there isn't one, the EOI gets added to the buffer.

A similar fixup is done in the rtpjpegdepay element,
and it makes sense to do it in jpegdec as well.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>

https://bugzilla.gnome.org/show_bug.cgi?id=791988
2017-12-27 19:39:39 +01:00
Jan Schmidt
e82c24e893 jpegenc: Update output caps on input caps change
If the input changes width/height that should be reflected
in the output caps, so make sure they get updated
2017-11-24 16:54:09 +11:00
Sebastian Dröge
aae7fcc0b5 jpegdec: Fix decoding of streams that don't signal exactly twice the height
... and also progressive streams.
2017-09-05 15:42:17 +03:00
Sebastian Dröge
09ee89f4c4 jpegdec: Handle interlaced MJPEG streams
These come with two JPEG images per buffer of half height than signalled
in the container.

Changes based on Tim-Philipp Müller's 0.10 branch:
https://cgit.freedesktop.org/~tpm/gst-plugins-good/log/?h=jpegdec-interlaced

https://bugzilla.gnome.org/show_bug.cgi?id=568555
2017-09-05 14:45:16 +03:00
Nicola Murino
ab3b289bf2 jpegenc: declare quality property changeable in PLAYING state
https://bugzilla.gnome.org/show_bug.cgi?id=785012
2017-07-24 10:03:42 +01:00
Nicolas Dufresne
b68d936ae0 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:41:19 -04:00
Nirbheek Chauhan
b09f478e80 Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.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:21:12 +01:00
Nicolas Dufresne
a6008fde65 jpegdec: Wait for segment event before checking it
The heuristic to choose between packetise or not was change to use the
segment format. The problem is that this change is reading the segment
during the caps event handling. The segment event will only be sent
after. That prevented the decoder to go in packetize mode, and avoid
useless parsing.

https://bugzilla.gnome.org/show_bug.cgi?id=736252
2016-06-07 20:36:26 -04:00
Vineeth TM
1071309870 good: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763076
2016-03-24 14:32:20 +02:00
Nicolas Dufresne
905e28a0f3 jpegdec: Don't pass the same data over and over
We already pass the entire frame to the decoder. If the decoder ask for
more data, don't pass the same data again as this leads to infinit loop.
Instead, simply fail the fill function to signal the problem with that
frame. It will then be skipped properly.

https://bugzilla.gnome.org/show_bug.cgi?id=761670
2016-02-08 10:19:31 -05:00
Vineeth TM
7ef9dd3761 jpegdec: fix output state memory leak
When jpeg_finish_decompress is called, output state reference is being created.
But if there is any failures in finishing decompress, it jumps to setjmp,
and at that point state was not referenced. Resulting in leak of output state.
Hence adding another setjmp after output state is referenced.
Similarly adding another setjmp to unmap the frame in case error happens before
finish_decompress

https://bugzilla.gnome.org/show_bug.cgi?id=753087
2015-11-10 07:54:08 -03:00
Thiago Santos
1b27badcfd videoencoders: use template subset check for accept-caps
It is faster than doing a query that propagates downstream and
should be enough

Elements: jpegenc, pngenc, vp8enc, vp9enc, y4menc
2015-08-16 14:30:57 -03:00
Thiago Santos
16fbd4f86f videodecoders: use default pad accept-caps handling
Avoids useless check of downstream caps when handling an
accept-caps query

Elements: jpegdec, pngdec, vp8dec, vp9dec
2015-08-15 11:46:32 -03:00
Guillaume Desmottes
1421fc558e jpegdec: fix frame leaks in handle_frame() implementation
handle_frame() is supposed to consume @frame, so if we don't call
gst_video_decoder_drop_frame() or gst_video_decoder_finish_frame() we have to
release it manually.

https://bugzilla.gnome.org/show_bug.cgi?id=748909
2015-05-05 13:56:05 -04:00
Tim-Philipp Müller
3956f5addc Sprinkle some G_PARAM_DEPRECATED and #ifndef GST_REMOVE_DEPRECATED 2014-11-02 16:58:30 +00:00
Sebastian Dröge
90ccd8212a jpegdec: Remove unused variable and use correct decoder variable name 2014-09-16 11:26:22 +03:00
Vineeth T M
448b1ac2b1 jpeggdec: modify wrong packetized mode logic
packetized mode is being set when framerate is being set
which is not correct. Changing the same by checking the
input segement format. If input segment is in TIME it is
Packetized, and if it is in BYTES it is not.

https://bugzilla.gnome.org/show_bug.cgi?id=736252
2014-09-16 11:25:31 +03:00
Nicola Murino
60648012f3 jpegenc: Add support for encoding from NV21 and NV12
https://bugzilla.gnome.org/show_bug.cgi?id=732870
2014-07-21 09:36:55 +02:00
Sebastian Dröge
94bfdc7a56 jpegdec: All frames are sync points 2014-03-26 08:03:46 +01:00
Thiago Santos
04bd422432 jpegdec: mark all parsed frames as sync points
all jpeg frames are sync points, so mark them as such so
reverse playback can properly work with the video decoder
base class

https://bugzilla.gnome.org/show_bug.cgi?id=725104
2014-02-27 19:08:15 -03:00
Thiago Santos
6bb6a5cdf4 jpegdec: deprecate max-errors
The property wasn't use internally, let the base class handle the
number of errors to tolerate.
2013-11-25 11:58:58 -03:00
Thiago Santos
be2f2f196a jpegdec: let the base class decide when to return an error
The base videodecoder class has an error counting feature to tolerate
a few errors before posting an error message. So don't force the
error and let the base class decide when it should happen

https://bugzilla.gnome.org/show_bug.cgi?id=710762
2013-11-25 11:03:34 -03:00
Thiago Santos
673b8ca1c1 jpegdec: Add data skipping on input
Add missing bytes skipping when bad input is received.

https://bugzilla.gnome.org/show_bug.cgi?id=710762
2013-11-25 11:03:26 -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
Matthieu Bouron
e5c443594f jpegdec: Relax sink caps
Since jpegdec already parse the jpeg stream, the sink caps could be
relaxed. This will allow jpegdec to be selected in more case and in
particular when the jpeg typefinder does not find the width and height.

https://bugzilla.gnome.org/show_bug.cgi?id=709352
2013-10-04 10:33:13 +02:00
Tim-Philipp Müller
cebfacd1fa jpegenc: don't ignore return value from _finish_frame()
gst_video_encoder_finish_frame() will return FLOW_OK here if
there's no output buffer.
2013-08-21 13:05:00 +01:00
Sebastian Dröge
b1e442236f ext: Use new flush vfunc of video codec base classes and remove reset implementations 2013-08-15 15:08:05 +02:00
Sebastian Dröge
ef4a21253b jpegenc: Clean up reset/start/stop handling 2013-07-25 14:26:37 +02:00
Sebastian Dröge
4944183061 jpegdec: Use base class error handling function instead of replicating it here 2013-07-25 14:26:37 +02:00
Sebastian Dröge
6f39f5d49f jpegdec: Clean up handling of reset/start/stop 2013-07-25 14:26:37 +02:00
Thiago Santos
a8460654d5 jpegdec: fix compiler warning on type check 2013-05-07 19:29:17 -03:00
Sebastian Dröge
8ca4a47cdc jpegdec: By default assume that we're working on non-packetized input
Only detecting this in set_format() does not work because we might
not get any caps at all, e.g. from filesrc.
2013-05-07 16:32:03 +02:00