gstreamer/sys/msdk
Hyunjun Ko b08b8ddae3 msdk: manage MSDK surfaces seperately
Currently a gst buffer has one mfxFrameSurface when it's allocated and
can't be changed.
This is based on that the life of gst buffer and mfxFrameSurface would
be same.
But it's not true. Sometimes even if a gst buffer of a frame is finished
on downstream,
mfxFramesurface coupled with the gst buffer is still locked, which means
it's still being used in the driver.

So this patch does this.
Every time a gst buffer is acquired from the pool, it confirms if the
surface coupled with the buffer is unlocked.
If not, replace it with new unlocked one.
In this way, user(decoder or encoder) doesn't need to manage gst buffers
including locked surface.

To do that, this patch includes the following:
1. GstMsdkContext
- Manages MSDK surfaces available, used, locked respectively as the
following:
  1\ surfaces_avail : surfaces which are free and unused anywhere
  2\ surfaces_used : surfaces coupled with a gst buffer and being used
now.
  3\ surfaces_locked : surfaces still locked even after the gst buffer
is released.

- Provide an api to get MSDK surface available.
- Provide an api to release MSDK surface.

2. GstMsdkVideoMemory
- Gets a surface available when it's allocated.
- Provide an api to get an available surface with new unlocked one.
- Provide an api to release surface in the msdk video memory.

3. GstMsdkBufferPool
- In acquire_buffer, every time a gst buffer is acquired, get new
available surface from the list.
- In release_buffer, it confirms if the buffer's surface is unlocked or
not.
  - If unlocked, it is put to the available list.
  - If still locked, it is put to the locked list.

This also fixes bug #793525.

https://bugzilla.gnome.org/show_bug.cgi?id=793413
https://bugzilla.gnome.org/show_bug.cgi?id=793525
2018-03-08 11:37:12 -09:00
..
gstmsdk.c msdk: Add VC1 decoder (simple and main profiles) 2018-02-13 14:40:54 -09:00
gstmsdkallocator.h msdk: Avoid build failures on Windows until d3d allocator is implemented 2018-02-13 13:54:03 -09:00
gstmsdkallocator_d3d.c msdk: Avoid build failures on Windows until d3d allocator is implemented 2018-02-13 13:54:03 -09:00
gstmsdkallocator_libva.c msdk: adds frame allocator using libva 2018-02-13 12:43:42 -09:00
gstmsdkbufferpool.c msdk: manage MSDK surfaces seperately 2018-03-08 11:37:12 -09:00
gstmsdkbufferpool.h msdk: supports bufferpool 2018-02-13 13:44:08 -09:00
gstmsdkcontext.c msdk: manage MSDK surfaces seperately 2018-03-08 11:37:12 -09:00
gstmsdkcontext.h msdk: manage MSDK surfaces seperately 2018-03-08 11:37:12 -09:00
gstmsdkcontextutil.c msdk: context: add job type to figure out if joining session is necessary 2018-02-13 13:50:48 -09:00
gstmsdkcontextutil.h msdk: context: add job type to figure out if joining session is necessary 2018-02-13 13:50:48 -09:00
gstmsdkdec.c msdk: dec: Add non-packetized stream handling support 2018-02-13 14:41:20 -09:00
gstmsdkdec.h msdk: dec: Add non-packetized stream handling support 2018-02-13 14:41:20 -09:00
gstmsdkenc.c msdkenc: remove unnecessary memset 2018-02-22 12:32:45 -09:00
gstmsdkenc.h msdk: enc: Support force-key-unit events 2018-02-22 12:32:20 -09:00
gstmsdkh264dec.c msdk: Add H.264 decoder 2016-12-12 23:16:11 +01:00
gstmsdkh264dec.h msdk: Add H.264 decoder 2016-12-12 23:16:11 +01:00
gstmsdkh264enc.c msdk: h264_enc: Enable B-pyramid prediction support 2018-02-20 12:41:18 -09:00
gstmsdkh264enc.h msdk: h264_enc: Enable B-pyramid prediction support 2018-02-20 12:41:18 -09:00
gstmsdkh265dec.c msdk: implements GstMsdkContext. 2018-02-13 12:41:28 -09:00
gstmsdkh265dec.h msdk: Add H.265 decoder 2016-12-12 23:48:46 +01:00
gstmsdkh265enc.c msdk: encoder: h265: generalize the behavior of "i-frames" property 2018-02-20 12:39:02 -09:00
gstmsdkh265enc.h msdk: Create plugin for Intel's Media SDK 2016-11-14 15:16:45 +01:00
gstmsdkmjpegdec.c msdk: Allow building against mfx_dispatcher 2017-10-30 18:20:23 +02:00
gstmsdkmjpegdec.h msdk: add mjpeg decoder 2016-12-13 00:06:42 +01:00
gstmsdkmjpegenc.c msdk: Allow building against mfx_dispatcher 2017-10-30 18:20:23 +02:00
gstmsdkmjpegenc.h msdk: add mjpeg encoder 2016-12-13 00:06:42 +01:00
gstmsdkmpeg2dec.c msdk: Add mpeg2 decoder 2018-01-10 10:40:24 -09:00
gstmsdkmpeg2dec.h msdk: Add mpeg2 decoder 2018-01-10 10:40:24 -09:00
gstmsdkmpeg2enc.c msdk: encoder: register only the required properties 2018-02-20 12:38:28 -09:00
gstmsdkmpeg2enc.h msdk: Create plugin for Intel's Media SDK 2016-11-14 15:16:45 +01:00
gstmsdksystemmemory.c msdk: supports bufferpool 2018-02-13 13:44:08 -09:00
gstmsdksystemmemory.h msdk: supports bufferpool 2018-02-13 13:44:08 -09:00
gstmsdkvc1dec.c msdk: vc1_dec: Add Advanced profile (WVC1) support 2018-02-13 14:41:52 -09:00
gstmsdkvc1dec.h msdk: Add VC1 decoder (simple and main profiles) 2018-02-13 14:40:54 -09:00
gstmsdkvideomemory.c msdk: manage MSDK surfaces seperately 2018-03-08 11:37:12 -09:00
gstmsdkvideomemory.h msdk: manage MSDK surfaces seperately 2018-03-08 11:37:12 -09:00
gstmsdkvp8dec.c msdk: implements GstMsdkContext. 2018-02-13 12:41:28 -09:00
gstmsdkvp8dec.h msdk: adds msdkvp8dec 2017-11-01 11:33:50 +02:00
gstmsdkvp8enc.c msdk: encoder: register only the required properties 2018-02-20 12:38:28 -09:00
gstmsdkvp8enc.h msdk: Create plugin for Intel's Media SDK 2016-11-14 15:16:45 +01:00
Makefile.am msdk: move enum definitions to separte file 2018-02-20 12:40:50 -09:00
meson.build msdk: move enum definitions to separte file 2018-02-20 12:40:50 -09:00
msdk-enums.c msdk: Add more tuning options 2018-02-20 12:41:08 -09:00
msdk-enums.h msdk: Add more tuning options 2018-02-20 12:41:08 -09:00
msdk.c msdk: remove unused code 2018-02-23 14:30:56 -09:00
msdk.h msdkenc: use bufferpool 2018-02-13 13:48:32 -09:00
msdk_d3d.c msdk: implements GstMsdkContext. 2018-02-13 12:41:28 -09:00
msdk_libva.c msdk: implements GstMsdkContext. 2018-02-13 12:41:28 -09:00
msdk_libva.h msdk: libva: adds utility function between mfx and libva 2018-02-13 12:39:44 -09:00
README msdk: Create plugin for Intel's Media SDK 2016-11-14 15:16:45 +01:00

# gst-msdk

gst-msdk is a plugin for
[Intel Media SDK](https://software.intel.com/en-us/media-sdk), a
cross-platform API for developing media applications. The plugin has
multiple elements for video hardware encoding leveraging latest Intel
processors through Intel Media SDK.

- MPEG2 encoding (*msdkmpeg2enc*)

- H.264 encoding (*msdkh264enc*)

- H.265 encoding (*msdkh265enc*)

- VP8 encoding (*msdkvp8enc*)


It requires:

- Intel Media SDK


# Giving it a try

Encoding a simple video test source and saving it to a file.

    $ gst-launch-1.0 videotestsrc ! msdkh264enc ! filesink location=test.h264


# License

gst-mdk is freely available for download under the terms of the
[BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).