int ret = sqlite3_open(filename.c_str(), &db);
if (ret != SQLITE_OK) {
fprintf(stderr, "%s: %s\n", filename.c_str(), sqlite3_errmsg(db));
- exit(1);
+ abort();
}
// Set an effectively infinite timeout for waiting for write locks;
ret = sqlite3_busy_timeout(db, 3600000);
if (ret != SQLITE_OK) {
fprintf(stderr, "sqlite3_busy_timeout: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
sqlite3_exec(db, R"(
int ret = sqlite3_prepare_v2(db, "SELECT state FROM state", -1, &stmt, 0);
if (ret != SQLITE_OK) {
fprintf(stderr, "SELECT prepare: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
ret = sqlite3_step(stmt);
bool ok = state.ParseFromArray(sqlite3_column_blob(stmt, 0), sqlite3_column_bytes(stmt, 0));
if (!ok) {
fprintf(stderr, "State in database is corrupted!\n");
- exit(1);
+ abort();
}
} else if (ret != SQLITE_DONE) {
fprintf(stderr, "SELECT step: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
ret = sqlite3_finalize(stmt);
if (ret != SQLITE_OK) {
fprintf(stderr, "SELECT finalize: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
return state;
int ret = sqlite3_exec(db, "BEGIN", nullptr, nullptr, nullptr);
if (ret != SQLITE_OK) {
fprintf(stderr, "BEGIN: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
sqlite3_stmt *stmt;
ret = sqlite3_prepare_v2(db, "REPLACE INTO state VALUES (?)", -1, &stmt, 0);
if (ret != SQLITE_OK) {
fprintf(stderr, "REPLACE prepare: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
sqlite3_bind_blob(stmt, 1, serialized.data(), serialized.size(), SQLITE_STATIC);
ret = sqlite3_step(stmt);
if (ret == SQLITE_ROW) {
fprintf(stderr, "REPLACE step: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
ret = sqlite3_finalize(stmt);
if (ret != SQLITE_OK) {
fprintf(stderr, "REPLACE finalize: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
ret = sqlite3_exec(db, "COMMIT", nullptr, nullptr, nullptr);
if (ret != SQLITE_OK) {
fprintf(stderr, "COMMIT: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
}
int ret = sqlite3_prepare_v2(db, "SELECT settings FROM settings", -1, &stmt, 0);
if (ret != SQLITE_OK) {
fprintf(stderr, "SELECT prepare: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
ret = sqlite3_step(stmt);
bool ok = settings.ParseFromArray(sqlite3_column_blob(stmt, 0), sqlite3_column_bytes(stmt, 0));
if (!ok) {
fprintf(stderr, "State in database is corrupted!\n");
- exit(1);
+ abort();
}
} else if (ret != SQLITE_DONE) {
fprintf(stderr, "SELECT step: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
ret = sqlite3_finalize(stmt);
if (ret != SQLITE_OK) {
fprintf(stderr, "SELECT finalize: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
return settings;
int ret = sqlite3_exec(db, "BEGIN", nullptr, nullptr, nullptr);
if (ret != SQLITE_OK) {
fprintf(stderr, "BEGIN: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
sqlite3_stmt *stmt;
ret = sqlite3_prepare_v2(db, "REPLACE INTO settings VALUES (?)", -1, &stmt, 0);
if (ret != SQLITE_OK) {
fprintf(stderr, "REPLACE prepare: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
sqlite3_bind_blob(stmt, 1, serialized.data(), serialized.size(), SQLITE_STATIC);
ret = sqlite3_step(stmt);
if (ret == SQLITE_ROW) {
fprintf(stderr, "REPLACE step: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
ret = sqlite3_finalize(stmt);
if (ret != SQLITE_OK) {
fprintf(stderr, "REPLACE finalize: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
ret = sqlite3_exec(db, "COMMIT", nullptr, nullptr, nullptr);
if (ret != SQLITE_OK) {
fprintf(stderr, "COMMIT: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
}
int ret = sqlite3_prepare_v2(db, "SELECT frames FROM filev2 WHERE filename=? AND size=?", -1, &stmt, 0);
if (ret != SQLITE_OK) {
fprintf(stderr, "SELECT prepare: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
sqlite3_bind_text(stmt, 1, filename.data(), filename.size(), SQLITE_STATIC);
bool ok = file_contents.ParseFromArray(sqlite3_column_blob(stmt, 0), sqlite3_column_bytes(stmt, 0));
if (!ok) {
fprintf(stderr, "Frame list in database is corrupted!\n");
- exit(1);
+ abort();
}
} else if (ret != SQLITE_DONE) {
fprintf(stderr, "SELECT step: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
ret = sqlite3_finalize(stmt);
if (ret != SQLITE_OK) {
fprintf(stderr, "SELECT finalize: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
vector<FrameOnDiskAndStreamIdx> frames;
int ret = sqlite3_exec(db, "BEGIN", nullptr, nullptr, nullptr);
if (ret != SQLITE_OK) {
fprintf(stderr, "BEGIN: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
// Delete any existing instances with this filename.
ret = sqlite3_prepare_v2(db, "REPLACE INTO filev2 (filename, size, frames) VALUES (?, ?, ?)", -1, &stmt, 0);
if (ret != SQLITE_OK) {
fprintf(stderr, "INSERT prepare: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
sqlite3_bind_text(stmt, 1, filename.data(), filename.size(), SQLITE_STATIC);
ret = sqlite3_step(stmt);
if (ret == SQLITE_ROW) {
fprintf(stderr, "REPLACE step: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
ret = sqlite3_finalize(stmt);
if (ret != SQLITE_OK) {
fprintf(stderr, "REPLACE finalize: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
// Commit.
ret = sqlite3_exec(db, "COMMIT", nullptr, nullptr, nullptr);
if (ret != SQLITE_OK) {
fprintf(stderr, "COMMIT: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
}
int ret = sqlite3_exec(db, "BEGIN", nullptr, nullptr, nullptr);
if (ret != SQLITE_OK) {
fprintf(stderr, "BEGIN: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
ret = sqlite3_exec(db, R"(
if (ret != SQLITE_OK) {
fprintf(stderr, "CREATE TEMPORARY TABLE: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
// Insert the new rows.
ret = sqlite3_prepare_v2(db, "INSERT INTO used_filenames (filename) VALUES (?)", -1, &stmt, 0);
if (ret != SQLITE_OK) {
fprintf(stderr, "INSERT prepare: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
for (const string &filename : used_filenames) {
ret = sqlite3_step(stmt);
if (ret == SQLITE_ROW) {
fprintf(stderr, "INSERT step: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
ret = sqlite3_reset(stmt);
if (ret == SQLITE_ROW) {
fprintf(stderr, "INSERT reset: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
}
ret = sqlite3_finalize(stmt);
if (ret != SQLITE_OK) {
fprintf(stderr, "INSERT finalize: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
ret = sqlite3_exec(db, R"(
if (ret != SQLITE_OK) {
fprintf(stderr, "DELETE: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
ret = sqlite3_exec(db, R"(
if (ret != SQLITE_OK) {
fprintf(stderr, "DROP TABLE: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
// Commit.
ret = sqlite3_exec(db, "COMMIT", nullptr, nullptr, nullptr);
if (ret != SQLITE_OK) {
fprintf(stderr, "COMMIT: %s\n", sqlite3_errmsg(db));
- exit(1);
+ abort();
}
}
AVStream *avstream_video = avformat_new_stream(avctx, nullptr);
if (avstream_video == nullptr) {
fprintf(stderr, "avformat_new_stream() failed\n");
- exit(1);
+ abort();
}
avstream_video->time_base = AVRational{ 1, TIMEBASE };
avstream_video->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
global_flags.output_framerate = num;
} else {
fprintf(stderr, "Invalid frame rate given (must be on the form N or N/M)\n");
- exit(1);
+ abort();
}
break;
}
fprintf(stderr, "Unknown option '%s'\n", argv[option_index]);
fprintf(stderr, "\n");
usage();
- exit(1);
+ abort();
}
}
if (global_flags.interpolation_quality < 0 || global_flags.interpolation_quality > 4) {
fprintf(stderr, "Interpolation quality must be 0, 1, 2, 3 or 4.\n");
usage();
- exit(1);
+ abort();
}
if (global_flags.cue_in_point_padding_seconds < 0.0 ||
global_flags.cue_out_point_padding_seconds < 0.0) {
fprintf(stderr, "Cue point padding cannot be negative.\n");
usage();
- exit(1);
+ abort();
}
}
}
fprintf(stderr, "Failed to compile shader:\n%s\n", src_with_lines.c_str());
- exit(1);
+ abort();
}
return obj;
GLchar error_log[1024] = { 0 };
glGetProgramInfoLog(program, 1024, nullptr, error_log);
fprintf(stderr, "Error linking program: %s\n", error_log);
- exit(1);
+ abort();
}
return program;
}
SDL_Surface *surf = IMG_Load(filename);
if (surf == nullptr) {
fprintf(stderr, "IMG_Load(%s): %s\n", filename, IMG_GetError());
- exit(1);
+ abort();
}
// For whatever reason, SDL doesn't support converting to YUV surfaces
SDL_Surface *rgb_surf = SDL_ConvertSurfaceFormat(surf, SDL_PIXELFORMAT_RGBA32, /*flags=*/0);
if (rgb_surf == nullptr) {
fprintf(stderr, "SDL_ConvertSurfaceFormat(%s): %s\n", filename, SDL_GetError());
- exit(1);
+ abort();
}
SDL_FreeSurface(surf);
if (width1 != width2 || height1 != height2) {
fprintf(stderr, "Image dimensions don't match (%dx%d versus %dx%d)\n",
width1, height1, width2, height2);
- exit(1);
+ abort();
}
// Move them into an array texture, since that's how the rest of the code
if (width != width1 || height != height1) {
fprintf(stderr, "%s: Image dimensions don't match (%dx%d versus %dx%d)\n",
filename0, width, height, width1, height1);
- exit(1);
+ abort();
}
glCopyImageSubData(tex0, GL_TEXTURE_2D, 0, 0, 0, 0, image_tex, GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, width1, height1, 1);
glDeleteTextures(1, &tex0);
if (width != width1 || height != height1) {
fprintf(stderr, "%s: Image dimensions don't match (%dx%d versus %dx%d)\n",
filename1, width, height, width1, height1);
- exit(1);
+ abort();
}
glCopyImageSubData(tex1, GL_TEXTURE_2D, 0, 0, 0, 0, image_tex, GL_TEXTURE_2D_ARRAY, 0, 0, 0, 1, width1, height1, 1);
glDeleteTextures(1, &tex1);
if (width1 != width2 || height1 != height2) {
fprintf(stderr, "Image dimensions don't match (%dx%d versus %dx%d)\n",
width1, height1, width2, height2);
- exit(1);
+ abort();
}
// Move them into an array texture, since that's how the rest of the code
break;
default:
fprintf(stderr, "Unknown option '%s'\n", argv[option_index]);
- exit(1);
+ abort();
};
}
if (SDL_Init(SDL_INIT_EVERYTHING) == -1) {
fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError());
- exit(1);
+ abort();
}
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
fd = open(filename.c_str(), O_RDONLY);
if (fd == -1) {
perror(filename.c_str());
- exit(1);
+ abort();
}
// We want readahead. (Ignore errors.)
int ret = pread(fd, &str[offset], frame.size - offset, frame.offset + offset);
if (ret <= 0) {
perror("pread");
- exit(1);
+ abort();
}
offset += ret;
dinfo.comp_info[0].h_samp_factor, dinfo.comp_info[0].v_samp_factor,
dinfo.comp_info[1].h_samp_factor, dinfo.comp_info[1].v_samp_factor,
dinfo.comp_info[2].h_samp_factor, dinfo.comp_info[2].v_samp_factor);
- exit(1);
+ abort();
}
dinfo.raw_data_out = true;
FILE *fp = fopen(filename, "wb");
if (fp == nullptr) {
perror(filename);
- exit(1);
+ abort();
}
lock_guard<mutex> lock(frame_mu);
string serialized;
if (!hdr.SerializeToString(&serialized)) {
fprintf(stderr, "Frame header serialization failed.\n");
- exit(1);
+ abort();
}
uint32_t len = htonl(serialized.size());
if (fwrite(frame_magic, frame_magic_len, 1, file.fp) != 1) {
perror("fwrite");
- exit(1);
+ abort();
}
if (fwrite(&len, sizeof(len), 1, file.fp) != 1) {
perror("fwrite");
- exit(1);
+ abort();
}
if (fwrite(serialized.data(), serialized.size(), 1, file.fp) != 1) {
perror("fwrite");
- exit(1);
+ abort();
}
off_t offset = ftell(file.fp);
if (fwrite(data, size, 1, file.fp) != 1) {
perror("fwrite");
- exit(1);
+ abort();
}
fflush(file.fp); // No fsync(), though. We can accept losing a few frames.
global_disk_space_estimator->report_write(filename, 8 + sizeof(len) + serialized.size() + size, pts);
// Start a new file next time.
if (fclose(file.fp) != 0) {
perror("fclose");
- exit(1);
+ abort();
}
open_frame_files.erase(stream_idx);
global_flags.stream_source = argv[optind];
} else {
usage();
- exit(1);
+ abort();
}
string frame_dir = global_flags.working_directory + "/frames";
fprintf(stderr, "%s does not exist, creating it.\n", frame_dir.c_str());
} else if (errno != EEXIST) {
perror(global_flags.working_directory.c_str());
- exit(1);
+ abort();
}
avformat_network_init();
global_share_widget = new QGLWidget();
if (!global_share_widget->isValid()) {
fprintf(stderr, "Failed to initialize OpenGL. Futatabi needs at least OpenGL 4.5 to function properly.\n");
- exit(1);
+ abort();
}
// Initialize Movit.
QOpenGLContext *context = create_context(surface);
if (!make_current(context, surface)) {
printf("oops\n");
- exit(1);
+ abort();
}
CHECK(movit::init_movit(MOVIT_SHADER_DIR, movit::MOVIT_DEBUG_OFF));
delete_context(context);
struct stat st;
if (stat(filename, &st) == -1) {
perror(filename);
- exit(1);
+ abort();
}
vector<DB::FrameOnDiskAndStreamIdx> all_frames = db->load_frame_file(basename, st.st_size, filename_idx);
FILE *fp = fopen(filename, "rb");
if (fp == nullptr) {
perror(filename);
- exit(1);
+ abort();
}
size_t magic_offset = 0;
if (de == nullptr) {
if (errno != 0) {
perror("readdir");
- exit(1);
+ abort();
}
break;
}
}
if (progress.wasCanceled()) {
- exit(1);
+ abort();
}
}
closedir(dir);
load_frame_file(frame_filenames[i].c_str(), frame_basenames[i], i, &db);
progress.setValue(i + 3);
if (progress.wasCanceled()) {
- exit(1);
+ abort();
}
}
if (!load_midi_mapping_from_file(global_flags.midi_mapping_filename, &midi_mapping)) {
fprintf(stderr, "Couldn't load MIDI mapping '%s'; exiting.\n",
global_flags.midi_mapping_filename.c_str());
- exit(1);
+ abort();
}
midi_mapper.set_midi_mapping(midi_mapping);
}
QOpenGLContext *context = create_context(surface);
if (!make_current(context, surface)) {
printf("oops\n");
- exit(1);
+ abort();
}
check_error();
#define CHECK_VASTATUS(va_status, func) \
if (va_status != VA_STATUS_SUCCESS) { \
fprintf(stderr, "%s:%d (%s) failed with %d\n", __func__, __LINE__, func, va_status); \
- exit(1); \
+ abort(); \
}
#define CHECK_VASTATUS_RET(va_status, func) \
bool ok = make_current(context, surface);
if (!ok) {
fprintf(stderr, "Video stream couldn't get an OpenGL context\n");
- exit(1);
+ abort();
}
while (!should_quit) {
{
if (argc != 3) {
fprintf(stderr, "Usage: ./vis input.flo out.ppm\n");
- exit(1);
+ abort();
}
Flow flow = read_flow(argv[1]);
{
if (err < 0) {
fprintf(stderr, "%s: %s\n", func_name, snd_strerror(err));
- exit(1);
+ abort();
}
}
ret = 0;
} else if (ret < 0) {
fprintf(stderr, "error: snd_pcm_writei() returned '%s'\n", snd_strerror(ret));
- exit(1);
+ abort();
} else if (ret > 0) {
buffer.erase(buffer.begin(), buffer.begin() + ret * num_channels);
}
const uint64_t one = 1;
if (write(should_quit_fd, &one, sizeof(one)) != sizeof(one)) {
perror("write(should_quit_fd)");
- exit(1);
+ abort();
}
inotify_thread.join();
context = create_context(surface);
if (!make_current(context, surface)) {
printf("oops\n");
- exit(1);
+ abort();
}
grab_timer.setSingleShot(true);
if (!make_current(context, surface)) {
printf("oops\n");
- exit(1);
+ abort();
}
glDeleteBuffers(1, &pbo);
check_error();
if (!make_current(context, surface)) {
printf("oops\n");
- exit(1);
+ abort();
}
Mixer::DisplayFrame frame;
AVCodec *codec = avcodec_find_encoder_by_name(codec_name.c_str());
if (codec == nullptr) {
fprintf(stderr, "ERROR: Could not find codec '%s'\n", codec_name.c_str());
- exit(1);
+ abort();
}
ctx = avcodec_alloc_context3(codec);
}
if (avcodec_open2(ctx, codec, NULL) < 0) {
fprintf(stderr, "Could not open codec '%s'\n", codec_name.c_str());
- exit(1);
+ abort();
}
resampler = swr_alloc_set_opts(nullptr,
/*log_ctx=*/nullptr);
if (resampler == nullptr) {
fprintf(stderr, "Allocating resampler failed.\n");
- exit(1);
+ abort();
}
if (swr_init(resampler) < 0) {
fprintf(stderr, "Could not open resample context.\n");
- exit(1);
+ abort();
}
audio_frame = av_frame_alloc();
if (av_samples_alloc(audio_frame->data, nullptr, 2, num_samples, ctx->sample_fmt, 0) < 0) {
fprintf(stderr, "Could not allocate %zu samples.\n", num_samples);
- exit(1);
+ abort();
}
if (swr_convert(resampler, audio_frame->data, num_samples, reinterpret_cast<const uint8_t **>(&audio), num_samples) < 0) {
fprintf(stderr, "Audio conversion failed.\n");
- exit(1);
+ abort();
}
int err = avcodec_send_frame(ctx, audio_frame);
if (err < 0) {
fprintf(stderr, "avcodec_send_frame() failed with error %d\n", err);
- exit(1);
+ abort();
}
for ( ;; ) { // Termination condition within loop.
break;
} else {
fprintf(stderr, "avcodec_receive_frame() failed with error %d\n", err);
- exit(1);
+ abort();
}
}
break;
} else {
fprintf(stderr, "avcodec_receive_frame() failed with error %d\n", err);
- exit(1);
+ abort();
}
}
}
&new_input_mapping)) {
fprintf(stderr, "Failed to load input mapping from '%s', exiting.\n",
global_flags.input_mapping_filename.c_str());
- exit(1);
+ abort();
}
set_input_mapping(new_input_mapping);
} else {
GLchar error_log[1024] = {0};
glGetProgramInfoLog(v210_program_num, 1024, nullptr, error_log);
fprintf(stderr, "Error linking program: %s\n", error_log);
- exit(1);
+ abort();
}
v210_in_y_pos = glGetUniformLocation(v210_program_num, "in_y");
if (card->QueryInterface(IID_IDeckLinkInput, (void**)&input) != S_OK) {
fprintf(stderr, "Card %d has no inputs\n", card_index);
- exit(1);
+ abort();
}
IDeckLinkAttributes *attr;
if (card->QueryInterface(IID_IDeckLinkAttributes, (void**)&attr) != S_OK) {
fprintf(stderr, "Card %d has no attributes\n", card_index);
- exit(1);
+ abort();
}
// Get the list of available video inputs.
int64_t video_input_mask;
if (attr->GetInt(BMDDeckLinkVideoInputConnections, &video_input_mask) != S_OK) {
fprintf(stderr, "Failed to enumerate video inputs for card %d\n", card_index);
- exit(1);
+ abort();
}
const vector<pair<BMDVideoConnection, string>> video_input_types = {
{ bmdVideoConnectionSDI, "SDI" },
int64_t audio_input_mask;
if (attr->GetInt(BMDDeckLinkAudioInputConnections, &audio_input_mask) != S_OK) {
fprintf(stderr, "Failed to enumerate audio inputs for card %d\n", card_index);
- exit(1);
+ abort();
}
const vector<pair<BMDAudioConnection, string>> audio_input_types = {
{ bmdAudioConnectionEmbedded, "Embedded" },
/* Set up the video and audio sources. */
if (card->QueryInterface(IID_IDeckLinkConfiguration, (void**)&config) != S_OK) {
fprintf(stderr, "Failed to get configuration interface for card %d\n", card_index);
- exit(1);
+ abort();
}
BMDVideoConnection connection = pick_default_video_connection(card, BMDDeckLinkVideoInputConnections, card_index);
IDeckLinkDisplayModeIterator *mode_it;
if (input->GetDisplayModeIterator(&mode_it) != S_OK) {
fprintf(stderr, "Failed to enumerate display modes for card %d\n", card_index);
- exit(1);
+ abort();
}
video_modes = summarize_video_modes(mode_it, card_index);
}
if (display_mode->GetFrameRate(&frame_duration, &time_scale) != S_OK) {
fprintf(stderr, "Could not get new frame rate\n");
- exit(1);
+ abort();
}
field_dominance = display_mode->GetFieldDominance();
return S_OK;
}
if (input->EnableVideoInput(current_video_mode, pixel_format_to_bmd(current_pixel_format), supports_autodetect ? bmdVideoInputEnableFormatDetection : 0) != S_OK) {
fprintf(stderr, "Failed to set video mode 0x%04x for card %d\n", current_video_mode, card_index);
- exit(1);
+ abort();
}
if (input->EnableAudioInput(48000, bmdAudioSampleType32bitInteger, 2) != S_OK) {
fprintf(stderr, "Failed to enable audio input for card %d\n", card_index);
- exit(1);
+ abort();
}
if (input->StartStreams() != S_OK) {
fprintf(stderr, "StartStreams failed\n");
- exit(1);
+ abort();
}
running = true;
}
HRESULT result = input->StopStreams();
if (result != S_OK) {
fprintf(stderr, "StopStreams failed with error 0x%x\n", result);
- exit(1);
+ abort();
}
// We could call DisableVideoInput() and DisableAudioInput() here,
if (running) {
if (input->PauseStreams() != S_OK) {
fprintf(stderr, "PauseStreams failed\n");
- exit(1);
+ abort();
}
if (input->FlushStreams() != S_OK) {
fprintf(stderr, "FlushStreams failed\n");
- exit(1);
+ abort();
}
}
if (running) {
if (input->StartStreams() != S_OK) {
fprintf(stderr, "StartStreams failed\n");
- exit(1);
+ abort();
}
}
}
IDeckLinkDisplayMode *display_mode;
if (input->DoesSupportVideoMode(video_mode_id, pixel_format_to_bmd(current_pixel_format), /*flags=*/0, &support, &display_mode)) {
fprintf(stderr, "Failed to query display mode for card %d\n", card_index);
- exit(1);
+ abort();
}
if (support == bmdDisplayModeNotSupported) {
fprintf(stderr, "Card %d does not support display mode\n", card_index);
- exit(1);
+ abort();
}
if (display_mode->GetFrameRate(&frame_duration, &time_scale) != S_OK) {
fprintf(stderr, "Could not get frame rate for card %d\n", card_index);
- exit(1);
+ abort();
}
field_dominance = display_mode->GetFieldDominance();
if (running) {
if (input->EnableVideoInput(video_mode_id, pixel_format_to_bmd(current_pixel_format), supports_autodetect ? bmdVideoInputEnableFormatDetection : 0) != S_OK) {
fprintf(stderr, "Failed to set video mode 0x%04x for card %d\n", video_mode_id, card_index);
- exit(1);
+ abort();
}
}
{
if (config->SetInt(bmdDeckLinkConfigVideoInputConnection, video_input_id) != S_OK) {
fprintf(stderr, "Failed to set video input connection for card %d\n", card_index);
- exit(1);
+ abort();
}
current_video_input = video_input_id;
{
if (config->SetInt(bmdDeckLinkConfigAudioInputConnection, audio_input_id) != S_OK) {
fprintf(stderr, "Failed to set audio input connection for card %d\n", card_index);
- exit(1);
+ abort();
}
current_audio_input = audio_input_id;
if (video_modes.empty()) {
fprintf(stderr, "ERROR: No matching output modes for %dx%d found\n", width, height);
- exit(1);
+ abort();
}
should_quit.unquit();
IDeckLinkConfiguration *config = nullptr;
if (output->QueryInterface(IID_IDeckLinkConfiguration, (void**)&config) != S_OK) {
fprintf(stderr, "Failed to get configuration interface for output card\n");
- exit(1);
+ abort();
}
if (config->SetFlag(bmdDeckLinkConfigLowLatencyVideoOutput, true) != S_OK) {
fprintf(stderr, "Failed to set low latency output\n");
- exit(1);
+ abort();
}
if (config->SetInt(bmdDeckLinkConfigVideoOutputConnection, video_connection) != S_OK) {
fprintf(stderr, "Failed to set video output connection for card %u\n", card_index);
- exit(1);
+ abort();
}
if (config->SetFlag(bmdDeckLinkConfigUse1080pNotPsF, true) != S_OK) {
fprintf(stderr, "Failed to set PsF flag for card\n");
- exit(1);
+ abort();
}
if (config->SetFlag(bmdDeckLinkConfigSMPTELevelAOutput, true) != S_OK) {
// This affects at least some no-name SDI->HDMI converters.
if (output->DoesSupportVideoMode(mode, pixel_format, bmdVideoOutputFlagDefault,
&support, &display_mode) != S_OK) {
fprintf(stderr, "Couldn't ask for format support\n");
- exit(1);
+ abort();
}
if (support == bmdDisplayModeNotSupported) {
fprintf(stderr, "Requested display mode not supported\n");
- exit(1);
+ abort();
}
current_mode_flags = display_mode->GetFlags();
BMDTimeScale time_scale;
if (display_mode->GetFrameRate(&time_value, &time_scale) != S_OK) {
fprintf(stderr, "Couldn't get frame rate\n");
- exit(1);
+ abort();
}
metric_decklink_output_width_pixels = width;
HRESULT result = output->EnableVideoOutput(mode, bmdVideoOutputFlagDefault);
if (result != S_OK) {
fprintf(stderr, "Couldn't enable output with error 0x%x\n", result);
- exit(1);
+ abort();
}
if (output->SetScheduledFrameCompletionCallback(this) != S_OK) {
fprintf(stderr, "Couldn't set callback\n");
- exit(1);
+ abort();
}
assert(OUTPUT_FREQUENCY == 48000);
if (output->EnableAudioOutput(bmdAudioSampleRate48kHz, bmdAudioSampleType32bitInteger, 2, bmdAudioOutputStreamTimestamped) != S_OK) {
fprintf(stderr, "Couldn't enable audio output\n");
- exit(1);
+ abort();
}
if (output->BeginAudioPreroll() != S_OK) {
fprintf(stderr, "Couldn't begin audio preroll\n");
- exit(1);
+ abort();
}
present_thread = thread([this]{
if (!make_current(context, this->surface)) {
printf("display=%p surface=%p context=%p curr=%p err=%d\n", eglGetCurrentDisplay(), this->surface, context, eglGetCurrentContext(),
eglGetError());
- exit(1);
+ abort();
}
present_thread_func();
delete_context(context);
if (!playback_started) {
if (output->EndAudioPreroll() != S_OK) {
fprintf(stderr, "Could not end audio preroll\n");
- exit(1); // TODO
+ abort(); // TODO
}
if (output->StartScheduledPlayback(base_pts, TIMEBASE, 1.0) != S_OK) {
fprintf(stderr, "Could not start playback\n");
- exit(1); // TODO
+ abort(); // TODO
}
playback_started = true;
}
BMDTimeValue frame_rate_den;
if (mode_ptr->GetFrameRate(&frame_rate_den, &frame_rate_num) != S_OK) {
fprintf(stderr, "Could not get frame rate for mode '%s' on card %d\n", mode.name.c_str(), card_index);
- exit(1);
+ abort();
}
mode.frame_rate_num = frame_rate_num;
mode.frame_rate_den = frame_rate_den;
IDeckLinkAttributes *attr;
if (card->QueryInterface(IID_IDeckLinkAttributes, (void**)&attr) != S_OK) {
fprintf(stderr, "Card %u has no attributes\n", card_index);
- exit(1);
+ abort();
}
int64_t connection_mask;
} else {
fprintf(stderr, "Failed to enumerate video outputs for card %u\n", card_index);
}
- exit(1);
+ abort();
}
attr->Release();
if (connection_mask == 0) {
} else {
fprintf(stderr, "Card %u has no output connections\n", card_index);
}
- exit(1);
+ abort();
}
if ((connection_mask & bmdVideoConnectionHDMI) &&
if (resampler == nullptr) {
fprintf(stderr, "Allocating resampler failed.\n");
- exit(1);
+ abort();
}
if (swr_init(resampler) < 0) {
fprintf(stderr, "Could not open resample context.\n");
- exit(1);
+ abort();
}
last_src_format = AVSampleFormat(audio_avframe->format);
const_cast<const uint8_t **>(audio_avframe->data), audio_avframe->nb_samples);
if (out_samples < 0) {
fprintf(stderr, "Audio conversion failed.\n");
- exit(1);
+ abort();
}
audio_frame->len += out_samples * bytes_per_sample;
if (pathname.empty()) {
fprintf(stderr, "Couldn't find %s in any directory in --theme-dirs, exiting.\n",
filename.c_str());
- exit(1);
+ abort();
}
return pathname;
}
}
if (range_end < range_begin) {
fprintf(stderr, "ERROR: Invalid range %u-%u in --mjpeg-export-cards=\n", range_begin, range_end);
- exit(1);
+ abort();
}
if (range_end >= unsigned(global_flags.num_cards)) {
// There are situations where we could possibly want to
// require more functionality the the JPEG encoder.
fprintf(stderr, "ERROR: Asked for (zero-indexed) card %u in --mjpeg-export-cards=, but there are only %u cards\n",
range_end, global_flags.num_cards);
- exit(1);
+ abort();
}
for (unsigned card_idx = range_begin; card_idx <= range_end; ++card_idx) {
if (ret.count(card_idx)) {
fprintf(stderr, "ERROR: Card %u was given twice in --mjpeg-export-cards=\n", card_idx);
- exit(1);
+ abort();
}
ret[card_idx] = stream_idx++;
}
char *ptr = strchr(optarg, ',');
if (ptr == nullptr) {
fprintf(stderr, "ERROR: Invalid argument '%s' to --map-signal (needs a signal and a card number, separated by comma)\n", optarg);
- exit(1);
+ abort();
}
*ptr = '\0';
const int signal_num = atoi(optarg);
if (global_flags.default_stream_mapping.count(signal_num)) {
fprintf(stderr, "ERROR: Signal %d already mapped to card %d\n",
signal_num, global_flags.default_stream_mapping[signal_num]);
- exit(1);
+ abort();
}
global_flags.default_stream_mapping[signal_num] = card_num;
break;
char *ptr = strchr(optarg, ',');
if (ptr == nullptr) {
fprintf(stderr, "ERROR: Invalid argument '%s' to --input-ycbcr-interpretation (needs a card and an interpretation, separated by comma)\n", optarg);
- exit(1);
+ abort();
}
*ptr = '\0';
const int card_num = atoi(optarg);
if (card_num < 0 || card_num >= MAX_VIDEO_CARDS) {
fprintf(stderr, "ERROR: Invalid card number %d\n", card_num);
- exit(1);
+ abort();
}
YCbCrInterpretation interpretation;
interpretation.full_range = false;
} else {
fprintf(stderr, "ERROR: Invalid Y'CbCr range '%s' (must be “full” or “limited”)\n", range);
- exit(1);
+ abort();
}
}
interpretation.ycbcr_coefficients_auto = true;
if (interpretation.full_range) {
fprintf(stderr, "ERROR: Cannot use “auto” Y'CbCr coefficients with full range\n");
- exit(1);
+ abort();
}
} else {
fprintf(stderr, "ERROR: Invalid Y'CbCr coefficients '%s' (must be “rec601”, “rec709” or “auto”)\n", interpretation_str);
- exit(1);
+ abort();
}
global_flags.ycbcr_interpretation[card_num] = interpretation;
break;
case OPTION_MJPEG_EXPORT_CARDS: {
if (card_to_mjpeg_stream_export_set) {
fprintf(stderr, "ERROR: --mjpeg-export-cards given twice\n");
- exit(1);
+ abort();
}
global_flags.card_to_mjpeg_stream_export = parse_mjpeg_export_cards(optarg);
card_to_mjpeg_stream_export_set = true;
fprintf(stderr, "Unknown option '%s'\n", argv[option_index]);
fprintf(stderr, "\n");
usage(program);
- exit(1);
+ abort();
}
}
if (global_flags.uncompressed_video_to_http &&
global_flags.x264_video_to_http) {
fprintf(stderr, "ERROR: --http-uncompressed-video and --http-x264-video are mutually incompatible\n");
- exit(1);
+ abort();
}
if (global_flags.num_cards <= 0) {
fprintf(stderr, "ERROR: --num-cards must be at least 1\n");
- exit(1);
+ abort();
}
if (global_flags.output_card < -1 ||
global_flags.output_card >= global_flags.num_cards) {
fprintf(stderr, "ERROR: --output-card points to a nonexistant card\n");
- exit(1);
+ abort();
}
if (!global_flags.transcode_audio && global_flags.stream_audio_codec_name.empty()) {
fprintf(stderr, "ERROR: If not transcoding audio, you must specify ahead-of-time what audio codec is in use\n");
fprintf(stderr, " (using --http-audio-codec).\n");
- exit(1);
+ abort();
}
if (global_flags.x264_speedcontrol) {
if (!global_flags.x264_preset.empty() && global_flags.x264_preset != "faster") {
if (global_flags.width <= 0 || (global_flags.width % 8) != 0 ||
global_flags.height <= 0 || (global_flags.height % 8) != 0) {
fprintf(stderr, "ERROR: --width and --height must be positive integers divisible by 8\n");
- exit(1);
+ abort();
}
for (pair<int, int> mapping : global_flags.default_stream_mapping) {
if (mapping.second >= global_flags.num_cards) {
fprintf(stderr, "ERROR: Signal %d mapped to card %d, which doesn't exist (try adjusting --num-cards)\n",
mapping.first, mapping.second);
- exit(1);
+ abort();
}
}
global_flags.ycbcr_auto_coefficients = false;
} else {
fprintf(stderr, "ERROR: --output-ycbcr-coefficients must be “rec601”, “rec709” or “auto”\n");
- exit(1);
+ abort();
}
if (global_flags.output_buffer_frames < 0.0f) {
// Actually, even zero probably won't make sense; there is some internal
// delay to the card.
fprintf(stderr, "ERROR: --output-buffer-frames can't be negative.\n");
- exit(1);
+ abort();
}
if (global_flags.output_slop_frames < 0.0f) {
fprintf(stderr, "ERROR: --output-slop-frames can't be negative.\n");
- exit(1);
+ abort();
}
if (global_flags.max_input_queue_frames < 1) {
fprintf(stderr, "ERROR: --max-input-queue-frames must be at least 1.\n");
- exit(1);
+ abort();
}
if (global_flags.max_input_queue_frames > 10) {
fprintf(stderr, "WARNING: --max-input-queue-frames has little effect over 10.\n");
if (!isinf(global_flags.x264_crf)) { // CRF mode is selected.
if (global_flags.x264_bitrate != -1) {
fprintf(stderr, "ERROR: --x264-bitrate and --x264-crf are mutually incompatible.\n");
- exit(1);
+ abort();
}
if (global_flags.x264_vbv_max_bitrate != -1 && global_flags.x264_vbv_buffer_size != -1) {
fprintf(stderr, "WARNING: VBV settings are ignored with --x264-crf.\n");
{
if (current_image == nullptr) { // Could happen even though search_for_file() returned.
fprintf(stderr, "Couldn't load image, exiting.\n");
- exit(1);
+ abort();
}
set_width(current_image->width);
set_height(current_image->height);
parse_flags(PROGRAM_KAERU, argc, argv);
if (optind + 1 != argc) {
usage(PROGRAM_KAERU);
- exit(1);
+ abort();
}
global_flags.num_cards = 1; // For latency metrics.
global_share_widget = new QGLWidget();
if (!global_share_widget->isValid()) {
fprintf(stderr, "Failed to initialize OpenGL. Nageru needs at least OpenGL 3.1 to function properly.\n");
- exit(1);
+ abort();
}
MainWindow mainWindow;
if (!load_midi_mapping_from_file(global_flags.midi_mapping_filename, &midi_mapping)) {
fprintf(stderr, "Couldn't load MIDI mapping '%s'; exiting.\n",
global_flags.midi_mapping_filename.c_str());
- ::exit(1);
+ ::abort();
}
midi_mapper.set_midi_mapping(midi_mapping);
}
for (unsigned video_card_index = 0; video_card_index < video_inputs.size(); ++card_index, ++video_card_index) {
if (card_index >= MAX_VIDEO_CARDS) {
fprintf(stderr, "ERROR: Not enough card slots available for the videos the theme requested.\n");
- exit(1);
+ abort();
}
configure_card(card_index, video_inputs[video_card_index], CardType::FFMPEG_INPUT, /*output=*/nullptr);
video_inputs[video_card_index]->set_card_index(card_index);
for (unsigned html_card_index = 0; html_card_index < html_inputs.size(); ++card_index, ++html_card_index) {
if (card_index >= MAX_VIDEO_CARDS) {
fprintf(stderr, "ERROR: Not enough card slots available for the HTML inputs the theme requested.\n");
- exit(1);
+ abort();
}
configure_card(card_index, html_inputs[html_card_index], CardType::CEF_INPUT, /*output=*/nullptr);
html_inputs[html_card_index]->set_card_index(card_index);
if (!v210Converter::has_hardware_support()) {
fprintf(stderr, "ERROR: --ten-bit-input requires support for OpenGL compute shaders\n");
fprintf(stderr, " (OpenGL 4.3, or GL_ARB_compute_shader + GL_ARB_shader_image_load_store).\n");
- exit(1);
+ abort();
}
v210_converter.reset(new v210Converter());
if (!v210Converter::has_hardware_support()) {
fprintf(stderr, "ERROR: --ten-bit-output requires support for OpenGL compute shaders\n");
fprintf(stderr, " (OpenGL 4.3, or GL_ARB_compute_shader + GL_ARB_shader_image_load_store).\n");
- exit(1);
+ abort();
}
}
QOpenGLContext *context = create_context(mixer_surface);
if (!make_current(context, mixer_surface)) {
printf("oops\n");
- exit(1);
+ abort();
}
// Start the actual capture. (We don't want to do it before we're actually ready
AVStream *stream = avformat_new_stream(avctx.get(), nullptr);
if (stream == nullptr) {
fprintf(stderr, "avformat_new_stream() failed\n");
- exit(1);
+ abort();
}
stream->time_base = AVRational{ 1, TIMEBASE };
stream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
}
if (avformat_write_header(avctx.get(), &options) < 0) {
fprintf(stderr, "avformat_write_header() failed\n");
- exit(1);
+ abort();
}
// Initialize VA-API.
if (av_write_frame(avctx.get(), &pkt) < 0) {
fprintf(stderr, "av_write_frame() failed\n");
- exit(1);
+ abort();
}
}
#define CHECK_VASTATUS(va_status, func) \
if (va_status != VA_STATUS_SUCCESS) { \
fprintf(stderr, "%s:%d (%s) failed with %d\n", __func__, __LINE__, func, va_status); \
- exit(1); \
+ abort(); \
}
#undef BUFFER_OFFSET
va_dpy = try_open_va(va_display, &h264_profile, &error);
if (va_dpy == nullptr) {
fprintf(stderr, "error: %s\n", error.c_str());
- exit(1);
+ abort();
}
if (!va_dpy->can_use_zerocopy) {
use_zerocopy = false;
/* check the interested configattrib */
if ((attrib[VAConfigAttribRTFormat].value & VA_RT_FORMAT_YUV420) == 0) {
printf("Not find desired YUV420 RT format\n");
- exit(1);
+ abort();
} else {
config_attrib[config_attrib_num].type = VAConfigAttribRTFormat;
config_attrib[config_attrib_num].value = VA_RT_FORMAT_YUV420;
if (attrib[VAConfigAttribRateControl].value != VA_ATTRIB_NOT_SUPPORTED) {
if (!(attrib[VAConfigAttribRateControl].value & VA_RC_CQP)) {
fprintf(stderr, "ERROR: VA-API encoder does not support CQP mode.\n");
- exit(1);
+ abort();
}
config_attrib[config_attrib_num].type = VAConfigAttribRateControl;
if (!make_current(context, this->surface)) {
printf("display=%p surface=%p context=%p curr=%p err=%d\n", eglGetCurrentDisplay(), this->surface, context, eglGetCurrentContext(),
eglGetError());
- exit(1);
+ abort();
}
encode_thread_func();
delete_context(context);
if (ret < 0) {
char tmp[AV_ERROR_MAX_STRING_SIZE];
fprintf(stderr, "%s: avio_open2() failed: %s\n", filename.c_str(), av_make_error_string(tmp, sizeof(tmp), ret));
- exit(1);
+ abort();
}
string video_extradata; // FIXME: See other comment about global headers.
fprintf(stderr, "to expose Quick Sync. Alternatively, you can use --record-x264-video\n");
fprintf(stderr, "to use software instead of hardware H.264 encoding, at the expense\n");
fprintf(stderr, "of increased CPU usage and possibly bit rate.\n");
- exit(1);
+ abort();
}
#else
fprintf(stderr, "This version of Nageru has been compiled without CEF support.\n");
fprintf(stderr, "HTMLInput is not available.\n");
- exit(1);
+ abort();
#endif
}
if (lua_pcall(L, 0, 1, 0) != 0) {
fprintf(stderr, "error running function `num_channels': %s\n", lua_tostring(L, -1));
- exit(1);
+ abort();
}
int num_channels = luaL_checknumber(L, 1);
for (const string &error : errors) {
fprintf(stderr, "%s\n", error.c_str());
}
- exit(1);
+ abort();
}
assert(lua_gettop(L) == 0);
luaL_unref(L, LUA_REGISTRYINDEX, theme_code_ref);
if (lua_pcall(L, 0, 0, 0)) {
fprintf(stderr, "Error when running %s: %s\n", path.c_str(), lua_tostring(L, -1));
- exit(1);
+ abort();
}
assert(lua_gettop(L) == 0);
if (lua_pcall(L, 5, 2, 0) != 0) {
fprintf(stderr, "error running function `get_chain': %s\n", lua_tostring(L, -1));
- exit(1);
+ abort();
}
EffectChain *effect_chain = (EffectChain *)luaL_testudata(L, -2, "EffectChain");
if (effect_chain == nullptr) {
fprintf(stderr, "get_chain() for chain number %d did not return an EffectChain\n",
num);
- exit(1);
+ abort();
}
chain.chain = effect_chain;
if (!lua_isfunction(L, -1)) {
fprintf(stderr, "Argument #-1 should be a function\n");
- exit(1);
+ abort();
}
lua_pushvalue(L, -1);
shared_ptr<LuaRefWithDeleter> funcref(new LuaRefWithDeleter(&m, L, luaL_ref(L, LUA_REGISTRYINDEX)));
lua_rawgeti(L, LUA_REGISTRYINDEX, funcref->get());
if (lua_pcall(L, 0, 0, 0) != 0) {
fprintf(stderr, "error running chain setup callback: %s\n", lua_tostring(L, -1));
- exit(1);
+ abort();
}
assert(lua_gettop(L) == 0);
lua_pushnumber(L, channel);
if (lua_pcall(L, 1, 1, 0) != 0) {
fprintf(stderr, "error running function `channel_name': %s\n", lua_tostring(L, -1));
- exit(1);
+ abort();
}
const char *ret = lua_tostring(L, -1);
if (ret == nullptr) {
fprintf(stderr, "function `channel_name' returned nil for channel %d\n", channel);
- exit(1);
+ abort();
}
string retstr = ret;
lua_pushnumber(L, channel);
if (lua_pcall(L, 1, 1, 0) != 0) {
fprintf(stderr, "error running function `channel_signal': %s\n", lua_tostring(L, -1));
- exit(1);
+ abort();
}
int ret = luaL_checknumber(L, 1);
lua_pushnumber(L, channel);
if (lua_pcall(L, 1, 1, 0) != 0) {
fprintf(stderr, "error running function `channel_color': %s\n", lua_tostring(L, -1));
- exit(1);
+ abort();
}
const char *ret = lua_tostring(L, -1);
if (ret == nullptr) {
fprintf(stderr, "function `channel_color' returned nil for channel %d\n", channel);
- exit(1);
+ abort();
}
string retstr = ret;
lua_pushnumber(L, channel);
if (lua_pcall(L, 1, 1, 0) != 0) {
fprintf(stderr, "error running function `supports_set_wb': %s\n", lua_tostring(L, -1));
- exit(1);
+ abort();
}
bool ret = checkbool(L, -1);
lua_pushnumber(L, b);
if (lua_pcall(L, 4, 0, 0) != 0) {
fprintf(stderr, "error running function `set_wb': %s\n", lua_tostring(L, -1));
- exit(1);
+ abort();
}
assert(lua_gettop(L) == 0);
lua_pushnumber(L, t);
if (lua_pcall(L, 1, 1, 0) != 0) {
fprintf(stderr, "error running function `get_transitions': %s\n", lua_tostring(L, -1));
- exit(1);
+ abort();
}
vector<string> ret;
if (lua_pcall(L, 2, 0, 0) != 0) {
fprintf(stderr, "error running function `transition_clicked': %s\n", lua_tostring(L, -1));
- exit(1);
+ abort();
}
assert(lua_gettop(L) == 0);
}
if (lua_pcall(L, 1, 0, 0) != 0) {
fprintf(stderr, "error running function `channel_clicked': %s\n", lua_tostring(L, -1));
- exit(1);
+ abort();
}
assert(lua_gettop(L) == 0);
}
lua_rawgeti(L, LUA_REGISTRYINDEX, lua_ref);
if (lua_pcall(L, 0, 0, 0) != 0) {
fprintf(stderr, "error running menu callback: %s\n", lua_tostring(L, -1));
- exit(1);
+ abort();
}
}
GLchar error_log[1024] = {0};
glGetProgramInfoLog(shader.glsl_program_num, 1024, nullptr, error_log);
fprintf(stderr, "Error linking program: %s\n", error_log);
- exit(1);
+ abort();
}
shader.max_cbcr_x_pos = glGetUniformLocation(shader.glsl_program_num, "max_cbcr_x");
if (x264_dir.empty()) {
fprintf(stderr, "ERROR: Requested %d-bit x264, but is not linked to such an x264, and could not find one.\n",
depth);
- exit(1);
+ abort();
}
string x264_10b_string = x264_dir + "/x264-10bit" + x264_suffix;
if (x264_dlhandle == nullptr) {
fprintf(stderr, "ERROR: Requested %d-bit x264, but is not linked to such an x264, and %s would not load.\n",
depth, x264_10b_string.c_str());
- exit(1);
+ abort();
}
dyn.handle = x264_dlhandle;
x264 = dyn.x264_encoder_open(¶m);
if (x264 == nullptr) {
fprintf(stderr, "ERROR: x264 initialization failed.\n");
- exit(1);
+ abort();
}
if (global_flags.x264_speedcontrol) {
FILE *infp = fopen(argv[1], "rb");
if (infp == nullptr) {
perror(argv[1]);
- exit(1);
+ abort();
}
FILE *outfp = fopen(argv[3], "w");
if (outfp == nullptr) {
perror(argv[3]);
- exit(1);
+ abort();
}
fprintf(outfp, "// Generated by bin2h.cpp from %s. Do not edit by hand.\n", argv[1]);
surface->create();
if (!surface->isValid()) {
fprintf(stderr, "ERROR: surface not valid!\n");
- exit(1);
+ abort();
}
return surface;
}
surface->create();
if (!surface->isValid()) {
fprintf(stderr, "ERROR: surface not valid!\n");
- exit(1);
+ abort();
}
return surface;
}
const uint64_t one = 1;
if (write(should_quit_fd, &one, sizeof(one)) != sizeof(one)) {
perror("write(should_quit_fd)");
- exit(1);
+ abort();
}
midi_thread.join();
close(should_quit_fd);
AVStream *avstream_video = avformat_new_stream(avctx, nullptr);
if (avstream_video == nullptr) {
fprintf(stderr, "avformat_new_stream() failed\n");
- exit(1);
+ abort();
}
avstream_video->time_base = AVRational{1, time_base};
avstream_video->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
AVStream *avstream_audio = avformat_new_stream(avctx, nullptr);
if (avstream_audio == nullptr) {
fprintf(stderr, "avformat_new_stream() failed\n");
- exit(1);
+ abort();
}
avstream_audio->time_base = AVRational{1, time_base};
if (avcodec_parameters_copy(avstream_audio->codecpar, audio_codecpar) < 0) {
fprintf(stderr, "avcodec_parameters_copy() failed\n");
- exit(1);
+ abort();
}
streams.push_back(avstream_audio);
}
AVStream *avstream_subtitles = avformat_new_stream(avctx, nullptr);
if (avstream_subtitles == nullptr) {
fprintf(stderr, "avformat_new_stream() failed\n");
- exit(1);
+ abort();
}
avstream_subtitles->time_base = AVRational{1, time_base};
avstream_subtitles->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
}
if (avformat_write_header(avctx, &options) < 0) {
fprintf(stderr, "avformat_write_header() failed\n");
- exit(1);
+ abort();
}
for (MuxMetrics *metric : metrics) {
metric->metric_written_bytes += avctx->pb->pos;
av_init_packet(&pkt_copy);
if (av_packet_ref(&pkt_copy, &pkt) < 0) {
fprintf(stderr, "av_copy_packet() failed\n");
- exit(1);
+ abort();
}
if (stream_index_override != -1) {
pkt_copy.stream_index = stream_index_override;
}
perror(filename.c_str());
- exit(1);
+ abort();
}
int ret = fseek(fp, 0, SEEK_END);
if (ret == -1) {
perror("fseek(SEEK_END)");
- exit(1);
+ abort();
}
int disk_size = ftell(fp);
if (disk_size == -1) {
perror("ftell");
- exit(1);
+ abort();
}
ret = fseek(fp, 0, SEEK_SET);
if (ret == -1) {
perror("fseek(SEEK_SET)");
- exit(1);
+ abort();
}
string str;
ret = fread(&str[0], disk_size, 1, fp);
if (ret == -1) {
perror("fread");
- exit(1);
+ abort();
}
if (ret == 0) {
fprintf(stderr, "Short read when trying to read %d bytes from %s\n",
disk_size, filename.c_str());
- exit(1);
+ abort();
}
fclose(fp);