API changes, most recent first:
+2018-01-xx - xxxxxxx - lavf 58.7.100 - avformat.h
+ Add url field to AVFormatContext and add ff_format_set_url helper function.
+
2018-01-xx - xxxxxxx - lavf 58.6.100 - avformat.h
Add AVFMTCTX_UNSEEKABLE (for HLS demuxer).
*/
char filename[1024];
+ /**
+ * input or output URL. Unlike the old filename field, this field has no
+ * length restriction.
+ *
+ * - demuxing: set by avformat_open_input(), initialized to an empty
+ * string if url parameter was NULL in avformat_open_input().
+ * - muxing: may be set by the caller before calling avformat_write_header()
+ * (or avformat_init_output() if that is called first) to a string
+ * which is freeable by av_free(). Set to an empty string if it
+ * was NULL in avformat_init_output().
+ *
+ * Freed by libavformat in avformat_free_context().
+ */
+ char *url;
+
/**
* Position of the first frame of the component, in
* AV_TIME_BASE fractional seconds. NEVER set this value directly:
int ff_lock_avformat(void);
int ff_unlock_avformat(void);
+/**
+ * Set AVFormatContext url field to the provided pointer. The pointer must
+ * point to a valid string. The existing url field is freed if necessary. Also
+ * set the legacy filename field to the same string which was provided in url.
+ */
+void ff_format_set_url(AVFormatContext *s, char *url);
+
#endif /* AVFORMAT_INTERNAL_H */
} else
s->priv_data = NULL;
- if (filename)
+ if (filename) {
av_strlcpy(s->filename, filename, sizeof(s->filename));
+ if (!(s->url = av_strdup(filename)))
+ goto nomem;
+
+ }
*avctx = s;
return 0;
nomem:
(ret = av_opt_set_dict2(s->priv_data, &tmp, AV_OPT_SEARCH_CHILDREN)) < 0)
goto fail;
+ if (!s->url && !(s->url = av_strdup(s->filename))) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
#if FF_API_LAVF_AVCTX
FF_DISABLE_DEPRECATION_WARNINGS
if (s->nb_streams && s->streams[0]->codec->flags & AV_CODEC_FLAG_BITEXACT) {
if ((ret = av_opt_set_dict(s, &tmp)) < 0)
goto fail;
+ if (!(s->url = av_strdup(filename ? filename : ""))) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
av_strlcpy(s->filename, filename ? filename : "", sizeof(s->filename));
if ((ret = init_input(s, filename, &tmp)) < 0)
goto fail;
av_freep(&s->streams);
flush_packet_queue(s);
av_freep(&s->internal);
+ av_freep(&s->url);
av_free(s);
}
return st->internal->avctx->time_base;
#endif
}
+
+void ff_format_set_url(AVFormatContext *s, char *url)
+{
+ av_assert0(url);
+ av_freep(&s->url);
+ s->url = url;
+ av_strlcpy(s->filename, url, sizeof(s->filename));
+}
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
// Also please add any ticket numbers that you believe might be affected here
#define LIBAVFORMAT_VERSION_MAJOR 58
-#define LIBAVFORMAT_VERSION_MINOR 6
+#define LIBAVFORMAT_VERSION_MINOR 7
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \