/* * Copyright (c) 2016, Alliance for Open Media. All rights reserved. * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License * was not distributed with this source code in the LICENSE file, you can * obtain it at www.aomedia.org/license/software. If the Alliance for Open * Media Patent License 1.0 was not distributed with this source code in the * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
// Simplistic mechanism to detect if an argv parameter refers to // an input or output file. Returns the total number of arguments that // should be skipped. int skip_input_output_arg(constchar *arg, constchar *input_fname) { if (strcmp(arg, input_fname) == 0) { return 1;
} if (strcmp(arg, "-o") == 0 || strcmp(arg, "--output") == 0) { return 2;
} if (strncmp(arg, "--output=", strlen("--output=")) == 0) { return 1;
} return 0;
}
} // namespace
char *extract_encoder_settings(constchar *version, constchar **argv, int argc, constchar *input_fname) { // + 9 for "version:" prefix and for null terminator.
size_t total_size = strlen(version) + 9; int i = 1; while (i < argc) { int num_skip = skip_input_output_arg(argv[i], input_fname);
i += num_skip; if (num_skip == 0) {
total_size += strlen(argv[i]) + 1; // + 1 is for space separator.
++i;
}
} char *result = static_cast<char *>(malloc(total_size)); if (result == nullptr) { return nullptr;
} char *cur = result;
cur += snprintf(cur, total_size, "version:%s", version);
i = 1; while (i < argc) { int num_skip = skip_input_output_arg(argv[i], input_fname);
i += num_skip; if (num_skip == 0) {
cur += snprintf(cur, total_size, " %s", argv[i]);
++i;
}
}
*cur = '\0'; return result;
}
int write_webm_file_header(struct WebmOutputContext *webm_ctx,
aom_codec_ctx_t *encoder_ctx, const aom_codec_enc_cfg_t *cfg,
stereo_format_t stereo_fmt, unsignedint fourcc, conststruct AvxRational *par, constchar *encoder_settings) {
std::unique_ptr<mkvmuxer::MkvWriter> writer( new (std::nothrow) mkvmuxer::MkvWriter(webm_ctx->stream));
std::unique_ptr<mkvmuxer::Segment> segment(new (std::nothrow)
mkvmuxer::Segment()); if (writer == nullptr || segment == nullptr) {
fprintf(stderr, "webmenc> mkvmuxer objects alloc failed, out of memory?\n"); return -1;
}
bool ok = segment->Init(writer.get()); if (!ok) {
fprintf(stderr, "webmenc> mkvmuxer Init failed.\n"); return -1;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.