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();
}
}