summaryrefslogtreecommitdiff
path: root/libavformat/mmst.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/mmst.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/mmst.c')
-rw-r--r--libavformat/mmst.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libavformat/mmst.c b/libavformat/mmst.c
index 7bb4358060..9d7fd7471c 100644
--- a/libavformat/mmst.c
+++ b/libavformat/mmst.c
@@ -470,7 +470,6 @@ static int mms_close(URLContext *h)
/* free all separately allocated pointers in mms */
av_free(mms->streams);
av_free(mms->asf_header);
- av_freep(&h->priv_data);
return 0;
}
@@ -502,15 +501,12 @@ static void clear_stream_buffers(MMSContext *mms)
static int mms_open(URLContext *h, const char *uri, int flags)
{
- MMSTContext *mmst;
+ MMSTContext *mmst = h->priv_data;
MMSContext *mms;
int port, err;
char tcpname[256];
h->is_streamed = 1;
- mmst = h->priv_data = av_mallocz(sizeof(MMSTContext));
- if (!h->priv_data)
- return AVERROR(ENOMEM);
mms = &mmst->mms;
// only for MMS over TCP, so set proto = NULL
@@ -628,4 +624,5 @@ URLProtocol ff_mmst_protocol = {
.url_open = mms_open,
.url_read = mms_read,
.url_close = mms_close,
+ .priv_data_size = sizeof(MMSTContext),
};