am7xxx: check the return value of libusb_get_configuration()
[libam7xxx.git] / contrib / performance / 0001-Instrument-code-with-fps-meter.patch
1 From dc6b216ffea1e80fd3f43d6144eb679a193f5666 Mon Sep 17 00:00:00 2001
2 From: Antonio Ospite <ospite@studenti.unina.it>
3 Date: Sun, 28 Jul 2013 01:06:41 +0200
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/CMakeLists.txt | 2 +-
13  examples/am7xxx-play.c  | 4 ++++
14  2 files changed, 5 insertions(+), 1 deletion(-)
15
16 diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
17 index c77a812..23af8a9 100644
18 --- a/examples/CMakeLists.txt
19 +++ b/examples/CMakeLists.txt
20 @@ -1,5 +1,5 @@
21  include(CheckSymbolExists)
22 -add_definitions("-D_POSIX_C_SOURCE=2") # for getopt()
23 +add_definitions("-D_POSIX_C_SOURCE=200112L") # for getopt()
24  add_definitions("-D_POSIX_SOURCE") # for sigaction
25  add_definitions("-D_BSD_SOURCE") # for strdup
26  
27 diff --git a/examples/am7xxx-play.c b/examples/am7xxx-play.c
28 index 3230e67..17228bf 100644
29 --- a/examples/am7xxx-play.c
30 +++ b/examples/am7xxx-play.c
31 @@ -34,6 +34,7 @@
32  #include <libswscale/swscale.h>
33  
34  #include <am7xxx.h>
35 +#include "fps-meter.h"
36  
37  /* On some systems ENOTSUP is not defined, fallback to its value on
38   * linux which is equal to EOPNOTSUPP which is 95
39 @@ -292,6 +293,7 @@ static int am7xxx_play(const char *input_format_string,
40         int got_picture;
41         int got_packet;
42         int ret;
43 +       struct fps_meter_stats stats;
44  
45         ret = video_input_init(&input_ctx, input_format_string, input_path, input_options);
46         if (ret < 0) {
47 @@ -354,6 +356,7 @@ static int am7xxx_play(const char *input_format_string,
48                 goto cleanup_out_buf;
49         }
50  
51 +       fps_meter_init(&stats);
52         while (run) {
53                 /* read packet */
54                 ret = av_read_frame(input_ctx.format_ctx, &in_packet);
55 @@ -438,6 +441,7 @@ static int am7xxx_play(const char *input_format_string,
56                                 run = 0;
57                                 goto end_while;
58                         }
59 +                       fps_meter_update(&stats);
60                 }
61  end_while:
62                 if (!output_ctx.raw_output && got_packet)
63 -- 
64 1.8.3.2
65