[FFmpeg-cvslog] r23706 - in trunk/libavformat: avformat.h avio.c avio.h

mstorsjo subversion
Tue Jun 22 16:09:08 CEST 2010


Author: mstorsjo
Date: Tue Jun 22 16:09:08 2010
New Revision: 23706

Log:
Add priv_data_size and priv_data_class to URLProtocol

This allows url_alloc to allocate and initialize the priv_data.

Modified:
   trunk/libavformat/avformat.h
   trunk/libavformat/avio.c
   trunk/libavformat/avio.h

Modified: trunk/libavformat/avformat.h
==============================================================================
--- trunk/libavformat/avformat.h	Tue Jun 22 16:05:10 2010	(r23705)
+++ trunk/libavformat/avformat.h	Tue Jun 22 16:09:08 2010	(r23706)
@@ -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, \

Modified: trunk/libavformat/avio.c
==============================================================================
--- trunk/libavformat/avio.c	Tue Jun 22 16:05:10 2010	(r23705)
+++ trunk/libavformat/avio.c	Tue Jun 22 16:09:08 2010	(r23706)
@@ -118,6 +118,13 @@ static int url_alloc_for_protocol (URLCo
     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 @@ int url_close(URLContext *h)
 #if CONFIG_NETWORK
     ff_network_close();
 #endif
+    if (h->prot->priv_data_size)
+        av_free(h->priv_data);
     av_free(h);
     return ret;
 }

Modified: trunk/libavformat/avio.h
==============================================================================
--- trunk/libavformat/avio.h	Tue Jun 22 16:05:10 2010	(r23705)
+++ trunk/libavformat/avio.h	Tue Jun 22 16:09:08 2010	(r23706)
@@ -251,6 +251,8 @@ typedef struct URLProtocol {
     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



More information about the ffmpeg-cvslog mailing list