comparison avio.c @ 6161:f7090c70ed34 libavformat

Add priv_data_size and priv_data_class to URLProtocol This allows url_alloc to allocate and initialize the priv_data.
author mstorsjo
date Tue, 22 Jun 2010 14:09:08 +0000
parents 1b4be334ef89
children 47456957844f
comparison
equal deleted inserted replaced
6160:1b4be334ef89 6161:f7090c70ed34
116 strcpy(uc->filename, filename); 116 strcpy(uc->filename, filename);
117 uc->prot = up; 117 uc->prot = up;
118 uc->flags = flags; 118 uc->flags = flags;
119 uc->is_streamed = 0; /* default = not streamed */ 119 uc->is_streamed = 0; /* default = not streamed */
120 uc->max_packet_size = 0; /* default: stream file */ 120 uc->max_packet_size = 0; /* default: stream file */
121 if (up->priv_data_size) {
122 uc->priv_data = av_mallocz(up->priv_data_size);
123 if (up->priv_data_class) {
124 *(AVClass**)uc->priv_data = up->priv_data_class;
125 av_opt_set_defaults(uc->priv_data);
126 }
127 }
121 128
122 *puc = uc; 129 *puc = uc;
123 return 0; 130 return 0;
124 fail: 131 fail:
125 *puc = NULL; 132 *puc = NULL;
270 if (h->is_connected && h->prot->url_close) 277 if (h->is_connected && h->prot->url_close)
271 ret = h->prot->url_close(h); 278 ret = h->prot->url_close(h);
272 #if CONFIG_NETWORK 279 #if CONFIG_NETWORK
273 ff_network_close(); 280 ff_network_close();
274 #endif 281 #endif
282 if (h->prot->priv_data_size)
283 av_free(h->priv_data);
275 av_free(h); 284 av_free(h);
276 return ret; 285 return ret;
277 } 286 }
278 287
279 int url_exist(const char *filename) 288 int url_exist(const char *filename)