]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtpdec_svq3.c
rtsp: Initialize the media_type_mask in the rtp guessing demuxer
[ffmpeg] / libavformat / rtpdec_svq3.c
index 3c4d75f085066507e1295b6db5be731aae3574f8..4df3e3a3e010b1a99d1c5be1e8285731fe328f33 100644 (file)
@@ -2,28 +2,28 @@
  * Sorenson-3 (SVQ3/SV3V) payload for RTP
  * Copyright (c) 2010 Ronald S. Bultje
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
  * @file
  * @brief RTP support for the SV3V (SVQ3) payload
- * (http://wiki.multimedia.cx/index.php?title=Sorenson_Video_3#Packetization)
  * @author Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+ * @see http://wiki.multimedia.cx/index.php?title=Sorenson_Video_3#Packetization
  */
 
 #include <string.h>
@@ -33,9 +33,8 @@
 #include "rtpdec_formats.h"
 
 struct PayloadContext {
-    ByteIOContext *pktbuf;
+    AVIOContext *pktbuf;
     int64_t        timestamp;
-    int            is_keyframe;
 };
 
 /** return 0 on packet, <0 on partial packet or error... */
@@ -84,26 +83,24 @@ static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv,
 
         if (sv->pktbuf) {
             uint8_t *tmp;
-            url_close_dyn_buf(sv->pktbuf, &tmp);
+            avio_close_dyn_buf(sv->pktbuf, &tmp);
             av_free(tmp);
         }
-        if ((res = url_open_dyn_buf(&sv->pktbuf)) < 0)
+        if ((res = avio_open_dyn_buf(&sv->pktbuf)) < 0)
             return res;
         sv->timestamp   = *timestamp;
-        sv->is_keyframe = flags & RTP_FLAG_KEY;
     }
 
     if (!sv->pktbuf)
         return AVERROR_INVALIDDATA;
 
-    put_buffer(sv->pktbuf, buf, len);
+    avio_write(sv->pktbuf, buf, len);
 
     if (end_packet) {
         av_init_packet(pkt);
         pkt->stream_index = st->index;
         *timestamp        = sv->timestamp;
-        pkt->flags        = sv->is_keyframe ? AV_PKT_FLAG_KEY : 0;
-        pkt->size         = url_close_dyn_buf(sv->pktbuf, &pkt->data);
+        pkt->size         = avio_close_dyn_buf(sv->pktbuf, &pkt->data);
         pkt->destruct     = av_destruct_packet;
         sv->pktbuf        = NULL;
         return 0;
@@ -121,18 +118,17 @@ static void svq3_extradata_free(PayloadContext *sv)
 {
     if (sv->pktbuf) {
         uint8_t *buf;
-        url_close_dyn_buf(sv->pktbuf, &buf);
+        avio_close_dyn_buf(sv->pktbuf, &buf);
         av_free(buf);
     }
     av_free(sv);
 }
 
 RTPDynamicProtocolHandler ff_svq3_dynamic_handler = {
-    "X-SV3V-ES",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_NONE,          // see if (config_packet) above
-    NULL,                   // parse sdp line
-    svq3_extradata_new,
-    svq3_extradata_free,
-    svq3_parse_packet,
+    .enc_name         = "X-SV3V-ES",
+    .codec_type       = AVMEDIA_TYPE_VIDEO,
+    .codec_id         = CODEC_ID_NONE,      // see if (config_packet) above
+    .alloc            = svq3_extradata_new,
+    .free             = svq3_extradata_free,
+    .parse_packet     = svq3_parse_packet,
 };