NEWS: Release version 0.1.7
[libam7xxx.git] / contrib / performance / 0001-Instrument-code-with-fps-meter.patch
1 From bf1163a19667377a1861b38fa64a8cf7ee2d0e40 Mon Sep 17 00:00:00 2001
2 From: Antonio Ospite <ao2@ao2.it>
3 Date: Tue, 17 Nov 2015 16:28:03 +0100
4 Subject: [PATCH] Instrument code with fps-meter
5 X-Face: z*RaLf`X<@C75u6Ig9}{oW$H;1_\2t5)({*|jhM<pyWR#k60!#=#>/Vb;]yA5<GWI5`6u&+
6  ;6b'@y|8w"wB;4/e!7wYYrcqdJFY,~%Gk_4]cq$Ei/7<j&N3ah(m`ku?pX.&+~:_/wC~dwn^)MizBG
7  !pE^+iDQQ1yC6^,)YDKkxDd!T>\I~93>J<_`<4)A{':UrE
8
9 Instrument code with fps-meter:
10 http://git.ao2.it/experiments/fps-meter.git/
11 ---
12  examples/am7xxx-play.c | 5 +++++
13  1 file changed, 5 insertions(+)
14
15 diff --git a/examples/am7xxx-play.c b/examples/am7xxx-play.c
16 index 81aff84..4828a9d 100644
17 --- a/examples/am7xxx-play.c
18 +++ b/examples/am7xxx-play.c
19 @@ -35,6 +35,7 @@
20  #include <libswscale/swscale.h>
21  
22  #include <am7xxx.h>
23 +#include "fps-meter.h"
24  
25  static unsigned int run = 1;
26  
27 @@ -342,6 +343,7 @@ static int am7xxx_play(const char *input_format_string,
28         int got_frame;
29         int got_packet;
30         int ret;
31 +       struct fps_meter_stats stats;
32  
33         ret = video_input_init(&input_ctx, input_format_string, input_path, input_options);
34         if (ret < 0) {
35 @@ -410,6 +412,8 @@ static int am7xxx_play(const char *input_format_string,
36                 goto cleanup_out_buf;
37         }
38  
39 +       fps_meter_init(&stats);
40 +
41         got_packet = 0;
42         while (run) {
43                 /* read packet */
44 @@ -503,6 +507,7 @@ static int am7xxx_play(const char *input_format_string,
45                                 run = 0;
46                                 goto end_while;
47                         }
48 +                       fps_meter_update(&stats);
49                 }
50  end_while:
51                 if (!output_ctx.raw_output && got_packet)
52 -- 
53 2.16.2
54