0019-Add-Interlaced-mode-judgment.patch 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. Add Interlaced-mode judgment for gstomxvideodec class
  2. Fix compiler warnings
  3. Signed-off-by: Leo Lu <leo.lu@starfivetech.com>
  4. diff -purN a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
  5. --- a/omx/gstomxvideodec.c 2022-11-03 17:02:54.601333539 +0800
  6. +++ b/omx/gstomxvideodec.c 2022-11-03 16:06:20.435534119 +0800
  7. @@ -740,7 +740,7 @@ gst_omx_try_importing_buffer (GstOMXVide
  8. #ifdef USE_OMX_TARGET_STARFIVE
  9. if ( !gst_is_dmabuf_memory (mem)) {
  10. GST_INFO_OBJECT (self,
  11. - " %d-th buffer doesn't contain dmabuf, go to out. port->port_def.nBufferSize: %lu",
  12. + " %d-th buffer doesn't contain dmabuf, go to out. port->port_def.nBufferSize: %u",
  13. i, port->port_def.nBufferSize);
  14. goto out;
  15. }
  16. @@ -2795,7 +2795,7 @@ gst_omx_video_dec_set_format (GstVideoDe
  17. gboolean needs_disable = FALSE;
  18. OMX_PARAM_PORTDEFINITIONTYPE port_def;
  19. OMX_U32 framerate_q16 = gst_omx_video_calculate_framerate_q16 (info);
  20. -
  21. + static gboolean interlaced_print_flag = FALSE;
  22. self = GST_OMX_VIDEO_DEC (decoder);
  23. klass = GST_OMX_VIDEO_DEC_GET_CLASS (decoder);
  24. @@ -2857,9 +2857,17 @@ gst_omx_video_dec_set_format (GstVideoDe
  25. /*We cannot use GST_VIDEO_INFO_FIELD_HEIGHT() as encoded content may use either
  26. * interlace-mode=interleaved or alternate. In both case we'll output alternate
  27. * so the OMX frame height needs to be halfed. */
  28. - if (GST_VIDEO_INFO_IS_INTERLACED (info))
  29. + if (GST_VIDEO_INFO_IS_INTERLACED (info)) {
  30. port_def.format.video.nFrameHeight =
  31. GST_ROUND_UP_2 (port_def.format.video.nFrameHeight / 2);
  32. + if (!interlaced_print_flag) {
  33. + g_print("Current stream mode is %s, but just support PROGRESSIVE type. \n",
  34. + gst_video_interlace_mode_to_string (info->interlace_mode));
  35. + GST_ERROR_OBJECT (self, "Just support PROGRESSIVE type ");
  36. + interlaced_print_flag = TRUE;
  37. + }
  38. + return FALSE;
  39. + }
  40. port_def.format.video.xFramerate = framerate_q16;
  41. if (klass->cdata.hacks & GST_OMX_HACK_PASS_COLOR_FORMAT_TO_DECODER) {
  42. diff -purN a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c
  43. --- a/omx/gstomxvideoenc.c 2022-11-03 17:02:54.593333485 +0800
  44. +++ b/omx/gstomxvideoenc.c 2022-11-03 13:46:10.137177818 +0800
  45. @@ -2136,7 +2136,7 @@ gst_omx_try_importing_buffer (GstOMXVide
  46. if ( !gst_is_dmabuf_memory (mem)) {
  47. GST_INFO_OBJECT (self,
  48. - " %d-th buffer doesn't contain dmabuf, go to out. port->port_def.nBufferSize: %lu",
  49. + " %d-th buffer doesn't contain dmabuf, go to out. port->port_def.nBufferSize: %u",
  50. i, port->port_def.nBufferSize);
  51. goto out;
  52. }
  53. @@ -2187,7 +2187,7 @@ gst_omx_video_enc_use_buffers (GstOMXVid
  54. GList *frames = NULL;
  55. OMX_ERRORTYPE err = OMX_ErrorNone;
  56. gboolean is_mapped = FALSE ;
  57. - GST_DEBUG(" nBufferCountActual=%d, nBufferCountMin= %lu", n, port->port_def.nBufferCountMin);
  58. + GST_DEBUG(" nBufferCountActual=%d, nBufferCountMin= %u", n, port->port_def.nBufferCountMin);
  59. if ( pool != NULL ) {
  60. guint i;