mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 12:40:19 +00:00
Displays and capturers use now log_msg() for periodic messages
This commit is contained in:
@@ -91,7 +91,6 @@ void log_msg(int level, const char *format, ...)
|
||||
#endif /* WIN32 */
|
||||
|
||||
va_list ap;
|
||||
FILE *f = level >= LOG_LEVEL_INFO ? stdout : stderr;
|
||||
const char *color = "";
|
||||
const char *ending = "\033[0m";
|
||||
|
||||
@@ -112,7 +111,7 @@ void log_msg(int level, const char *format, ...)
|
||||
}
|
||||
|
||||
va_start(ap, format);
|
||||
vfprintf(f, format, ap);
|
||||
vfprintf(stderr, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,11 @@ protected:
|
||||
private:
|
||||
int level;
|
||||
};
|
||||
|
||||
#define LOG(level) \
|
||||
if (level > log_level) ; \
|
||||
else Logger(level).Get()
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -156,7 +156,7 @@ void keyboard_control::usage()
|
||||
"\t* 0 - increase volume\n" <<
|
||||
"\t/ 9 - decrease volume\n" <<
|
||||
"\t m - mute/unmute\n" <<
|
||||
"\t v - toggle verbose mode\n" <<
|
||||
"\t v - increase verbosity level\n" <<
|
||||
"\t h - show help\n" <<
|
||||
"\n";
|
||||
}
|
||||
|
||||
@@ -1391,7 +1391,7 @@ static int reconfigure_if_needed(struct state_video_decoder *decoder,
|
||||
struct video_desc network_desc)
|
||||
{
|
||||
if (!video_desc_eq_excl_param(decoder->received_vid_desc, network_desc, PARAM_TILE_COUNT)) {
|
||||
Logger(LOG_LEVEL_NOTICE).Get() << "New incoming video format detected: " << network_desc << endl;
|
||||
LOG(LOG_LEVEL_NOTICE) << "New incoming video format detected: " << network_desc << endl;
|
||||
decoder->received_vid_desc = network_desc;
|
||||
|
||||
#ifdef RECONFIGURE_IN_FUTURE_THREAD
|
||||
|
||||
@@ -1159,7 +1159,7 @@ struct video_frame * vidcap_dshow_grab(void *state, struct audio_frame **audio)
|
||||
double seconds = tv_diff(t, s->t0);
|
||||
if (seconds >= 5) {
|
||||
double fps = s->frames / seconds;
|
||||
fprintf(stderr, "[dshow] %ld frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
log_msg(LOG_LEVEL_INFO, "[dshow] %ld frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
s->t0 = t;
|
||||
s->frames = 0;
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ vidcap_aggregate_grab(void *state, struct audio_frame **audio)
|
||||
double seconds = tv_diff(s->t, s->t0);
|
||||
if (seconds >= 5) {
|
||||
float fps = s->frames / seconds;
|
||||
fprintf(stderr, "[aggregate cap.] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
log_msg(LOG_LEVEL_INFO, "[aggregate cap.] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
s->t0 = s->t;
|
||||
s->frames = 0;
|
||||
}
|
||||
|
||||
@@ -560,7 +560,7 @@ struct video_frame *vidcap_state_aja::grab(struct audio_frame **audio)
|
||||
chrono::system_clock::time_point now = chrono::system_clock::now();
|
||||
double seconds = chrono::duration_cast<chrono::microseconds>(now - mT0).count() / 1000000.0;
|
||||
if (seconds >= 5) {
|
||||
cout << "[AJA] " << mFrames << " frames in "
|
||||
LOG(LOG_LEVEL_INFO) << "[AJA] " << mFrames << " frames in "
|
||||
<< seconds << " seconds = " << mFrames / seconds << " FPS\n";
|
||||
mT0 = now;
|
||||
mFrames = 0;
|
||||
|
||||
@@ -714,7 +714,7 @@ static void *worker(void *arg)
|
||||
double seconds = tv_diff(t, s->t0);
|
||||
if (seconds >= 5) {
|
||||
float fps = s->frames / seconds;
|
||||
fprintf(stderr, "[Blue cap] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
log_msg(LOG_LEVEL_INFO, "[Blue cap] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
s->t0 = t;
|
||||
s->frames = 0;
|
||||
}
|
||||
|
||||
@@ -1355,7 +1355,7 @@ vidcap_decklink_grab(void *state, struct audio_frame **audio)
|
||||
double seconds = tv_diff(t, s->t0);
|
||||
if (seconds >= 5) {
|
||||
float fps = s->frames / seconds;
|
||||
fprintf(stderr, "[Decklink capture] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
log_msg(LOG_LEVEL_INFO, "[Decklink capture] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
s->t0 = t;
|
||||
s->frames = 0;
|
||||
}
|
||||
|
||||
@@ -561,7 +561,7 @@ vidcap_deltacast_grab(void *state, struct audio_frame **audio)
|
||||
double seconds = tv_diff(s->t, s->t0);
|
||||
if (seconds >= 5) {
|
||||
float fps = s->frames / seconds;
|
||||
fprintf(stderr, "[DELTACAST cap.] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
log_msg(LOG_LEVEL_INFO, "[DELTACAST cap.] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
s->t0 = s->t;
|
||||
s->frames = 0;
|
||||
}
|
||||
|
||||
@@ -759,7 +759,7 @@ vidcap_deltacast_dvi_grab(void *state, struct audio_frame **audio)
|
||||
double seconds = tv_diff(s->t, s->t0);
|
||||
if (seconds >= 5) {
|
||||
float fps = s->frames / seconds;
|
||||
fprintf(stderr, "[DELTACAST cap.] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
log_msg(LOG_LEVEL_INFO, "[DELTACAST cap.] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
s->t0 = s->t;
|
||||
s->frames = 0;
|
||||
}
|
||||
|
||||
@@ -590,7 +590,7 @@ struct video_frame *vidcap_dvs_grab(void *state, struct audio_frame **audio)
|
||||
double seconds = tv_diff(s->t, s->t0);
|
||||
if (seconds >= 5) {
|
||||
float fps = s->frames / seconds;
|
||||
fprintf(stderr, "[DVS cap.] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
log_msg(LOG_LEVEL_INFO, "[DVS cap.] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
s->t0 = s->t;
|
||||
s->frames = 0;
|
||||
}
|
||||
|
||||
@@ -1245,7 +1245,7 @@ vidcap_import_grab(void *state, struct audio_frame **audio)
|
||||
double seconds = tv_diff(cur_time, s->t0);
|
||||
if (seconds >= 5) {
|
||||
float fps = (s->frames - s->frames_prev) / seconds;
|
||||
fprintf(stderr, "[import] %d frames in %g seconds = %g FPS\n", s->frames - s->frames_prev, seconds, fps);
|
||||
log_msg(LOG_LEVEL_INFO, "[import] %d frames in %g seconds = %g FPS\n", s->frames - s->frames_prev, seconds, fps);
|
||||
s->t0 = cur_time;
|
||||
s->frames_prev = s->frames;
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ qt_data_proc(SGChannel c, Ptr p, long len, long *offset, long chRefCon,
|
||||
double seconds = tv_diff(t, s->t0);
|
||||
if (seconds >= 5) {
|
||||
float fps = s->frames / seconds;
|
||||
fprintf(stderr, "[QuickTime cap.] %d frames in %g seconds = %g FPS\n", s->frames,
|
||||
log_msg(LOG_LEVEL_INFO, "[QuickTime cap.] %d frames in %g seconds = %g FPS\n", s->frames,
|
||||
seconds, fps);
|
||||
s->t0 = t;
|
||||
s->frames = 0;
|
||||
|
||||
@@ -227,7 +227,7 @@ struct video_frame * vidcap_screen_osx_grab(void *state, struct audio_frame **au
|
||||
double seconds = tv_diff(s->t, s->t0);
|
||||
if (seconds >= 5) {
|
||||
float fps = s->frames / seconds;
|
||||
fprintf(stderr, "[screen capture] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
log_msg(LOG_LEVEL_INFO, "[screen capture] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
s->t0 = s->t;
|
||||
s->frames = 0;
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ struct video_frame * vidcap_screen_x11_grab(void *state, struct audio_frame **au
|
||||
double seconds = tv_diff(s->t, s->t0);
|
||||
if (seconds >= 5) {
|
||||
float fps = s->frames / seconds;
|
||||
fprintf(stderr, "[screen capture] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
log_msg(LOG_LEVEL_INFO, "[screen capture] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
s->t0 = s->t;
|
||||
s->frames = 0;
|
||||
}
|
||||
|
||||
@@ -1310,7 +1310,7 @@ vidcap_swmix_grab(void *state, struct audio_frame **audio)
|
||||
double seconds = tv_diff(s->t, s->t0);
|
||||
if (seconds >= 5) {
|
||||
float fps = s->frames / seconds;
|
||||
fprintf(stderr, "[swmix cap.] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
log_msg(LOG_LEVEL_INFO, "[swmix cap.] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
s->t0 = s->t;
|
||||
s->frames = 0;
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ next_frame:
|
||||
double seconds = tv_diff(curr_time, s->t0);
|
||||
if (seconds >= 5) {
|
||||
float fps = (s->count - stat_count_prev) / seconds;
|
||||
fprintf(stderr, "[testcard2] %d frames in %g seconds = %g FPS\n",
|
||||
log_msg(LOG_LEVEL_INFO, "[testcard2] %d frames in %g seconds = %g FPS\n",
|
||||
(s->count - stat_count_prev), seconds, fps);
|
||||
s->t0 = curr_time;
|
||||
stat_count_prev = s->count;
|
||||
|
||||
@@ -683,7 +683,7 @@ struct video_frame * vidcap_v4l2_grab(void *state, struct audio_frame **audio)
|
||||
double seconds = tv_diff(t, s->t0);
|
||||
if (seconds >= 5) {
|
||||
float fps = s->frames / seconds;
|
||||
fprintf(stderr, "[V4L2 capture] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
log_msg(LOG_LEVEL_INFO, "[V4L2 capture] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
s->t0 = t;
|
||||
s->frames = 0;
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ void display_aggregate_put_audio_frame(void *state, struct audio_frame *frame)
|
||||
|
||||
if (seconds >= 5) {
|
||||
float fps = s->frames / seconds;
|
||||
fprintf(stderr, "[aggregate disp.] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
log_msg(LOG_LEVEL_INFO, "[aggregate disp.] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
s->t0 = s->t;
|
||||
s->frames = 0;
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ void *display_bluefish444_state::playback_loop() throw()
|
||||
double seconds = tv_diff(t, t0);
|
||||
if (seconds >= 5) {
|
||||
float fps = FrameCount / seconds;
|
||||
fprintf(stderr, "[Blue disp] %d frames in %g seconds = %g FPS\n",
|
||||
log_msg(LOG_LEVEL_INFO, "[Blue disp] %d frames in %g seconds = %g FPS\n",
|
||||
FrameCount, seconds, fps);
|
||||
t0 = t;
|
||||
FrameCount = 0;
|
||||
|
||||
@@ -496,7 +496,7 @@ int display_decklink_putf(void *state, struct video_frame *frame, int nonblock)
|
||||
double seconds = tv_diff(tv, s->tv);
|
||||
if (seconds > 5) {
|
||||
double fps = (s->frames - s->frames_last) / seconds;
|
||||
fprintf(stdout, "[Decklink display] %lu frames in %g seconds = %g FPS\n",
|
||||
log_msg(LOG_LEVEL_INFO, "[Decklink display] %lu frames in %g seconds = %g FPS\n",
|
||||
s->frames - s->frames_last, seconds, fps);
|
||||
s->tv = tv;
|
||||
s->frames_last = s->frames;
|
||||
|
||||
@@ -252,7 +252,7 @@ int display_deltacast_putf(void *state, struct video_frame *frame, int nonblock)
|
||||
double seconds = tv_diff(tv, s->tv);
|
||||
if (seconds > 5) {
|
||||
double fps = s->frames / seconds;
|
||||
fprintf(stdout, "[DELTACAST display] %lu frames in %g seconds = %g FPS\n",
|
||||
log_msg(LOG_LEVEL_INFO, "[DELTACAST display] %lu frames in %g seconds = %g FPS\n",
|
||||
s->frames, seconds, fps);
|
||||
s->tv = tv;
|
||||
s->frames = 0;
|
||||
|
||||
@@ -440,7 +440,7 @@ void display_dvs_run(void *arg)
|
||||
|
||||
if (seconds >= 5) {
|
||||
float fps = s->frames / seconds;
|
||||
fprintf(stderr, "[DVS disp.] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
log_msg(LOG_LEVEL_INFO, "[DVS disp.] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
|
||||
s->t0 = s->t;
|
||||
s->frames = 0;
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ void display_quicktime_run(void *arg)
|
||||
double seconds = tv_diff(t, t0);
|
||||
if (seconds >= 5) {
|
||||
float fps = frames / seconds;
|
||||
fprintf(stderr, "[QuickTime disp.] %d frames in %g seconds = %g FPS\n",
|
||||
log_msg(LOG_LEVEL_INFO, "[QuickTime disp.] %d frames in %g seconds = %g FPS\n",
|
||||
frames, seconds, fps);
|
||||
t0 = t;
|
||||
frames = 0;
|
||||
|
||||
@@ -158,7 +158,7 @@ void display_sage_run(void *arg)
|
||||
double seconds = tv_diff(s->t, s->t0);
|
||||
if (seconds >= 5) {
|
||||
float fps = s->frames / seconds;
|
||||
fprintf(stderr, "[SAGE] %d frames in %g seconds = %g FPS\n",
|
||||
log_msg(LOG_LEVEL_INFO, "[SAGE] %d frames in %g seconds = %g FPS\n",
|
||||
s->frames, seconds, fps);
|
||||
s->t0 = s->t;
|
||||
s->frames = 0;
|
||||
|
||||
@@ -382,7 +382,7 @@ free_frame:
|
||||
double seconds = tv_diff(tv, s->tv);
|
||||
if (seconds > 5) {
|
||||
double fps = s->frames / seconds;
|
||||
fprintf(stdout, "[SDL] %d frames in %g seconds = %g FPS\n",
|
||||
log_msg(LOG_LEVEL_INFO, "[SDL] %d frames in %g seconds = %g FPS\n",
|
||||
s->frames, seconds, fps);
|
||||
s->tv = tv;
|
||||
s->frames = 0;
|
||||
|
||||
Reference in New Issue
Block a user