Commit graph

755 commits

Author SHA1 Message Date
Sreerenj Balachandran
0b1faa62d0 mpeg2: add support for video cropping.
If the stream has a sequence_display_extenion, then attach the
display_horizontal/display_vertical dimension as the cropping
rectangle width/height to the GstVaapiPicture.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-08 18:54:15 +02:00
Sreerenj Balachandran
f9ae0c0de4 vc1: add support for video cropping.
If the Advanced profile has display_extension fields, then set the display
width/height dimension as cropping rectangle to the GstVaapiPicture.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-08 18:54:15 +02:00
Sreerenj Balachandran
976d27841a h264: add support for video cropping.
If the encoded stream has the frame_cropping_flag set, then associate
the cropping rectangle to GstVaapiPicture.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-08 18:54:15 +02:00
Gwenole Beauchesne
eb00f6d101 surfaceproxy: allow for NULL cropping rectangle.
Make it possible associate an empty cropping rectangle to the surface
proxy, thus resetting any cropping rectangle that was previously set.
This allows for returning plain NULL when no cropping rectangle was
initially set up to the surface proxy, or if it was reset to defaults.
2013-07-08 18:52:56 +02:00
Gwenole Beauchesne
ad7202bb77 surfaceproxy: clean-up helper macros.
Always use the GST_VAAPI_SURFACE_PROXY() helper macro to cast from a
proxy macro argument to a GstVaapiSurfaceProxy pointer.
2013-07-08 18:52:56 +02:00
Gwenole Beauchesne
99dfd44f33 surface: add simple surface info accessors as helper macros.
Add helper macros to retrieve the VA surface information like size
(width, height) or chroma type. This is a micro-optimization to avoid
useless function calls and NULL pointer re-checks in internal routines.
2013-07-08 18:52:56 +02:00
Sreerenj Balachandran
e66e72e7e3 decoder: add support for video cropping.
Add gst_vaapi_picture_set_crop_rect() helper function to copy the video
cropping information from raw bitstreams to each picture being decoded.
Also add helper function to surface proxy to propagate that information
outside of libgstvaapi. e.g. plug-in elements or standalone applications.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-08 18:52:56 +02:00
Zhong Cong
c2ddf464e5 mpeg2: reset quantization matrices on new sequence headers.
The MPEG-2 standard specifies (6.3.7) that all quantisation matrices
shall be reset to their default values when a Sequence_Header() is
decoded.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-05 17:57:57 +02:00
Gwenole Beauchesne
800b66f071 mpeg2: cope with latest codecparser changes.
Fix build with newer MPEG-2 codecparser where GstMpegVideoPacket are
used in individual header parsers. Also use the new slice parsing API.
2013-07-05 17:57:47 +02:00
Wind Yuan
b3525c824a image: fix wrong check for rect bounds in copy_image(). 2013-06-14 13:50:47 +02:00
Gwenole Beauchesne
4559f691a1 configure: always build the MPEG-4 parser.
Always build the MPEG-4 parser for now as there are also core fixes
included in the parser that cannot be tested for with API checks.
2013-06-14 11:45:11 +02:00
Gwenole Beauchesne
7793250607 wayland: fix memory leak of display resources. 2013-06-05 11:09:37 +02:00
Gwenole Beauchesne
18031dc6ff surface: fix memory leak through unreleased parent context.
Break the circular references between GstVaapiContext and its children
GstVaapiSurfaces. Since the VA surfaces held an extra reference to the
context, which holds a reference to its VA surfaces, then none of those
were released.

How does this impact support for subpictures?

The only situation when the parent context needs to disappear is when
it is replaced with another one because of a resolution change in the
video stream for instance, or a normal destroy. In this case, it does
not really matter to apply subpictures to the peer surfaces since they
are either gone, or those that are left in the pipe can probably bear
a reinstantiation of the subpictures for it.

So, parent_context is set to NULL when the parent context is destroyed,
other VA surfaces can still get subpictures attached to them, individually
not as a whole. i.e. subpictures for surface S1 will be created from
active composition buffers and associated to S1, subpictures for S2 will
be created from the next active composition buffers, etc. We don't try
to cache the subpictures in those cases (pending surfaces until EOS
is reached, or pending surfaces until new surfaces matching new VA context
get to be used instead).
2013-05-30 19:32:58 +02:00
Gwenole Beauchesne
382542c747 window: fix GLX window initialization.
Make sure to create the GLX context once the window object has completed
its creation. Since gl_resize() relies on the newly created window size,
then we cannot simply overload the GstVaapiWindowClass::create() hook.
So, we just call into gst_vaapi_window_glx_ensure_context() once the
window object is created in the gst_vaapi_window_glx_new*() functions.
2013-05-27 17:21:10 +02:00
Gwenole Beauchesne
b1e5dfab96 display: validate display types. 2013-05-27 17:20:35 +02:00
Gwenole Beauchesne
b40cd3b382 display: drop internal NAME_PREFIX, store the real display name.
Always store a valid display name/device path, instead of adding a
particular prefix. i.e. make it simply a strdup(), or "" if it was
initially NULL.
2013-05-27 16:21:08 +02:00
Gwenole Beauchesne
71ab07d9c6 display: make it possible to lookup the display cache by type.
Make it possible to add extra an extra filter to most of display cache
lookup functions so that the GstVaapiDisplay instance can really match
a compatible and existing display by type, instead of relying on extra
string tags (e.g. "X11:" prefix, etc.).
2013-05-27 16:07:15 +02:00
Gwenole Beauchesne
c957823e8a display: cope with new display cache API. 2013-05-27 16:07:15 +02:00
Gwenole Beauchesne
b59445b2ab display: rework display cache API.
Simplify display cache API, while making it more flexible. We can now create
custom lookup functions with gst_vaapi_display_cache_lookup_custom().
2013-05-27 16:07:15 +02:00
Gwenole Beauchesne
809c7e097b libs: add query for GstVaapiVideoPool object types.
Add API to identify the underlying GstVaapiVideoPool object type.
2013-05-23 19:01:34 +02:00
Gwenole Beauchesne
67eea92044 libs: drop GST_VAAPI_IS_xxx() helper macros.
Drop obsolete GST_VAAPI_IS_xxx() helper macros since we are no longer
deriving from GObject and so those were only checking for whether the
argument was NULL or not. This is now irrelevant, and even confusing
to some extent, because we no longer have type checking.

Note: this incurs more type checking (review) but the libgstvaapi is
rather small, so this is manageable.
2013-05-23 18:15:48 +02:00
Gwenole Beauchesne
98bee4240f display: fix set_synchronous() to lock display. 2013-05-07 18:19:03 +02:00
Gwenole Beauchesne
4cf1213b04 videopool: simplify creation of video objects pool. 2013-05-07 18:19:03 +02:00
Gwenole Beauchesne
c2abeb1290 libs: simplify GstVaapiID definitions.
Make GstVaapiID a gsize instead of guessing an underlying integer large
enough to hold all bits of a pointer. Also drop GST_VAAPI_ID_NONE since
this is plain zero and that it is no longer passed as varargs.
2013-05-07 18:19:03 +02:00
Gwenole Beauchesne
4ffdc98ab4 libs: drop obsolete function helpers and objects.
Drop obsolete GstVaapiID related function helpers for passing them as
GValues.
2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
915cef5e01 libs: use GstVaapiMiniObject for display objects. 2013-05-07 17:51:27 +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
2e6ff64a34 libs: use GstVaapiMiniObject for video object pools.
Port GstVaapiVideoPool, GstVaapiSurfacePool and GstVaapiImagePool to
GstVaapiMiniObject. Drop gst_vaapi_video_pool_get_caps() since it was
no longer used for a long time. Make object allocators static, i.e.
local to the shared library.
2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
98c7068937 libs: use GstVaapiObject for texture objects. 2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
8402b04ac9 libs: use GstVaapiObject for window objects. 2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
6c46179709 libs: use GstVaapiObject for VA objects. 2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
1f15c28a1b Port GstVaapiObject to GstVaapiMiniObject. 2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
6439169db5 libs: refine GstVaapiMiniObject.
Drop support for user-defined data since this capability was not used
so far and GstVaapiMiniObject represents the smallest reference counted
object type. Add missing GST_VAAPI_MINI_OBJECT_CLASS() helper macro.

Besides, since GstVaapiMiniObject is a libgstvaapi internal object, it
is also possible to further simplify the layout of the object. i.e. merge
GstVaapiMiniObjectBase into GstVaapiMiniObject.
2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
da2493f731 decoder: update picture size from the bitstream.
Propagate the picture size from the bitstream to the GstVaapiDecoder,
and subsequent user who installed a signal on notify::caps. This fixes
decoding of TS streams when the demuxer failed to extract the required
information.
2013-05-07 16:43:51 +02:00
Gwenole Beauchesne
5ea1a675ab decoder: fix raw decoding mode.
Fix gst_vaapi_decoder_get_surface() to actually transfer ownership of the
surface proxy to the caller.
2013-04-25 14:20:55 +02:00
Gwenole Beauchesne
c43a2d497a decoder: add gst_vaapi_decoder_get_frame_with_timeout().
Add gst_vaapi_decoder_get_frame_with_timeout() helper function that will
wait for a frame to be decoded, until the specified timeout in microseconds,
prior to returning to the caller.

This is a fix to performance regression from 851cc0, whereby the vaapidecode
loop executed on the srcpad task was called to often, thus starving all CPU
resources.
2013-04-25 14:18:00 +02:00
Gwenole Beauchesne
851cc000c2 vaapidecode: rework GstVideoDecoder::handle_frame() with a task.
Rework GstVideoDecoder::handle_frame() to decode the current frame,
while possibly waiting for a free surface, and separately submit all
decoded frames from a task. This makes it possible to pop and render
decoded frames as soon as possible.
2013-04-18 18:46:01 +02:00
Gwenole Beauchesne
945516c9c7 vaapipostproc: port to GStreamer 1.0.
Add support for interlaced streams with GStreamer 1.0 too. Basically,
this enables vaapipostproc, though it is not auto-plugged yet. We also
make sure to reply to CAPS queries, and happily handle CAPS events.
2013-04-17 10:18:45 +02:00
Gwenole Beauchesne
2909d0229d decoder: fix GstVideoCodecFrame flags for interlaced contents.
Fix support for interlaced contents with GStreamer 0.10. In particular,
propagate GstVaapiSurfaceProxy frame flags to GstVideoCodecFrame flags
correctly.

This is a regression from commit 87e5717.
2013-04-17 10:14:55 +02:00
Gwenole Beauchesne
a24e216466 decoder: rename GstVaapiDecoderFrame to GstVaapiParserFrame.
Rename GstVaapiDecoderFrame to GstVaapiParserFrame because this data
structure was only useful to parsing and a proper GstvaapiDecoderFrame
instance will be created instead.
2013-04-16 19:11:02 +02:00
Gwenole Beauchesne
2ac474b207 decoder: export presentation timestamp for raw decoding mode.
Fix regression from 0.4-branch whereby GstVaapiSurfaceProxy no longer
held any information about the expected presentation timestamp, frame
duration or additional flags like interlaced or top-field-first.
2013-04-16 19:11:02 +02:00
Gwenole Beauchesne
87e5717f66 decoder: use new GstVaapiSurfaceProxy utility functions.
Use new GstVaapiSurfaceProxy internal helper functions to propagate the
necessary GstVideoCodecFrame flags to vaapidecode (GStreamer 0.10).

Also make GstVaapiDecoder push_frame() operate similarly to drop_frame().
i.e. increase the GstVideoCodecFrame reference count in push_frame rather
than gst_vaapi_picture_output().
2013-04-16 19:07:24 +02:00
Gwenole Beauchesne
c7dff071c7 surfaceproxy: add more attributes for raw decoding modes.
Add more attributes for raw decoding modes, i.e. directly through the
libgstvaapi helper library. In particular, add presentation timestamp,
duration and a couple of flags (interlaced, TFF, RFF, one-field).
2013-04-16 19:07:24 +02:00
Gwenole Beauchesne
0bd929dfa2 surfaceproxy: drop user-data support from GstVaapiSurfaceProxy.
Drop user-data support from GstVaapiSurfaceProxy. Rather make it explicit
to call some user-provided function when the surface proxy is released.
2013-04-16 18:54:37 +02:00
Víctor Manuel Jáquez Leal
2db47c0ade build: link libgstvaapi-glx-1.0.so against libdl.
Ensure libgstvaapi-glx*.so builds against libdl since dlsym() is used
to resolve glXGetProcAddress() from GLX libraries. This fix builds on
Fedora 17.

https://bugzilla.gnome.org/show_bug.cgi?id=698046

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-04-15 15:04:29 +02:00
Gwenole Beauchesne
8cce65c6f1 decoder: fix gst_vaapi_decoder_get_codec_state().
Fix previous commit whereby gst_vaapi_decoder_get_codec_state() was
supposed to make GstVaapiDecoder own the return GstVideoCodecState
object. Only comment was updated, not the actual code.
2013-04-15 14:22:57 +02:00
Gwenole Beauchesne
1790823ed4 decoder: make gst_vaapi_decoder_get_codec_state() return the original state.
Make gst_vaapi_decoder_get_codec_state() return the original codec state,
i.e. make the GstVaapiDecoder object own the return state so that callers
that want an extra reference to it would just gst_video_codec_state_ref()
it before usage. This aligns the behaviour with what we had before with
gst_vaapi_decoder_get_caps().

This is an ABI incompatible change, library major version was bumped from
previous release (0.5.2).
2013-04-15 13:58:58 +02:00
Gwenole Beauchesne
9b981dd244 plugins: fix description for gst-inspect.
Fix the name of the plug-in element reported to gst-inspect-1.0. i.e. we
need an explicit definition for GStreamer >= 1.0 because the GST_PLUGIN_DEFINE
incorrectly uses #name for creating the plug-in name, instead of using macro
expansion (and let further expansion of macros) through e.g. G_STRINGIFY().
2013-04-12 13:44:52 +02:00
Gwenole Beauchesne
aedef381b2 Fix make dist to include all source files, in any case.
Fix make dist to allow build for either GStreamer 0.10 or 1.0. i.e. make
sure to include all source files in either case while generating source
tarballs.
2013-04-10 15:43:28 +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