summaryrefslogtreecommitdiff
path: root/recipes-support/opencv/opencv/0004-cap_ffmpeg-do-not-use-AVStream.r_frame_rate.patch
blob: 5d4584aa0322b49e3d913cb4e5fa3edb08a2133b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From 023e48e2e2fe845128752c4eeb9d0aa26b261e89 Mon Sep 17 00:00:00 2001
From: Anton Khirnov <anton@khirnov.net>
Date: Thu, 6 Feb 2014 09:46:58 +0100
Subject: [PATCH 4/5] cap_ffmpeg: do not use AVStream.r_frame_rate

r_frame_rate is a guessed number defined as "the least common multiple
of all framerates in the stream". It has been deprecated and removed in
new Libav releases.

Use avg_frame_rate instead, which is the average framerate of the
stream.

(cherry picked from commit 0c8faf17694baaf62ad120b6b3103b5d022e04ed)
---
 modules/highgui/src/cap_ffmpeg_impl.hpp | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/modules/highgui/src/cap_ffmpeg_impl.hpp b/modules/highgui/src/cap_ffmpeg_impl.hpp
index e2e3c30..44ef553 100644
--- a/modules/highgui/src/cap_ffmpeg_impl.hpp
+++ b/modules/highgui/src/cap_ffmpeg_impl.hpp
@@ -735,7 +735,7 @@ double CvCapture_FFMPEG::getProperty( int property_id )
     case CV_FFMPEG_CAP_PROP_FRAME_HEIGHT:
         return (double)frame.height;
     case CV_FFMPEG_CAP_PROP_FPS:
-        return av_q2d(video_st->r_frame_rate);
+        return av_q2d(video_st->avg_frame_rate);
     case CV_FFMPEG_CAP_PROP_FOURCC:
         return (double)video_st->codec->codec_tag;
     default:
@@ -774,12 +774,7 @@ int CvCapture_FFMPEG::get_bitrate()
 
 double CvCapture_FFMPEG::get_fps()
 {
-    double fps = r2d(ic->streams[video_stream]->r_frame_rate);
-
-    if (fps < eps_zero)
-    {
-        fps = r2d(ic->streams[video_stream]->avg_frame_rate);
-    }
+    double fps = r2d(ic->streams[video_stream]->avg_frame_rate);
 
     if (fps < eps_zero)
     {
-- 
1.9.3