0003-add-video-scale-support.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. --- a/omx/gstomxvideodec.c 2020-10-26 19:17:03.000000000 +0800
  2. +++ b/omx/gstomxvideodec.c 2021-08-16 16:23:08.082113380 +0800
  3. @@ -2185,6 +2185,7 @@
  4. gst_omx_video_dec_negotiate (GstOMXVideoDec * self)
  5. {
  6. OMX_VIDEO_PARAM_PORTFORMATTYPE param;
  7. + OMX_PARAM_PORTDEFINITIONTYPE port_def;
  8. OMX_ERRORTYPE err;
  9. GstCaps *comp_supported_caps;
  10. GList *negotiation_map = NULL, *l;
  11. @@ -2192,6 +2193,7 @@
  12. GstVideoFormat format;
  13. GstStructure *s;
  14. const gchar *format_str;
  15. + gint width, height;
  16. GST_DEBUG_OBJECT (self, "Trying to negotiate a video format with downstream");
  17. @@ -2281,6 +2283,31 @@
  18. gst_omx_error_to_string (err), err);
  19. }
  20. + if (gst_structure_get_int(s, "width", &width) && gst_structure_get_int(s, "height", &height))
  21. + {
  22. + GST_OMX_INIT_STRUCT (&port_def);
  23. + port_def.nPortIndex = self->dec_out_port->index;
  24. + err = gst_omx_component_get_parameter (self->dec,
  25. + OMX_IndexParamPortDefinition, &port_def);
  26. + if (err != OMX_ErrorNone) {
  27. + GST_ERROR_OBJECT (self, "Failed to get video port definition: %s (0x%08x)",
  28. + gst_omx_error_to_string (err), err);
  29. + return FALSE;
  30. + }
  31. +
  32. + port_def.format.video.nFrameHeight = height;
  33. + port_def.format.video.nFrameWidth = width;
  34. +
  35. + err =
  36. + gst_omx_component_set_parameter (self->dec,
  37. + OMX_IndexParamPortDefinition, &port_def);
  38. + if (err != OMX_ErrorNone) {
  39. + GST_ERROR_OBJECT (self, "Failed to set video port definition: %s (0x%08x)",
  40. + gst_omx_error_to_string (err), err);
  41. + return FALSE;
  42. + }
  43. + }
  44. +
  45. gst_caps_unref (intersection);
  46. return (err == OMX_ErrorNone);
  47. }