mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
Revert "vaapiencode: handle custom event GstVaapiEncoderRegionOfInterest"
This reverts commit 8f1b88dac0
.
https://bugzilla.gnome.org/show_bug.cgi?id=768248
This commit is contained in:
parent
ba28c6cff2
commit
25c2a0d353
2 changed files with 0 additions and 113 deletions
|
@ -787,45 +787,6 @@ gst_vaapiencode_sink_event (GstVideoEncoder * venc, GstEvent * event)
|
||||||
GstPad *const srcpad = GST_VAAPI_PLUGIN_BASE_SRC_PAD (encode);
|
GstPad *const srcpad = GST_VAAPI_PLUGIN_BASE_SRC_PAD (encode);
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
|
||||||
case GST_EVENT_CUSTOM_DOWNSTREAM:{
|
|
||||||
const GstStructure *s = gst_event_get_structure (event);
|
|
||||||
if (gst_structure_has_name (s, "GstVaapiEncoderRegionOfInterest")) {
|
|
||||||
GstVaapiROI roi;
|
|
||||||
|
|
||||||
if (!encode->encoder)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
if (!gst_structure_get_uint (s, "roi-x", &roi.rect.x) ||
|
|
||||||
!gst_structure_get_uint (s, "roi-y", &roi.rect.y) ||
|
|
||||||
!gst_structure_get_uint (s, "roi-width", &roi.rect.width) ||
|
|
||||||
!gst_structure_get_uint (s, "roi-height", &roi.rect.height) ||
|
|
||||||
!gst_structure_get_int (s, "roi-value", &roi.roi_value)) {
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (roi.roi_value == 0) {
|
|
||||||
ret = gst_vaapi_encoder_del_roi (encode->encoder, &roi);
|
|
||||||
if (ret) {
|
|
||||||
GST_INFO_OBJECT (venc, "ROI: region with %d/%d/%d/%d is removed",
|
|
||||||
roi.rect.x, roi.rect.y, roi.rect.width, roi.rect.height);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ret = gst_vaapi_encoder_add_roi (encode->encoder, &roi);
|
|
||||||
if (ret) {
|
|
||||||
GST_INFO_OBJECT (venc, "ROI: region with %d/%d/%d/%d is added",
|
|
||||||
roi.rect.x, roi.rect.y, roi.rect.width, roi.rect.height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gst_event_unref (event);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = GST_VIDEO_ENCODER_CLASS (gst_vaapiencode_parent_class)->sink_event
|
ret = GST_VIDEO_ENCODER_CLASS (gst_vaapiencode_parent_class)->sink_event
|
||||||
(venc, event);
|
(venc, event);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
|
|
@ -58,80 +58,6 @@
|
||||||
* gst-launch-1.0 -ev videotestsrc num-buffers=60 ! timeoverlay ! vaapih264enc ! h264parse ! mp4mux ! filesink location=test.mp4
|
* gst-launch-1.0 -ev videotestsrc num-buffers=60 ! timeoverlay ! vaapih264enc ! h264parse ! mp4mux ! filesink location=test.mp4
|
||||||
* ]|
|
* ]|
|
||||||
* </refsect2>
|
* </refsect2>
|
||||||
*
|
|
||||||
* <refsect2>
|
|
||||||
* <title>Region of Interest</title>
|
|
||||||
* Since libva supports Region Of Interest for avc encoding depending on H/W,
|
|
||||||
* GStreamer VA-API supports it by #GstEvent.
|
|
||||||
* To enable ROI, an application must send an event of type GST_EVENT_CUSTOM_DOWNSTREAM,
|
|
||||||
* having a structure of name "GstVaapiEncoderRegionOfInterest" with fields set
|
|
||||||
* according to the following table:
|
|
||||||
*
|
|
||||||
* <informaltable>
|
|
||||||
* <tgroup cols='3'>
|
|
||||||
* <colspec colname='Name' />
|
|
||||||
* <colspec colname='Type' />
|
|
||||||
* <colspec colname='Purpose' />
|
|
||||||
* <thead>
|
|
||||||
* <row>
|
|
||||||
* <entry>Name</entry>
|
|
||||||
* <entry>GType</entry>
|
|
||||||
* <entry>Description</entry>
|
|
||||||
* </row>
|
|
||||||
* </thead>
|
|
||||||
* <tbody>
|
|
||||||
* <row>
|
|
||||||
* <entry>roi-value</entry>
|
|
||||||
* <entry>G_TYPE_INT</entry>
|
|
||||||
* <entry>specifies ROI delta QP or ROI priority.
|
|
||||||
* ROI delta QP is the value that will be added on top of the frame level QP.
|
|
||||||
* ROI priority specifies the priority of a region, it can be positive (more important)
|
|
||||||
* or negative (less important) values and is compared with non-ROI region (taken as value 0),
|
|
||||||
*
|
|
||||||
* </entry>
|
|
||||||
* </row>
|
|
||||||
* <row>
|
|
||||||
* <entry>roi-x</entry>
|
|
||||||
* <entry>G_TYPE_UINT</entry>
|
|
||||||
* <entry>X</entry>
|
|
||||||
* </row>
|
|
||||||
* <row>
|
|
||||||
* <entry>roi-y</entry>
|
|
||||||
* <entry>G_TYPE_UINT</entry>
|
|
||||||
* <entry>Y</entry>
|
|
||||||
* </row>
|
|
||||||
* <row>
|
|
||||||
* <entry>roi-width</entry>
|
|
||||||
* <entry>G_TYPE_UINT</entry>
|
|
||||||
* <entry>width</entry>
|
|
||||||
* </row>
|
|
||||||
* <row>
|
|
||||||
* <entry>roi-height</entry>
|
|
||||||
* <entry>G_TYPE_UINT</entry>
|
|
||||||
* <entry>height</entry>
|
|
||||||
* </row>
|
|
||||||
* </tbody>
|
|
||||||
* </tgroup>
|
|
||||||
* </informaltable>
|
|
||||||
*
|
|
||||||
* For example, the following code informs the encoder to enable ROI
|
|
||||||
* with a region for ROI.
|
|
||||||
* Note that if an application wants to disable the region,
|
|
||||||
* just send an event with roi-value=0 and same coordination.
|
|
||||||
*
|
|
||||||
* <programlisting>
|
|
||||||
* GstEvent *event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM,
|
|
||||||
* gst_structure_new ("GstVaapiEncoderRegionOfInterest",
|
|
||||||
* "roi-x", G_TYPE_UINT, 1820,
|
|
||||||
* "roi-y", G_TYPE_UINT, 980,
|
|
||||||
* "roi-width", G_TYPE_UINT, 100,
|
|
||||||
* "roi-height", G_TYPE_UINT, 100,
|
|
||||||
* "roi-value", G_TYPE_INT, 4, NULL));
|
|
||||||
*
|
|
||||||
* gst_element_send_event (pipeline, event);
|
|
||||||
* </programlisting>
|
|
||||||
* </refsect2>
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gstcompat.h"
|
#include "gstcompat.h"
|
||||||
|
|
Loading…
Reference in a new issue