From e065d31b7bac0a3fffc0f05922613090cc573709 Mon Sep 17 00:00:00 2001
From: Alex Deryskyba <alex@codesnake.com>
Date: Sun, 21 Sep 2014 17:17:14 +0300
Subject: [PATCH 11/17] [aml] Use fpsrate and fpsscale instead of rfpsrate and
 rfpsscale to detect framerate

---
 xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp  |   12 ++-----
 .../DVDCodecs/Video/DVDVideoCodecAmlogic.cpp       |   38 +++++++++-----------
 2 files changed, 20 insertions(+), 30 deletions(-)

diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp
index 26db4a1..fcdad19 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp
@@ -1465,14 +1465,8 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints)
   am_private->video_ratio64    = ((int64_t)video_ratio.num << 32) | video_ratio.den;
 
   // handle video rate
-  if (hints.rfpsrate > 0 && hints.rfpsscale != 0)
+  if (hints.fpsrate > 0 && hints.fpsscale != 0)
   {
-    // check ffmpeg r_frame_rate 1st
-    am_private->video_rate = 0.5 + (float)UNIT_FREQ * hints.rfpsscale / hints.rfpsrate;
-  }
-  else if (hints.fpsrate > 0 && hints.fpsscale != 0)
-  {
-    // then ffmpeg avg_frame_rate next
     am_private->video_rate = 0.5 + (float)UNIT_FREQ * hints.fpsscale / hints.fpsrate;
   }
 
@@ -1545,8 +1539,8 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints)
   CLog::Log(LOGDEBUG, "CAMLCodec::OpenDecoder "
     "hints.width(%d), hints.height(%d), hints.codec(%d), hints.codec_tag(%d), hints.pid(%d)",
     hints.width, hints.height, hints.codec, hints.codec_tag, hints.pid);
-  CLog::Log(LOGDEBUG, "CAMLCodec::OpenDecoder hints.fpsrate(%d), hints.fpsscale(%d), hints.rfpsrate(%d), hints.rfpsscale(%d), video_rate(%d)",
-    hints.fpsrate, hints.fpsscale, hints.rfpsrate, hints.rfpsscale, am_private->video_rate);
+  CLog::Log(LOGDEBUG, "CAMLCodec::OpenDecoder hints.fpsrate(%d), hints.fpsscale(%d), video_rate(%d)",
+    hints.fpsrate, hints.fpsscale, am_private->video_rate);
   CLog::Log(LOGDEBUG, "CAMLCodec::OpenDecoder hints.aspect(%f), video_ratio.num(%d), video_ratio.den(%d)",
     hints.aspect, video_ratio.num, video_ratio.den);
   CLog::Log(LOGDEBUG, "CAMLCodec::OpenDecoder hints.orientation(%d), hints.forced_aspect(%d), hints.extrasize(%d)",
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp
index 24c1ab9..960aae1 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp
@@ -74,9 +74,7 @@ bool CDVDVideoCodecAmlogic::Open(CDVDStreamInfo &hints, CDVDCodecOptions &option
       m_mpeg2_sequence->width  = m_hints.width;
       m_mpeg2_sequence->height = m_hints.height;
       m_mpeg2_sequence->ratio  = m_hints.aspect;
-      if (m_hints.rfpsrate > 0 && m_hints.rfpsscale != 0)
-        m_mpeg2_sequence->rate = (float)m_hints.rfpsrate / m_hints.rfpsscale;
-      else if (m_hints.fpsrate > 0 && m_hints.fpsscale != 0)
+      if (m_hints.fpsrate > 0 && m_hints.fpsscale != 0)
         m_mpeg2_sequence->rate = (float)m_hints.fpsrate / m_hints.fpsscale;
       else
         m_mpeg2_sequence->rate = 1.0;
@@ -374,43 +372,41 @@ void CDVDVideoCodecAmlogic::FrameRateTracking(uint8_t *pData, int iSize, double
       {
         default:
         case 0x01:
-          m_hints.rfpsrate = 24000.0;
-          m_hints.rfpsscale = 1001.0;
+          m_hints.fpsrate = 24000.0;
+          m_hints.fpsscale = 1001.0;
           break;
         case 0x02:
-          m_hints.rfpsrate = 24000.0;
-          m_hints.rfpsscale = 1000.0;
+          m_hints.fpsrate = 24000.0;
+          m_hints.fpsscale = 1000.0;
           break;
         case 0x03:
-          m_hints.rfpsrate = 25000.0;
-          m_hints.rfpsscale = 1000.0;
+          m_hints.fpsrate = 25000.0;
+          m_hints.fpsscale = 1000.0;
           break;
         case 0x04:
-          m_hints.rfpsrate = 30000.0;
-          m_hints.rfpsscale = 1001.0;
+          m_hints.fpsrate = 30000.0;
+          m_hints.fpsscale = 1001.0;
           break;
         case 0x05:
-          m_hints.rfpsrate = 30000.0;
-          m_hints.rfpsscale = 1000.0;
+          m_hints.fpsrate = 30000.0;
+          m_hints.fpsscale = 1000.0;
           break;
         case 0x06:
-          m_hints.rfpsrate = 50000.0;
-          m_hints.rfpsscale = 1000.0;
+          m_hints.fpsrate = 50000.0;
+          m_hints.fpsscale = 1000.0;
           break;
         case 0x07:
-          m_hints.rfpsrate = 60000.0;
-          m_hints.rfpsscale = 1001.0;
+          m_hints.fpsrate = 60000.0;
+          m_hints.fpsscale = 1001.0;
           break;
         case 0x08:
-          m_hints.rfpsrate = 60000.0;
-          m_hints.rfpsscale = 1000.0;
+          m_hints.fpsrate = 60000.0;
+          m_hints.fpsscale = 1000.0;
           break;
       }
       m_hints.width    = m_mpeg2_sequence->width;
       m_hints.height   = m_mpeg2_sequence->height;
       m_hints.aspect   = m_mpeg2_sequence->ratio;
-      m_hints.fpsrate  = m_hints.rfpsrate;
-      m_hints.fpsscale = m_hints.rfpsscale;
     }
     return;
   }
-- 
1.7.10.4

