summaryrefslogtreecommitdiff
path: root/libavformat/applehttpproto.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/applehttpproto.c
parent9c6777bd9367e8680bb7ada9852f5760dc8a8594 (diff)
downloadffmpeg-7e58050590c556643869a1cc57215026ff88b0db.tar.gz
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/applehttpproto.c')
-rw-r--r--libavformat/applehttpproto.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c
index 8dbcf2d394..245422be40 100644
--- a/libavformat/applehttpproto.c
+++ b/libavformat/applehttpproto.c
@@ -181,23 +181,18 @@ static int applehttp_close(URLContext *h)
free_segment_list(s);
free_variant_list(s);
ffurl_close(s->seg_hd);
- av_free(s);
return 0;
}
static int applehttp_open(URLContext *h, const char *uri, int flags)
{
- AppleHTTPContext *s;
+ AppleHTTPContext *s = h->priv_data;
int ret, i;
const char *nested_url;
if (flags & AVIO_FLAG_WRITE)
return AVERROR(ENOSYS);
- s = av_mallocz(sizeof(AppleHTTPContext));
- if (!s)
- return AVERROR(ENOMEM);
- h->priv_data = s;
h->is_streamed = 1;
if (av_strstart(uri, "applehttp+", &nested_url)) {
@@ -304,4 +299,5 @@ URLProtocol ff_applehttp_protocol = {
.url_read = applehttp_read,
.url_close = applehttp_close,
.flags = URL_PROTOCOL_FLAG_NESTED_SCHEME,
+ .priv_data_size = sizeof(AppleHTTPContext),
};