Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-02-25 00:42:00 +0300
committerMichael Niedermayer <michaelni@gmx.at>2015-02-25 00:42:04 +0300
commit48e3cd4fcd49cd7663f56611e20abb5a860caeaa (patch)
tree9ce9f896a3f8c4028b7b4816e704ee877e77c31e
parent11fb6258582d31bebf50ae02fbc301bbac613c2d (diff)
parente72605f80bf5cbe32053a554ccc137e0a99cf3dd (diff)
Merge commit 'e72605f80bf5cbe32053a554ccc137e0a99cf3dd'
* commit 'e72605f80bf5cbe32053a554ccc137e0a99cf3dd': rtpdec: Allow allocating and freeing the private data without explicit functions Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/rtpdec.h1
-rw-r--r--libavformat/rtsp.c14
2 files changed, 12 insertions, 3 deletions
diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h
index 3de3e7dc01..b950160c45 100644
--- a/libavformat/rtpdec.h
+++ b/libavformat/rtpdec.h
@@ -120,6 +120,7 @@ struct RTPDynamicProtocolHandler {
int static_payload_id; /* 0 means no payload id is set. 0 is a valid
* payload ID (PCMU), too, but that format doesn't
* require any custom depacketization code. */
+ int priv_data_size;
/** Initialize dynamic protocol handler, called after the full rtpmap line is parsed, may be null */
int (*init)(AVFormatContext *s, int st_index, PayloadContext *priv_data);
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index b9edd46724..54bbf26c8c 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -195,6 +195,10 @@ static void init_rtp_handler(RTPDynamicProtocolHandler *handler,
rtsp_st->dynamic_protocol_context = handler->alloc();
if (!rtsp_st->dynamic_protocol_context)
rtsp_st->dynamic_handler = NULL;
+ } else if (handler->priv_data_size) {
+ rtsp_st->dynamic_protocol_context = av_mallocz(handler->priv_data_size);
+ if (!rtsp_st->dynamic_protocol_context)
+ rtsp_st->dynamic_handler = NULL;
}
}
@@ -728,9 +732,13 @@ void ff_rtsp_close_streams(AVFormatContext *s)
for (i = 0; i < rt->nb_rtsp_streams; i++) {
rtsp_st = rt->rtsp_streams[i];
if (rtsp_st) {
- if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context)
- rtsp_st->dynamic_handler->free(
- rtsp_st->dynamic_protocol_context);
+ if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context) {
+ if (rtsp_st->dynamic_handler->free)
+ rtsp_st->dynamic_handler->free(
+ rtsp_st->dynamic_protocol_context);
+ else
+ av_free(rtsp_st->dynamic_protocol_context);
+ }
for (j = 0; j < rtsp_st->nb_include_source_addrs; j++)
av_freep(&rtsp_st->include_source_addrs[j]);
av_freep(&rtsp_st->include_source_addrs);