# HG changeset patch # User mstorsjo # Date 1277215748 0 # Node ID f7090c70ed3473f4d78a225374b6da484fa51c8a # Parent 1b4be334ef890572fe85ecfc8f1a4402e3fdf966 Add priv_data_size and priv_data_class to URLProtocol This allows url_alloc to allocate and initialize the priv_data. diff -r 1b4be334ef89 -r f7090c70ed34 avformat.h --- a/avformat.h Tue Jun 22 14:03:37 2010 +0000 +++ b/avformat.h Tue Jun 22 14:09:08 2010 +0000 @@ -22,7 +22,7 @@ #define AVFORMAT_AVFORMAT_H #define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 70 +#define LIBAVFORMAT_VERSION_MINOR 71 #define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ diff -r 1b4be334ef89 -r f7090c70ed34 avio.c --- a/avio.c Tue Jun 22 14:03:37 2010 +0000 +++ b/avio.c Tue Jun 22 14:09:08 2010 +0000 @@ -118,6 +118,13 @@ uc->flags = flags; uc->is_streamed = 0; /* default = not streamed */ uc->max_packet_size = 0; /* default: stream file */ + if (up->priv_data_size) { + uc->priv_data = av_mallocz(up->priv_data_size); + if (up->priv_data_class) { + *(AVClass**)uc->priv_data = up->priv_data_class; + av_opt_set_defaults(uc->priv_data); + } + } *puc = uc; return 0; @@ -272,6 +279,8 @@ #if CONFIG_NETWORK ff_network_close(); #endif + if (h->prot->priv_data_size) + av_free(h->priv_data); av_free(h); return ret; } diff -r 1b4be334ef89 -r f7090c70ed34 avio.h --- a/avio.h Tue Jun 22 14:03:37 2010 +0000 +++ b/avio.h Tue Jun 22 14:09:08 2010 +0000 @@ -251,6 +251,8 @@ int64_t (*url_read_seek)(URLContext *h, int stream_index, int64_t timestamp, int flags); int (*url_get_file_handle)(URLContext *h); + int priv_data_size; + const AVClass *priv_data_class; } URLProtocol; #if LIBAVFORMAT_VERSION_MAJOR < 53