#include <sys/resource.h>
#include "bmusb/bmusb.h"
+#include "bmusb/fake_capture.h"
#include "context.h"
#include "decklink_capture.h"
#include "defs.h"
-#include "fake_capture.h"
#include "flags.h"
#include "video_encoder.h"
#include "pbo_frame_allocator.h"
using namespace movit;
using namespace std;
using namespace std::placeholders;
+using namespace bmusb;
Mixer *global_mixer = nullptr;
bool uses_mlock = false;
movit_texel_subpixel_precision /= 2.0;
resource_pool.reset(new ResourcePool);
- theme.reset(new Theme(global_flags.theme_filename.c_str(), resource_pool.get(), num_cards));
+ theme.reset(new Theme(global_flags.theme_filename, global_flags.theme_dirs, resource_pool.get(), num_cards));
for (unsigned i = 0; i < NUM_OUTPUTS; ++i) {
output_channel[i].parent = this;
output_channel[i].channel = i;
assert(num_fake_cards <= num_cards); // Enforced in flags.cpp.
for ( ; card_index < num_fake_cards; ++card_index) {
- configure_card(card_index, new FakeCapture(card_index), /*is_fake_capture=*/true);
+ configure_card(card_index, new FakeCapture(WIDTH, HEIGHT, FAKE_FPS, OUTPUT_FREQUENCY, card_index), /*is_fake_capture=*/true);
}
if (global_flags.num_fake_cards > 0) {
locut.init(FILTER_HPF, 2);
- // If --flat-audio is given, turn off everything that messes with the sound,
- // except the final makeup gain.
- if (global_flags.flat_audio) {
- set_locut_enabled(false);
- set_gain_staging_auto(false);
- set_limiter_enabled(false);
- set_compressor_enabled(false);
- }
+ set_locut_enabled(global_flags.locut_enabled);
+ set_gain_staging_db(global_flags.initial_gain_staging_db);
+ set_gain_staging_auto(global_flags.gain_staging_auto);
+ set_compressor_enabled(global_flags.compressor_enabled);
+ set_limiter_enabled(global_flags.limiter_enabled);
+ set_final_makeup_gain_auto(global_flags.final_makeup_gain_auto);
// hlen=16 is pretty low quality, but we use quite a bit of CPU otherwise,
// and there's a limit to how important the peak meter is.
double elapsed = now.tv_sec - start.tv_sec +
1e-9 * (now.tv_nsec - start.tv_nsec);
if (frame % 100 == 0) {
- // check our memory usage, to see if we are close to our mlockall()
- // limit (if at all set).
- rusage used;
- if (getrusage(RUSAGE_SELF, &used) == -1) {
- perror("getrusage(RUSAGE_SELF)");
- assert(false);
- }
-
- rlimit limit;
- if (getrlimit(RLIMIT_MEMLOCK, &limit) == -1) {
- perror("getrlimit(RLIMIT_MEMLOCK)");
- assert(false);
- }
-
printf("%d frames (%d dropped) in %.3f seconds = %.1f fps (%.1f ms/frame)",
frame, stats_dropped_frames, elapsed, frame / elapsed,
1e3 * elapsed / frame);
// chain->print_phase_timing();
- if (uses_mlock) {
- // Check our memory usage, to see if we are close to our mlockall()
- // limit (if at all set).
- rusage used;
- if (getrusage(RUSAGE_SELF, &used) == -1) {
- perror("getrusage(RUSAGE_SELF)");
- assert(false);
- }
+ // Check our memory usage, to see if we are close to our mlockall()
+ // limit (if at all set).
+ rusage used;
+ if (getrusage(RUSAGE_SELF, &used) == -1) {
+ perror("getrusage(RUSAGE_SELF)");
+ assert(false);
+ }
+ if (uses_mlock) {
rlimit limit;
if (getrlimit(RLIMIT_MEMLOCK, &limit) == -1) {
perror("getrlimit(RLIMIT_MEMLOCK)");
long(used.ru_maxrss / 1024),
long(limit.rlim_cur / 1048576),
float(100.0 * (used.ru_maxrss * 1024.0) / limit.rlim_cur));
+ } else {
+ printf(", using %ld MB memory (not locked)",
+ long(used.ru_maxrss / 1024));
}
printf("\n");
CaptureCard *card = &cards[card_index];
if (card->capture->get_disconnected()) {
fprintf(stderr, "Card %u went away, replacing with a fake card.\n", card_index);
- configure_card(card_index, new FakeCapture(card_index), /*is_fake_capture=*/true);
+ configure_card(card_index, new FakeCapture(WIDTH, HEIGHT, FAKE_FPS, OUTPUT_FREQUENCY, card_index), /*is_fake_capture=*/true);
card->queue_length_policy.reset(card_index);
card->capture->start_bm_capture();
}