Removing usless format dump

This commit is contained in:
Zoe Roux
2020-01-26 22:35:55 +01:00
parent 1a4d81d280
commit 26d5b03ed1
4 changed files with 7 additions and 10 deletions

View File

@@ -6,14 +6,13 @@
int open_input_context(AVFormatContext **in_ctx, const char *path)
{
if (avformat_open_input(in_ctx, path, NULL, NULL)) {
printf("Error: Can't open the file at %s.\n", path);
fprintf(stderr, "Error: Can't open the file at %s.\n", path);
return (1);
}
if (avformat_find_stream_info(*in_ctx, NULL) < 0) {
printf("Error: Could't find streams informations for the file at %s.\n", path);
fprintf(stderr,"Error: Could't find streams informations for the file at %s.\n", path);
return (1);
}
av_dump_format(*in_ctx, 0, path, false);
return (0);
}
@@ -22,11 +21,11 @@ AVStream *copy_stream_to_output(AVFormatContext *out_ctx, AVStream *in_stream)
AVStream *out_stream = avformat_new_stream(out_ctx, NULL);
if (out_stream == NULL) {
printf("Error: Couldn't create stream.\n");
fprintf(stderr,"Error: Couldn't create stream.\n");
return (NULL);
}
if (avcodec_parameters_copy(out_stream->codecpar, in_stream->codecpar) < 0) {
printf("Error: Couldn't copy parameters to the output file.\n");
fprintf(stderr, "Error: Couldn't copy parameters to the output file.\n");
return (NULL);
}
out_stream->codecpar->codec_tag = 0;
@@ -43,14 +42,14 @@ int open_output_file_for_write(AVFormatContext *out_ctx, const char *out_path, A
{
if (!(out_ctx->oformat->flags & AVFMT_NOFILE)) {
if (avio_open(&out_ctx->pb, out_path, AVIO_FLAG_WRITE) < 0) {
printf("Error: Couldn't open file at %s.\n", out_path);
fprintf(stderr, "Error: Couldn't open file at %s.\n", out_path);
return (1);
}
}
else
printf("Output flag set to AVFMT_NOFILE.\n");
if (avformat_write_header(out_ctx, options) < 0) {
printf("Error: Couldn't write headers to file at %s.\n", out_path);
fprintf(stderr, "Error: Couldn't write headers to file at %s.\n", out_path);
return (1);
}
return (0);

View File

@@ -8,7 +8,7 @@
int init()
{
printf("Kyoo's transcoder initiated.\n");
puts("Kyoo's transcoder initiated.");
return (sizeof(stream));
}

View File

@@ -59,7 +59,6 @@ int copy_subtitle_stream(AVFormatContext **out_ctx, stream *s, AVFormatContext *
av_dict_copy(&(*out_ctx)->metadata, int_ctx->metadata, 0);
out_stream = copy_stream_to_output(*out_ctx, in_stream);
if (out_stream) {
av_dump_format(*out_ctx, 0, s->path, true);
if (open_output_file_for_write(*out_ctx, s->path, NULL) == 0)
return (0);
}

View File

@@ -115,7 +115,6 @@ int transmux(const char *path, const char *out_path, float *playable_duration)
return (-1);
}
stream_map = prepare_streammap(in_ctx, out_ctx);
av_dump_format(out_ctx, 0, out_path, true);
options = create_options_context(out_path);
if (!stream_map || !options || open_output_file_for_write(out_ctx, out_path, &options) != 0) {
destroy_context(in_ctx, out_ctx, options, stream_map);