Commit graph

39 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal
4e27245f28 libs: decoder: mpeg4: fail if return value is not OK
Coverity scan bug:

An assigned value that is never used may represent unnecessary
computation, an incorrect algorithm, or possibly the need for cleanup
or refactoring.

In the return value of decode_slice() or
gst_mpeg4_parse_video_packet_header() are not success, thus fail
decode_packet() function.
2017-08-08 16:15:46 +02:00
Víctor Manuel Jáquez Leal
0e31137dec libs: standardize the FIXME comment
This is a trivial patch that makes homogeneous the FIXME tag in
comments.

For more info about these comment style:
http://wiki.c2.com/?FixmeComment
2017-06-01 16:05:50 +02:00
Sebastian Dröge
734b8bad8f vaapi: Fix various compiler warnings and disable -Wredundant-decls for now 2016-02-16 15:09:01 +02:00
Víctor Manuel Jáquez Leal
ac730d0a62 libs: humongous code style fix
As part of the upstreaming process of gstreamer-vaapi into the GStreamer
umbrella, we need to comply with the project's code style. This meant to
change a lot of code.

It was decided to use a single massive patch to update the code style.

I would like to apologize with the original developers of this code because of
the history breakage.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-02-03 20:03:47 +01:00
Tim-Philipp Müller
24168a2093 vaapi: fix 'ISO C90 forbids mixed declarations and code' compiler warnings
Declare variables at the beginning of a code block, which
is how it's done in GStreamer.

https://bugzilla.gnome.org/show_bug.cgi?id=759192
2016-02-02 16:17:43 +01:00
Víctor Manuel Jáquez Leal
a6518f6888 decoder: mpeg4: remove an spurious comparison
The member size in GstMpeg4Packet is gsize which is unsigned, which cannot be
less than zero. Hence this pre-condition test is a no-op. This patch removes
that code.

https://bugzilla.gnome.org/show_bug.cgi?id=747312
2015-04-08 16:20:55 +02:00
Víctor Manuel Jáquez Leal
c9f0807752 decoder: cast GST_VAAPI_DECODER_STATUS_DROP_FRAME
Since GST_VAAPI_DECODER_STATUS_DROP_FRAME is not part of the enum
GstVaapiDecoderStatus, we need to cast it to avoid compiler complains.

https://bugzilla.gnome.org/show_bug.cgi?id=747312
2015-04-08 16:20:55 +02:00
Gwenole Beauchesne
0508e13ddf decoder: mpeg4: fix uninitialized variables.
Fix gst_vaapi_decoder_mpeg4_parse() to initialize the packet type to
GST_MPEG4_USER_DATA so that a parse error would result in skipping
that packet. Also fix gst_vaapi_decoder_mpeg4_decode_codec_data() to
initialize status to GST_VAAPI_DECODER_STATUS_SUCCESS.
2014-11-25 11:46:12 +01:00
Fabrice Bellet
00ca734ebf decoder: mpeg4: fix picture decoder return value for skipped frames.
The picture decoder should return GST_VAAPI_DECODER_STATUS_DROP_FRAME
when a frame should be skipped, so the stream processing is not stalled.

https://bugzilla.gnome.org/show_bug.cgi?id=733324
2014-07-21 10:17:00 +02:00
Gwenole Beauchesne
dbf32a2521 decoder: default to YUV 4:2:0 VA surfaces.
Cope with context changes to support non-YUV 4:2:0 VA surfaces. Still,
make sure all codecs use YUV 4:2:0 output format for now, by default.
2014-04-25 19:24:07 +02:00
Gwenole Beauchesne
15519ebe3d legal: add per-file authorship information.
Credit original authors on a per-file basis as we cannot expect people
to know all country-specific rules, or bother browsing through the git
history.
2013-11-22 06:39:15 +01:00
Gwenole Beauchesne
d16db58968 mpeg4: fix double definition of GstVaapiDecoderMpeg4Class.
This fixes the following issue:

  CC     libgstvaapi_0.10_la-gstvaapidecoder_mpeg4.lo
gstvaapidecoder_mpeg4.c:113: error: redefinition of typedef
'GstVaapiDecoderMpeg4Class'
gstvaapidecoder_mpeg4.c:44: note: previous declaration of
'GstVaapiDecoderMpeg4Class' was here
make[5]: *** [libgstvaapi_0.10_la-gstvaapidecoder_mpeg4.lo] Error 1
make[5]: Leaving directory
`/builddir/build/BUILD/gstreamer-vaapi-0.5.5.1/gst-libs/gst/vaapi'

https://bugzilla.gnome.org/show_bug.cgi?id=705148
2013-08-26 11:31:06 +02:00
Gwenole Beauchesne
3cc7b26961 libs: use GstVaapiMiniObject for video decoders.
Port GstVaapiDecoder and GstVaapiDecoder{MPEG2,MPEG4,JPEG,H264,VC1} to
GstVaapiMiniObject. Add gst_vaapi_decoder_set_codec_state_changed_func()
helper function to let the user add a callback to a function triggered
whenever the codec state (e.g. caps) changes.
2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
788d337505 decoder: fix unpaired GstBuffer map/unmaps.
This possibly fixes a few memory leaks along the way.
2013-04-10 14:58:17 +02:00
Sreerenj Balachandran
51151e7aa1 Add initial support for GStreamer 1.0.
This integrates support for GStreamer API >= 1.0 only in the libgstvaapi
core decoding library. The changes are kept rather minimal here so that
the library retains as little dependency as possible on core GStreamer
functionality.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-04-10 14:58:16 +02:00
Gwenole Beauchesne
4009430bec decoder: sanitize codec-data decoding.
Add a new GstVaapiDecoder::decode_codec_data() hook to actually decode
codec-data in the decoder sub-class. Provide a common shared helper
function to do the actual work and delegating further to the sub-class.
2013-03-21 14:38:06 +01:00
Gwenole Beauchesne
ba8a7ab6cd decoder: get rid of GstVaapiDecoderUnit::buffer field.
Drop GstVaapiDecoderUnit buffer field (GstBuffer) since it's totally
useless nowadays as creating sub-buffers doesn't bring any value. It
actually means more memory allocations. We can't do without that in
JPEG and MPEG-4:2 decoders.
2013-03-21 13:44:59 +01:00
Gwenole Beauchesne
57ed7e3f8b decoder: sanitize uses of codec frame input buffer (cosmetics).
Alias GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer to a simple
"buffer" variable.
2013-03-21 13:28:05 +01:00
Gwenole Beauchesne
0c99f351fc legal: fix year for some copyright notices (2013). 2013-01-29 14:37:02 +01:00
Gwenole Beauchesne
22094ed053 legal: fix year for some copyright notices (2012). 2013-01-29 14:37:02 +01:00
Gwenole Beauchesne
2c449e42ca decoder: refactor decoder unit API.
Allocate decoder unit earlier in the main parse() function and don't
delegate this task to derived classes. The ultimate purpose is to get
rid of dynamic allocation of decoder units.
2013-01-07 14:10:13 +01:00
Gwenole Beauchesne
8fbd05ca82 mpeg4: initial port to new GstVaapiDecoder API 2012-12-18 15:31:51 +01:00
Gwenole Beauchesne
a10b3d3032 decoder: cope with new GstVaapiContextInfo based API.
Update decoders to report the maximum number of reference frames to use.
2012-09-10 18:27:40 +02:00
Gwenole Beauchesne
cf75d048a1 mpeg4: fix debug info for unsupported profile. 2012-09-07 16:23:43 +02:00
Gwenole Beauchesne
61cc02f54b libs: fix build in strict ISO C mode. 2012-09-07 16:23:42 +02:00
Wind Yuan
0fe727ba77 mpeg: fix picture used to determine backward_reference_vop_coding_type.
Complete fix brought by bf9f77b1af
but Gwenole did not apply all the bits.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-05-11 11:20:45 +02:00
Wind Yuan
c40c05dc45 mpeg4: map Simple_Scalable profile to Advanced_Simple profile.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-05-10 11:52:06 +02:00
Wind Yuan
96437a7a16 mpeg4: handle skipped frames (vop_hdr->coded = 0).
Gracefully skip non VOP coded frames.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-05-10 11:52:06 +02:00
Wind Yuan
1632b40982 mpeg4: fix timestamp issues on too fast playback.
Improve generation of presentation timestamps to be less sensitive
to input stream errors. In practise, GOP is also a synchronization
point for PTS calculation.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-05-10 11:38:06 +02:00
Wind Yuan
bf9f77b1af mpeg4: fix VOP coding type of backward reference pictures.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-12 11:48:24 +02:00
Wind Yuan
60b5c2da97 mpeg4: fix handling of temporal reference distances.
TRD and TRB fields are not large enough to hold the difference of PTS
expressed with nanosecond resolution. So, compute them from the original
VOP info.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-12 11:44:16 +02:00
Wind Yuan
b33dd69300 mpeg4: improve error checking while decoding packets.
decode_picture() could return an error when an MPEG-4 profile is not
supported for example. In this case, the underlying VA context is not
allocated and no other proper action can be taken. Likewise on exit
from decode_slice().

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-03-30 17:23:38 +02:00
Wind Yuan
81ab8dad37 mpeg4: check for decoder status prior to decoding packet.
Make sure there is a VA surface free prior to decoding the current frame.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-03-22 14:44:42 +01:00
Gwenole Beauchesne
5cc357f88a cosmetics: fix warnings (drop unused variables). 2012-02-07 10:06:15 +01:00
Gwenole Beauchesne
0fb1147d9c Add header for system-dependent definitions. 2012-01-30 19:52:10 +01:00
Gwenole Beauchesne
2897618b85 decoder: properly reference count pictures.
This fixes cases where a GstVaapiPicture would be destroyed whereas
there is still a valid instance of it in either prev, current or
next picture.
2012-01-27 13:28:12 +01:00
Gwenole Beauchesne
e5d12e8853 decoder: rework the internal VA objects API.
The new API simplifies a lot reference counting and makes it more
flexible for future additions/changes. The GstVaapiCodecInfo is
also gone. Rather, new helper macros are provided to allocate
picture, slice and quantization matrix parameter buffers.
2012-01-27 13:28:11 +01:00
Zhao Halley
c0d8f2fb1f mpeg4: replace GstVaapiTSB with GstAdapter (gst-plugins-base >= 0.10.24).
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-01-16 11:40:51 +01:00
Zhao Halley
6502783474 Add initial MPEG-4 decoder.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-01-16 11:40:51 +01:00