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;
-}
-
-static void amr_free_context(PayloadContext *data)
-{
- av_free(data);
+ return 0;
}
static int amr_handle_packet(AVFormatContext *ctx, PayloadContext *data,
static int amr_parse_fmtp(AVFormatContext *s,
AVStream *stream, PayloadContext *data,
- char *attr, char *value)
+ const char *attr, const char *value)
{
/* Some AMR SDP configurations contain "octet-align", without
* the trailing =1. Therefore, if the value is empty,
if (!strcmp(value, "")) {
av_log(s, AV_LOG_WARNING, "AMR fmtp attribute %s had "
"nonstandard empty value\n", attr);
- strcpy(value, "1");
+ value = "1";
}
if (!strcmp(attr, "octet-align"))
data->octet_align = atoi(value);
.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,
- .free = amr_free_context,
.parse_packet = amr_handle_packet,
};
.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,
- .free = amr_free_context,
.parse_packet = amr_handle_packet,
};