mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 16:21:17 +00:00
omxvideoenc: Setup aspect ratio on RPi
Needs firmware from yesterday or newer to work with all possible aspect ratios. Before that it only supported a fixed list. https://bugzilla.gnome.org/show_bug.cgi?id=732533
This commit is contained in:
parent
cdb918aefb
commit
bfeab29a39
1 changed files with 43 additions and 0 deletions
|
@ -29,6 +29,11 @@
|
|||
#include "gstomxvideo.h"
|
||||
#include "gstomxvideoenc.h"
|
||||
|
||||
#ifdef USE_OMX_TARGET_RPI
|
||||
#include <OMX_Broadcom.h>
|
||||
#include <OMX_Index.h>
|
||||
#endif
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_omx_video_enc_debug_category);
|
||||
#define GST_CAT_DEFAULT gst_omx_video_enc_debug_category
|
||||
|
||||
|
@ -1069,6 +1074,44 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder,
|
|||
&port_def) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
|
||||
#ifdef USE_OMX_TARGET_RPI
|
||||
/* aspect ratio */
|
||||
{
|
||||
OMX_ERRORTYPE err;
|
||||
OMX_CONFIG_POINTTYPE aspect_ratio_param;
|
||||
|
||||
GST_OMX_INIT_STRUCT (&aspect_ratio_param);
|
||||
aspect_ratio_param.nPortIndex = self->enc_out_port->index;
|
||||
|
||||
err = gst_omx_component_get_parameter (self->enc,
|
||||
OMX_IndexParamBrcmPixelAspectRatio, &aspect_ratio_param);
|
||||
|
||||
if (err == OMX_ErrorNone) {
|
||||
|
||||
aspect_ratio_param.nX = info->par_n;
|
||||
aspect_ratio_param.nY = info->par_d;
|
||||
|
||||
err =
|
||||
gst_omx_component_set_parameter (self->enc,
|
||||
OMX_IndexParamBrcmPixelAspectRatio, &aspect_ratio_param);
|
||||
|
||||
if (err == OMX_ErrorUnsupportedIndex) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"Setting aspect ratio parameters not supported by the component");
|
||||
} else if (err == OMX_ErrorUnsupportedSetting) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"Setting aspect ratio %u %u not supported by the component",
|
||||
aspect_ratio_param.nX, aspect_ratio_param.nY);
|
||||
} else if (err != OMX_ErrorNone) {
|
||||
GST_ERROR_OBJECT (self,
|
||||
"Failed to set aspect ratio: %s (0x%08x)",
|
||||
gst_omx_error_to_string (err), err);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // USE_OMX_TARGET_RPI
|
||||
|
||||
if (klass->set_format) {
|
||||
if (!klass->set_format (self, self->enc_in_port, state)) {
|
||||
GST_ERROR_OBJECT (self, "Subclass failed to set the new format");
|
||||
|
|
Loading…
Reference in a new issue