summaryrefslogtreecommitdiff
path: root/libavformat/mmsh.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-02 00:51:11 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-02 00:51:11 +0100
commit7b0b10ce4186eaa1cd3c0a2bfbb86307d65eecfd (patch)
treea9a937af698ca14ef06ec2c07453f474aa5ca3c7 /libavformat/mmsh.c
parent8b08f81949bcfa6fec42ff3f1c9bef5be8140300 (diff)
parent04403ec2e405a3cfcfbdd45f1274be30c652e462 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (25 commits) rtpenc: Add support for G726 audio rtpdec: Interpret the different G726 names as bits_per_coded_sample rtpenc: Change rtp_send_samples to handle sample sizes other than even bytes rtpenc: Cast a rescaling parameter to int64_t h264: cap max has_b_frames at MAX_DELAYED_PIC_COUNT - 1. ARM: fix indentation in ff_dsputil_init_neon() ARM: NEON put/avg_pixels8/16 cosmetics ARM: add remaining NEON avg_pixels8/16 functions ARM: clean up NEON put/avg_pixels macros fate: split acodec-pcm into individual tests swscale: #include "libavutil/mathematics.h" pmpdec: don't use deprecated av_set_pts_info. rv34: align temporary block of "dct" coefs Add PlayStation Portable PMP format demuxer proto: Realign struct initializers proto: Use .priv_data_size to allocate the private context mmsh: Properly clean up if the second ffurl_alloc failed rtmp: Clean up properly if the handshake failed md5proto: Remove the get_file_handle function applehttpproto: Use the close function if the open function fails ... Conflicts: libavcodec/vble.c libavformat/mmsh.c libavformat/pmpdec.c libavformat/udp.c tests/ref/acodec/pcm Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mmsh.c')
-rw-r--r--libavformat/mmsh.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c
index bc93722f1a..e92b74fc0a 100644
--- a/libavformat/mmsh.c
+++ b/libavformat/mmsh.c
@@ -69,7 +69,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;
}
@@ -218,12 +217,9 @@ static int mmsh_open_internal(URLContext *h, const char *uri, int flags, int tim
char httpname[256], path[256], host[128];
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(mmsh->location, uri, sizeof(mmsh->location));
@@ -263,9 +259,9 @@ static int mmsh_open_internal(URLContext *h, const char *uri, int flags, int tim
// close the socket and then reopen it for sending the second play request.
ffurl_close(mms->mms_hd);
memset(headers, 0, sizeof(headers));
- if (ffurl_alloc(&mms->mms_hd, httpname, AVIO_FLAG_READ,
- &h->interrupt_callback) < 0) {
- return AVERROR(EIO);
+ if ((err = ffurl_alloc(&mms->mms_hd, httpname, AVIO_FLAG_READ,
+ &h->interrupt_callback)) < 0) {
+ goto fail;
}
stream_selection = av_mallocz(mms->stream_num * 19 + 1);
if (!stream_selection)
@@ -403,10 +399,11 @@ static int64_t mmsh_seek(URLContext *h, int64_t pos, int whence)
}
URLProtocol ff_mmsh_protocol = {
- .name = "mmsh",
- .url_open = mmsh_open,
- .url_read = mmsh_read,
- .url_seek = mmsh_seek,
- .url_close = mmsh_close,
+ .name = "mmsh",
+ .url_open = mmsh_open,
+ .url_read = mmsh_read,
+ .url_seek = mmsh_seek,
+ .url_close = mmsh_close,
.url_read_seek = mmsh_read_seek,
+ .priv_data_size = sizeof(MMSHContext),
};