aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2017-12-29 23:29:27 +0100
committerMarton Balint <cus@passwd.hu>2018-01-28 23:06:43 +0100
commit25a2d269bdd919e633e202b67927c3c72f9f0dd5 (patch)
treeb704890db0eef099f1e8203cfe056e3567b00063
parentea3672b7d67c432724bdbc8de0221f869b6a04c6 (diff)
downloadffmpeg-25a2d269bdd919e633e202b67927c3c72f9f0dd5.tar.gz
fftools, tools, examples: migrate to AVFormatContext->url
Signed-off-by: Marton Balint <cus@passwd.hu>
-rw-r--r--doc/examples/transcode_aac.c7
-rw-r--r--fftools/ffmpeg.c16
-rw-r--r--fftools/ffmpeg_opt.c8
-rw-r--r--fftools/ffplay.c6
-rw-r--r--fftools/ffprobe.c2
-rw-r--r--tools/uncoded_frame.c2
6 files changed, 22 insertions, 19 deletions
diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c
index 9fd5c00d60..3c7688cd33 100644
--- a/doc/examples/transcode_aac.c
+++ b/doc/examples/transcode_aac.c
@@ -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))) {
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 918eb353aa..a37de2ff98 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -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);
}
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 92199b3ac2..997d538381 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -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);
}
}
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 9bfa3e6cea..f2028d4b13 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -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);
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 0e7a771517..acb403e3b1 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -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);
diff --git a/tools/uncoded_frame.c b/tools/uncoded_frame.c
index 606bdb746a..3aaa4b6897 100644
--- a/tools/uncoded_frame.c
+++ b/tools/uncoded_frame.c
@@ -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",