fftools, tools, examples: migrate to AVFormatContext->url
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
parent
ea3672b7d6
commit
25a2d269bd
@ -171,8 +171,11 @@ static int open_output_file(const char *filename,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
av_strlcpy((*output_format_context)->filename, filename,
|
||||
sizeof((*output_format_context)->filename));
|
||||
if (!((*output_format_context)->url = av_strdup(filename))) {
|
||||
fprintf(stderr, "Could not allocate url.\n");
|
||||
error = AVERROR(ENOMEM);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Find the encoder to be used by its name. */
|
||||
if (!(output_codec = avcodec_find_encoder(AV_CODEC_ID_AAC))) {
|
||||
|
@ -1563,7 +1563,7 @@ static void print_final_stats(int64_t total_size)
|
||||
uint64_t total_packets = 0, total_size = 0;
|
||||
|
||||
av_log(NULL, AV_LOG_VERBOSE, "Input file #%d (%s):\n",
|
||||
i, f->ctx->filename);
|
||||
i, f->ctx->url);
|
||||
|
||||
for (j = 0; j < f->nb_streams; j++) {
|
||||
InputStream *ist = input_streams[f->ist_index + j];
|
||||
@ -1597,7 +1597,7 @@ static void print_final_stats(int64_t total_size)
|
||||
uint64_t total_packets = 0, total_size = 0;
|
||||
|
||||
av_log(NULL, AV_LOG_VERBOSE, "Output file #%d (%s):\n",
|
||||
i, of->ctx->filename);
|
||||
i, of->ctx->url);
|
||||
|
||||
for (j = 0; j < of->ctx->nb_streams; j++) {
|
||||
OutputStream *ost = output_streams[of->ost_index + j];
|
||||
@ -2105,7 +2105,7 @@ static void check_decode_result(InputStream *ist, int *got_output, int ret)
|
||||
|
||||
if (exit_on_error && *got_output && ist) {
|
||||
if (ist->decoded_frame->decode_error_flags || (ist->decoded_frame->flags & AV_FRAME_FLAG_CORRUPT)) {
|
||||
av_log(NULL, AV_LOG_FATAL, "%s: corrupt decoded frame in stream %d\n", input_files[ist->file_index]->ctx->filename, ist->st->index);
|
||||
av_log(NULL, AV_LOG_FATAL, "%s: corrupt decoded frame in stream %d\n", input_files[ist->file_index]->ctx->url, ist->st->index);
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
@ -2989,7 +2989,7 @@ static int check_init_output_file(OutputFile *of, int file_index)
|
||||
//assert_avoptions(of->opts);
|
||||
of->header_written = 1;
|
||||
|
||||
av_dump_format(of->ctx, file_index, of->ctx->filename, 1);
|
||||
av_dump_format(of->ctx, file_index, of->ctx->url, 1);
|
||||
|
||||
if (sdp_filename || want_sdp)
|
||||
print_sdp();
|
||||
@ -4252,7 +4252,7 @@ static int process_input(int file_index)
|
||||
}
|
||||
if (ret < 0) {
|
||||
if (ret != AVERROR_EOF) {
|
||||
print_error(is->filename, ret);
|
||||
print_error(is->url, ret);
|
||||
if (exit_on_error)
|
||||
exit_program(1);
|
||||
}
|
||||
@ -4301,7 +4301,7 @@ static int process_input(int file_index)
|
||||
goto discard_packet;
|
||||
|
||||
if (exit_on_error && (pkt.flags & AV_PKT_FLAG_CORRUPT)) {
|
||||
av_log(NULL, AV_LOG_FATAL, "%s: corrupt input packet in stream %d\n", is->filename, pkt.stream_index);
|
||||
av_log(NULL, AV_LOG_FATAL, "%s: corrupt input packet in stream %d\n", is->url, pkt.stream_index);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
@ -4668,11 +4668,11 @@ static int transcode(void)
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Nothing was written into output file %d (%s), because "
|
||||
"at least one of its streams received no packets.\n",
|
||||
i, os->filename);
|
||||
i, os->url);
|
||||
continue;
|
||||
}
|
||||
if ((ret = av_write_trailer(os)) < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error writing trailer of %s: %s\n", os->filename, av_err2str(ret));
|
||||
av_log(NULL, AV_LOG_ERROR, "Error writing trailer of %s: %s\n", os->url, av_err2str(ret));
|
||||
if (exit_on_error)
|
||||
exit_program(1);
|
||||
}
|
||||
|
@ -1271,7 +1271,7 @@ static int choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *o
|
||||
if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO || type == AVMEDIA_TYPE_SUBTITLE) {
|
||||
MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, ost->st);
|
||||
if (!codec_name) {
|
||||
ost->st->codecpar->codec_id = av_guess_codec(s->oformat, NULL, s->filename,
|
||||
ost->st->codecpar->codec_id = av_guess_codec(s->oformat, NULL, s->url,
|
||||
NULL, ost->st->codecpar->codec_type);
|
||||
ost->enc = avcodec_find_encoder(ost->st->codecpar->codec_id);
|
||||
if (!ost->enc) {
|
||||
@ -2334,7 +2334,7 @@ loop_end:
|
||||
#endif
|
||||
|
||||
if (!oc->nb_streams && !(oc->oformat->flags & AVFMT_NOSTREAMS)) {
|
||||
av_dump_format(oc, nb_output_files - 1, oc->filename, 1);
|
||||
av_dump_format(oc, nb_output_files - 1, oc->url, 1);
|
||||
av_log(NULL, AV_LOG_ERROR, "Output file #%d does not contain any stream\n", nb_output_files - 1);
|
||||
exit_program(1);
|
||||
}
|
||||
@ -2466,8 +2466,8 @@ loop_end:
|
||||
|
||||
/* check filename in case of an image number is expected */
|
||||
if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
|
||||
if (!av_filename_number_test(oc->filename)) {
|
||||
print_error(oc->filename, AVERROR(EINVAL));
|
||||
if (!av_filename_number_test(oc->url)) {
|
||||
print_error(oc->url, AVERROR(EINVAL));
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
|
@ -2712,8 +2712,8 @@ static int is_realtime(AVFormatContext *s)
|
||||
)
|
||||
return 1;
|
||||
|
||||
if(s->pb && ( !strncmp(s->filename, "rtp:", 4)
|
||||
|| !strncmp(s->filename, "udp:", 4)
|
||||
if(s->pb && ( !strncmp(s->url, "rtp:", 4)
|
||||
|| !strncmp(s->url, "udp:", 4)
|
||||
)
|
||||
)
|
||||
return 1;
|
||||
@ -2928,7 +2928,7 @@ static int read_thread(void *arg)
|
||||
ret = avformat_seek_file(is->ic, -1, seek_min, seek_target, seek_max, is->seek_flags);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"%s: error while seeking\n", is->ic->filename);
|
||||
"%s: error while seeking\n", is->ic->url);
|
||||
} else {
|
||||
if (is->audio_stream >= 0) {
|
||||
packet_queue_flush(&is->audioq);
|
||||
|
@ -2778,7 +2778,7 @@ static int show_format(WriterContext *w, InputFile *ifile)
|
||||
int ret = 0;
|
||||
|
||||
writer_print_section_header(w, SECTION_ID_FORMAT);
|
||||
print_str_validate("filename", fmt_ctx->filename);
|
||||
print_str_validate("filename", fmt_ctx->url);
|
||||
print_int("nb_streams", fmt_ctx->nb_streams);
|
||||
print_int("nb_programs", fmt_ctx->nb_programs);
|
||||
print_str("format_name", fmt_ctx->iformat->name);
|
||||
|
@ -141,7 +141,7 @@ int main(int argc, char **argv)
|
||||
goto fail;
|
||||
}
|
||||
if (!(st->mux->oformat->flags & AVFMT_NOFILE)) {
|
||||
ret = avio_open2(&st->mux->pb, st->mux->filename, AVIO_FLAG_WRITE,
|
||||
ret = avio_open2(&st->mux->pb, st->mux->url, AVIO_FLAG_WRITE,
|
||||
NULL, NULL);
|
||||
if (ret < 0) {
|
||||
av_log(st->mux, AV_LOG_ERROR, "Failed to init output: %s\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user