7 std::list
<av_snooper
*>* snoopers
;
8 std::list
<av_snooper::dump_notification
*> notifiers
;
9 std::string s_gamename
;
10 std::string s_rerecords
;
12 std::list
<std::pair
<std::string
, std::string
>> s_authors
;
16 av_snooper::av_snooper() throw(std::bad_alloc
)
19 snoopers
= new std::list
<av_snooper
*>();
20 snoopers
->push_back(this);
21 for(auto i
= notifiers
.begin(); i
!= notifiers
.end(); i
++)
22 (*i
)->dump_starting();
25 av_snooper::~av_snooper() throw()
29 for(auto i
= snoopers
->begin(); i
!= snoopers
->end(); i
++)
34 for(auto i
= notifiers
.begin(); i
!= notifiers
.end(); i
++)
38 void av_snooper::frame(struct lcscreen
& _frame
, uint32_t fps_n
, uint32_t fps_d
, bool dummy
) throw(std::bad_alloc
)
42 for(auto i
= snoopers
->begin(); i
!= snoopers
->end(); i
++)
44 (*i
)->frame(_frame
, fps_n
, fps_d
);
45 } catch(std::bad_alloc
& e
) {
47 } catch(std::exception
& e
) {
49 window::out() << "Error dumping frame: " << e
.what() << std::endl
;
55 void av_snooper::sample(short l
, short r
, bool dummy
) throw(std::bad_alloc
)
59 for(auto i
= snoopers
->begin(); i
!= snoopers
->end(); i
++)
62 } catch(std::bad_alloc
& e
) {
64 } catch(std::exception
& e
) {
66 window::out() << "Error dumping sample: " << e
.what() << std::endl
;
72 void av_snooper::end(bool dummy
) throw(std::bad_alloc
)
76 for(auto i
= snoopers
->begin(); i
!= snoopers
->end(); i
++)
79 } catch(std::bad_alloc
& e
) {
81 } catch(std::exception
& e
) {
83 window::out() << "Error ending dump: " << e
.what() << std::endl
;
89 void av_snooper::gameinfo(const std::string
& gamename
, const std::list
<std::pair
<std::string
, std::string
>>&
90 authors
, double gametime
, const std::string
& rerecords
, bool dummy
) throw(std::bad_alloc
)
94 s_gamename
= gamename
;
96 s_gametime
= gametime
;
97 s_rerecords
= rerecords
;
99 for(auto i
= snoopers
->begin(); i
!= snoopers
->end(); i
++)
100 (*i
)->send_gameinfo();
103 void av_snooper::send_gameinfo() throw()
107 gameinfo(s_gamename
, s_authors
, s_gametime
, s_rerecords
);
112 bool av_snooper::dump_in_progress() throw()
114 return (snoopers
&& !snoopers
->empty());
117 av_snooper::dump_notification::~dump_notification() throw()
121 void av_snooper::dump_notification::dump_starting() throw()
125 void av_snooper::dump_notification::dump_ending() throw()
129 void av_snooper::add_dump_notifier(av_snooper::dump_notification
& notifier
) throw(std::bad_alloc
)
131 notifiers
.push_back(¬ifier
);
134 void av_snooper::remove_dump_notifier(av_snooper::dump_notification
& notifier
) throw()
136 for(auto i
= notifiers
.begin(); i
!= notifiers
.end(); i
++)
137 if(*i
== ¬ifier
) {