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))) {
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];
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];
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);
}
}
//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();
}
if (ret < 0) {
if (ret != AVERROR_EOF) {
- print_error(is->filename, ret);
+ print_error(is->url, ret);
if (exit_on_error)
exit_program(1);
}
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);
}
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);
}
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) {
#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);
}
/* 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);
}
}
)
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;
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);
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);
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",