[go: nahoru, domu]

Merge "mm-video-v4l2: Add support for frame-rate vendor extension." into video-userspace.lnx.4.2
diff --git a/conf_files/msmnile/system_properties.xml b/conf_files/msmnile/system_properties.xml
index 2ec8516..f029c0d 100644
--- a/conf_files/msmnile/system_properties.xml
+++ b/conf_files/msmnile/system_properties.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <!--
-Copyright (c) 2018, The Linux Foundation. All rights reserved.
+Copyright (c) 2018 - 2019, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -30,7 +30,6 @@
 <configs>
         <property name="vidc_dec_log_in" value="0"/>
         <property name="vidc_dec_log_out" value="0"/>
-        <property name="vidc_dec_hfr_fps" value="0"/>
         <property name="vidc_enc_log_in" value="0"/>
         <property name="vidc_enc_log_out" value="0"/>
         <property name="vidc_enc_csc_custom_matrix" value="0"/>
diff --git a/conf_files/sdm845/system_properties.xml b/conf_files/sdm845/system_properties.xml
index a6edc62..cc1a493 100644
--- a/conf_files/sdm845/system_properties.xml
+++ b/conf_files/sdm845/system_properties.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <!--
-Copyright (c) 2017, The Linux Foundation. All rights reserved.
+Copyright (c) 2017, 2019, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -30,7 +30,6 @@
 <configs>
         <property name="vidc_dec_log_in" value="0"/>
         <property name="vidc_dec_log_out" value="0"/>
-        <property name="vidc_dec_hfr_fps" value="0"/>
         <property name="vidc_enc_log_in" value="0"/>
         <property name="vidc_enc_log_out" value="0"/>
         <property name="vidc_enc_csc_custom_matrix" value="0"/>
diff --git a/conf_files/sm6150/system_properties.xml b/conf_files/sm6150/system_properties.xml
index 3887276..e0da5a0 100644
--- a/conf_files/sm6150/system_properties.xml
+++ b/conf_files/sm6150/system_properties.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <!--
-Copyright (c) 2017, The Linux Foundation. All rights reserved.
+Copyright (c) 2017, 2019, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -30,7 +30,6 @@
 <configs>
         <property name="vidc_dec_log_in" value="0"/>
         <property name="vidc_dec_log_out" value="0"/>
-        <property name="vidc_dec_hfr_fps" value="0"/>
         <property name="vidc_enc_log_in" value="0"/>
         <property name="vidc_enc_log_out" value="0"/>
         <property name="vidc_enc_csc_custom_matrix" value="0"/>
diff --git a/conf_files/trinket/system_properties.xml b/conf_files/trinket/system_properties.xml
index 0a51157..deeef85 100644
--- a/conf_files/trinket/system_properties.xml
+++ b/conf_files/trinket/system_properties.xml
@@ -30,7 +30,6 @@
 <configs>
         <property name="vidc_dec_log_in" value="0"/>
         <property name="vidc_dec_log_out" value="0"/>
-        <property name="vidc_dec_hfr_fps" value="0"/>
         <property name="vidc_enc_log_in" value="0"/>
         <property name="vidc_enc_log_out" value="0"/>
         <property name="vidc_enc_csc_custom_matrix" value="0"/>
diff --git a/mm-core/inc/OMX_QCOMExtns.h b/mm-core/inc/OMX_QCOMExtns.h
old mode 100755
new mode 100644
index 3d72202..6d9006d
--- a/mm-core/inc/OMX_QCOMExtns.h
+++ b/mm-core/inc/OMX_QCOMExtns.h
@@ -703,6 +703,8 @@
     OMX_QTIIndexConfigVideoRoiRectRegionInfo = 0x7F100007,
 
     OMX_QTIIndexParamNativeRecorder = 0x7F100008,
+
+    OMX_QTIIndexParamVideoDecoderOutputFrameRate = 0x7F100009,
 };
 
 /**
@@ -1825,6 +1827,12 @@
         OMX_U32 nBufferSize;
 } QOMX_VIDEO_CUSTOM_BUFFERSIZE;
 
+typedef struct QOMX_VIDEO_OUTPUT_FRAME_RATE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 fps;
+} QOMX_VIDEO_OUTPUT_FRAME_RATE;
+
 #define OMX_QCOM_INDEX_PARAM_VIDEO_SYNCFRAMEDECODINGMODE "OMX.QCOM.index.param.video.SyncFrameDecodingMode"
 #define OMX_QCOM_INDEX_PARAM_INDEXEXTRADATA "OMX.QCOM.index.param.IndexExtraData"
 #define OMX_QCOM_INDEX_PARAM_VIDEO_SLICEDELIVERYMODE "OMX.QCOM.index.param.SliceDeliveryMode"
diff --git a/mm-video-v4l2/vidc/vdec/src/omx_vdec_extensions.hpp b/mm-video-v4l2/vidc/vdec/src/omx_vdec_extensions.hpp
index 5a40bd3..d92dac9 100644
--- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_extensions.hpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_extensions.hpp
@@ -1,5 +1,5 @@
 /*--------------------------------------------------------------------------
-Copyright (c) 2017, The Linux Foundation. All rights reserved.
+Copyright (c) 2017, 2019, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -42,6 +42,9 @@
 
     ADD_EXTENSION("qti-ext-dec-caps-vt-driver-version", OMX_QTIIndexParamCapabilitiesVTDriverVersion, OMX_DirOutput)
     ADD_PARAM_END("number", OMX_AndroidVendorValueInt32)
+
+    ADD_EXTENSION("qti-ext-dec-output-frame-rate", OMX_QTIIndexParamVideoDecoderOutputFrameRate, OMX_DirOutput)
+    ADD_PARAM_END("value", OMX_AndroidVendorValueInt32)
 }
 
 
@@ -98,6 +101,11 @@
             setStatus &= vExt.setParamInt32(ext, "number", VT_DRIVER_VERSION);
             break;
         }
+        case OMX_QTIIndexParamVideoDecoderOutputFrameRate:
+        {
+            setStatus &= vExt.setParamInt32(ext, "value", m_dec_hfr_fps);
+            break;
+        }
         default:
         {
             return OMX_ErrorNotImplemented;
@@ -204,6 +212,19 @@
             } while ((token = strtok_r(NULL, "|", &rest)));
             break;
         }
+        case OMX_QTIIndexParamVideoDecoderOutputFrameRate:
+        {
+            QOMX_VIDEO_OUTPUT_FRAME_RATE decOutputFrameRateParam;
+            OMX_INIT_STRUCT(&decOutputFrameRateParam, QOMX_VIDEO_OUTPUT_FRAME_RATE);
+            valueSet |= vExt.readParamInt32(ext, "value", (OMX_S32 *)&decOutputFrameRateParam.fps);
+            DEBUG_PRINT_HIGH("VENDOR-EXT: set_param: decoder output-frame-rate value =%d", decOutputFrameRateParam.fps);
+            err = set_parameter(
+                    NULL, (OMX_INDEXTYPE)OMX_QTIIndexParamVideoDecoderOutputFrameRate, &decOutputFrameRateParam);
+            if (err != OMX_ErrorNone) {
+                DEBUG_PRINT_ERROR("set_param: OMX_QTIIndexParamVideoDecoderOutputFrameRate failed !");
+            }
+            break;
+        }
         case OMX_QTIIndexParamCapabilitiesVTDriverVersion:
         {
             break;
diff --git a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
index 845022a..b40421a 100644
--- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
@@ -1,5 +1,5 @@
 /*--------------------------------------------------------------------------
-Copyright (c) 2010 - 2018, The Linux Foundation. All rights reserved.
+Copyright (c) 2010 - 2019, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -787,15 +787,6 @@
     Platform::Config::getInt32(Platform::vidc_dec_log_out,
             (int32_t *)&m_debug.out_buffer_log, 0);
 
-    Platform::Config::getInt32(Platform::vidc_dec_hfr_fps,
-            (int32_t *)&m_dec_hfr_fps, 0);
-
-    DEBUG_PRINT_HIGH("HFR fps value = %d", m_dec_hfr_fps);
-
-    if (m_dec_hfr_fps) {
-        m_last_rendered_TS = 0;
-    }
-
     Platform::Config::getInt32(Platform::vidc_dec_sec_prefetch_size_internal,
             (int32_t *)&m_dec_secure_prefetch_size_internal, 0);
     Platform::Config::getInt32(Platform::vidc_dec_sec_prefetch_size_output,
@@ -5238,6 +5229,19 @@
             mClientSetLevel = pParam->eLevel;
             break;
         }
+        case OMX_QTIIndexParamVideoDecoderOutputFrameRate:
+        {
+            VALIDATE_OMX_PARAM_DATA(paramData, QOMX_VIDEO_OUTPUT_FRAME_RATE);
+            DEBUG_PRINT_LOW("set_parameter: OMX_QTIIndexParamVideoDecoderOutputFrameRate");
+            QOMX_VIDEO_OUTPUT_FRAME_RATE *pParam = (QOMX_VIDEO_OUTPUT_FRAME_RATE*)paramData;
+            DEBUG_PRINT_LOW("set_parameter: decoder output-frame-rate %d", pParam->fps);
+            m_dec_hfr_fps=pParam->fps;
+            DEBUG_PRINT_HIGH("output-frame-rate value = %d", m_dec_hfr_fps);
+            if (m_dec_hfr_fps) {
+                m_last_rendered_TS = 0;
+            }
+            break;
+        }
         default: {
                  DEBUG_PRINT_ERROR("Setparameter: unknown param %d", paramIndex);
                  eRet = OMX_ErrorUnsupportedIndex;