Merge commit 'bb4a310bb85f43e62240145a656b1e5285b14239'
[ffmpeg.git] / libavformat / rtpdec_xiph.c
index 6712b78..535cbff 100644 (file)
@@ -49,12 +49,7 @@ struct PayloadContext {
     int split_pkts;
 };
 
-static PayloadContext *xiph_new_context(void)
-{
-    return av_mallocz(sizeof(PayloadContext));
-}
-
-static inline void free_fragment(PayloadContext * data)
+static void free_fragment(PayloadContext * data)
 {
     if (data->fragment) {
         uint8_t* p;
@@ -68,16 +63,6 @@ static void xiph_free_context(PayloadContext * data)
 {
     free_fragment(data);
     av_freep(&data->split_buf);
-    av_freep(&data);
-}
-
-static av_cold int xiph_vorbis_init(AVFormatContext *ctx, int st_index,
-                                    PayloadContext *data)
-{
-    if (st_index < 0)
-        return 0;
-    ctx->streams[st_index]->need_parsing = AVSTREAM_PARSE_HEADERS;
-    return 0;
 }
 
 
@@ -309,7 +294,7 @@ parse_packed_headers(const uint8_t * packed_headers,
 static int xiph_parse_fmtp_pair(AVFormatContext *s,
                                 AVStream* stream,
                                 PayloadContext *xiph_data,
-                                char *attr, char *value)
+                                const char *attr, const char *value)
 {
     AVCodecContext *codec = stream->codec;
     int result = 0;
@@ -394,8 +379,8 @@ RTPDynamicProtocolHandler ff_theora_dynamic_handler = {
     .enc_name         = "theora",
     .codec_type       = AVMEDIA_TYPE_VIDEO,
     .codec_id         = AV_CODEC_ID_THEORA,
+    .priv_data_size   = sizeof(PayloadContext),
     .parse_sdp_a_line = xiph_parse_sdp_line,
-    .alloc            = xiph_new_context,
     .free             = xiph_free_context,
     .parse_packet     = xiph_handle_packet,
 };
@@ -404,9 +389,9 @@ RTPDynamicProtocolHandler ff_vorbis_dynamic_handler = {
     .enc_name         = "vorbis",
     .codec_type       = AVMEDIA_TYPE_AUDIO,
     .codec_id         = AV_CODEC_ID_VORBIS,
-    .init             = xiph_vorbis_init,
+    .need_parsing     = AVSTREAM_PARSE_HEADERS,
+    .priv_data_size   = sizeof(PayloadContext),
     .parse_sdp_a_line = xiph_parse_sdp_line,
-    .alloc            = xiph_new_context,
     .free             = xiph_free_context,
     .parse_packet     = xiph_handle_packet,
 };