diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-12-02 00:51:11 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-12-02 00:51:11 +0100 |
commit | 7b0b10ce4186eaa1cd3c0a2bfbb86307d65eecfd (patch) | |
tree | a9a937af698ca14ef06ec2c07453f474aa5ca3c7 /libavformat/applehttpproto.c | |
parent | 8b08f81949bcfa6fec42ff3f1c9bef5be8140300 (diff) | |
parent | 04403ec2e405a3cfcfbdd45f1274be30c652e462 (diff) | |
download | ffmpeg-7b0b10ce4186eaa1cd3c0a2bfbb86307d65eecfd.tar.gz |
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/applehttpproto.c')
-rw-r--r-- | libavformat/applehttpproto.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c index 8218c0e05f..8295ccc5f5 100644 --- a/libavformat/applehttpproto.c +++ b/libavformat/applehttpproto.c @@ -174,19 +174,25 @@ fail: return ret; } +static int applehttp_close(URLContext *h) +{ + AppleHTTPContext *s = h->priv_data; + + free_segment_list(s); + free_variant_list(s); + ffurl_close(s->seg_hd); + 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)) { @@ -229,7 +235,7 @@ static int applehttp_open(URLContext *h, const char *uri, int flags) return 0; fail: - av_free(s); + applehttp_close(h); return ret; } @@ -287,21 +293,11 @@ retry: goto start; } -static int applehttp_close(URLContext *h) -{ - AppleHTTPContext *s = h->priv_data; - - free_segment_list(s); - free_variant_list(s); - ffurl_close(s->seg_hd); - av_free(s); - return 0; -} - URLProtocol ff_applehttp_protocol = { - .name = "applehttp", - .url_open = applehttp_open, - .url_read = applehttp_read, - .url_close = applehttp_close, - .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME, + .name = "applehttp", + .url_open = applehttp_open, + .url_read = applehttp_read, + .url_close = applehttp_close, + .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME, + .priv_data_size = sizeof(AppleHTTPContext), }; |