diff options
author | Martin Storsjö <martin@martin.st> | 2011-12-01 11:44:21 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2011-12-01 13:47:26 +0200 |
commit | 7e58050590c556643869a1cc57215026ff88b0db (patch) | |
tree | 13d62d154bc9e260991985dbb94b3ae04e034ea9 /libavformat/rtmpproto.c | |
parent | 9c6777bd9367e8680bb7ada9852f5760dc8a8594 (diff) | |
download | ffmpeg-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/rtmpproto.c')
-rw-r--r-- | libavformat/rtmpproto.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 979c5b6562..f47733814e 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -784,7 +784,6 @@ static int rtmp_close(URLContext *h) av_freep(&rt->flv_data); ffurl_close(rt->stream); - av_free(rt); return 0; } @@ -799,16 +798,12 @@ static int rtmp_close(URLContext *h) */ static int rtmp_open(URLContext *s, const char *uri, int flags) { - RTMPContext *rt; + RTMPContext *rt = s->priv_data; char proto[8], hostname[256], path[1024], *fname; uint8_t buf[2048]; int port; int ret; - rt = av_mallocz(sizeof(RTMPContext)); - if (!rt) - return AVERROR(ENOMEM); - s->priv_data = rt; rt->is_input = !(flags & AVIO_FLAG_WRITE); av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port, @@ -1002,4 +997,5 @@ URLProtocol ff_rtmp_protocol = { .url_read = rtmp_read, .url_write = rtmp_write, .url_close = rtmp_close, + .priv_data_size = sizeof(RTMPContext), }; |