summaryrefslogtreecommitdiff
path: root/libavformat/mmsh.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2011-12-01 11:44:21 +0200
committerMartin Storsjö <martin@martin.st>2011-12-01 13:47:26 +0200
commit7e58050590c556643869a1cc57215026ff88b0db (patch)
tree13d62d154bc9e260991985dbb94b3ae04e034ea9 /libavformat/mmsh.c
parent9c6777bd9367e8680bb7ada9852f5760dc8a8594 (diff)
proto: Use .priv_data_size to allocate the private context
This simplifies the open functions by avoiding one function call that needs error checking, reducing the amount of extra bulk code. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/mmsh.c')
-rw-r--r--libavformat/mmsh.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c
index 3761016f81..a1ae894c6e 100644
--- a/libavformat/mmsh.c
+++ b/libavformat/mmsh.c
@@ -68,7 +68,6 @@ static int mmsh_close(URLContext *h)
ffurl_close(mms->mms_hd);
av_free(mms->streams);
av_free(mms->asf_header);
- av_freep(&h->priv_data);
return 0;
}
@@ -217,12 +216,9 @@ static int mmsh_open(URLContext *h, const char *uri, int flags)
char httpname[256], path[256], host[128], location[1024];
char *stream_selection = NULL;
char headers[1024];
- MMSHContext *mmsh;
+ MMSHContext *mmsh = h->priv_data;
MMSContext *mms;
- mmsh = h->priv_data = av_mallocz(sizeof(MMSHContext));
- if (!h->priv_data)
- return AVERROR(ENOMEM);
mmsh->request_seq = h->is_streamed = 1;
mms = &mmsh->mms;
av_strlcpy(location, uri, sizeof(location));
@@ -367,4 +363,5 @@ URLProtocol ff_mmsh_protocol = {
.url_open = mmsh_open,
.url_read = mmsh_read,
.url_close = mmsh_close,
+ .priv_data_size = sizeof(MMSHContext),
};