aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rtpdec_amr.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-02-25 00:03:52 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-02-25 00:03:52 +0100
commitd52bf89d21b744344cf6cda1bfe156786f24772a (patch)
tree25cfd43e57273d606a09be92a020650f16f206c6 /libavformat/rtpdec_amr.c
parent99c76902cdc3f815d58ba16ccfc83e75acec1f4a (diff)
parent78791c086bcaf9eb084c27555b31fea8bbb7624a (diff)
downloadffmpeg-d52bf89d21b744344cf6cda1bfe156786f24772a.tar.gz
Merge commit '78791c086bcaf9eb084c27555b31fea8bbb7624a'
* commit '78791c086bcaf9eb084c27555b31fea8bbb7624a': rtpdec: Use .init instead of .alloc to set default values Conflicts: libavformat/rdt.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rtpdec_amr.c')
-rw-r--r--libavformat/rtpdec_amr.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/libavformat/rtpdec_amr.c b/libavformat/rtpdec_amr.c
index d79b236fbb..848db9d62a 100644
--- a/libavformat/rtpdec_amr.c
+++ b/libavformat/rtpdec_amr.c
@@ -38,13 +38,10 @@ struct PayloadContext {
int channels;
};
-static PayloadContext *amr_new_context(void)
+static av_cold int amr_init(AVFormatContext *s, int st_index, PayloadContext *data)
{
- PayloadContext *data = av_mallocz(sizeof(PayloadContext));
- if (!data)
- return data;
data->channels = 1;
- return data;
+ return 0;
}
static int amr_handle_packet(AVFormatContext *ctx, PayloadContext *data,
@@ -189,8 +186,9 @@ RTPDynamicProtocolHandler ff_amr_nb_dynamic_handler = {
.enc_name = "AMR",
.codec_type = AVMEDIA_TYPE_AUDIO,
.codec_id = AV_CODEC_ID_AMR_NB,
+ .priv_data_size = sizeof(PayloadContext),
+ .init = amr_init,
.parse_sdp_a_line = amr_parse_sdp_line,
- .alloc = amr_new_context,
.parse_packet = amr_handle_packet,
};
@@ -198,7 +196,8 @@ RTPDynamicProtocolHandler ff_amr_wb_dynamic_handler = {
.enc_name = "AMR-WB",
.codec_type = AVMEDIA_TYPE_AUDIO,
.codec_id = AV_CODEC_ID_AMR_WB,
+ .priv_data_size = sizeof(PayloadContext),
+ .init = amr_init,
.parse_sdp_a_line = amr_parse_sdp_line,
- .alloc = amr_new_context,
.parse_packet = amr_handle_packet,
};