]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rdt.c
Moves the display of metadata to dump_format()
[ffmpeg] / libavformat / rdt.c
index aeb35c71356c526ec1b26ff77245c479416ce6b3..24ee6a993de2324331cc456e20a4503017053bd3 100644 (file)
@@ -33,7 +33,7 @@
 #include "libavutil/md5.h"
 #include "rm.h"
 #include "internal.h"
-#include "libavcodec/bitstream.h"
+#include "libavcodec/get_bits.h"
 
 struct RDTDemuxContext {
     AVFormatContext *ic; /**< the containing (RTSP) demux context */
@@ -306,20 +306,22 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st,
         int pos;
 
         init_put_byte(&pb, buf, len, 0, NULL, NULL, NULL, NULL);
-        flags = (flags & PKT_FLAG_KEY) ? 2 : 0;
+        flags = (flags & RTP_FLAG_KEY) ? 2 : 0;
         res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[st->index], len, pkt,
-                                  &seq, &flags, timestamp);
+                                  &seq, flags, *timestamp);
         pos = url_ftell(&pb);
         if (res < 0)
             return res;
-        rdt->audio_pkt_cnt = res;
-        if (rdt->audio_pkt_cnt > 0 &&
-            st->codec->codec_id == CODEC_ID_AAC) {
-            memcpy (rdt->buffer, buf + pos, len - pos);
-            rdt->rmctx->pb = av_alloc_put_byte (rdt->buffer, len - pos, 0,
-                                                NULL, NULL, NULL, NULL);
+        if (res > 0) {
+            if (st->codec->codec_id == CODEC_ID_AAC) {
+                memcpy (rdt->buffer, buf + pos, len - pos);
+                rdt->rmctx->pb = av_alloc_put_byte (rdt->buffer, len - pos, 0,
+                                                    NULL, NULL, NULL, NULL);
+            }
+            goto get_cache;
         }
     } else {
+get_cache:
         rdt->audio_pkt_cnt =
             ff_rm_retrieve_cache (rdt->rmctx, rdt->rmctx->pb,
                                   st, rdt->rmst[st->index], pkt);
@@ -361,7 +363,7 @@ ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt,
     if (is_keyframe &&
         (set_id != s->prev_set_id || timestamp != s->prev_timestamp ||
          stream_id != s->prev_stream_id)) {
-        flags |= PKT_FLAG_KEY;
+        flags |= RTP_FLAG_KEY;
         s->prev_set_id    = set_id;
         s->prev_timestamp = timestamp;
     }
@@ -509,7 +511,7 @@ ff_real_parse_sdp_a_line (AVFormatContext *s, int stream_index,
 }
 
 static PayloadContext *
-rdt_new_extradata (void)
+rdt_new_context (void)
 {
     PayloadContext *rdt = av_mallocz(sizeof(PayloadContext));
 
@@ -519,7 +521,7 @@ rdt_new_extradata (void)
 }
 
 static void
-rdt_free_extradata (PayloadContext *rdt)
+rdt_free_context (PayloadContext *rdt)
 {
     int i;
 
@@ -536,13 +538,13 @@ rdt_free_extradata (PayloadContext *rdt)
 
 #define RDT_HANDLER(n, s, t) \
 static RTPDynamicProtocolHandler ff_rdt_ ## n ## _handler = { \
-    s, \
-    t, \
-    CODEC_ID_NONE, \
-    rdt_parse_sdp_line, \
-    rdt_new_extradata, \
-    rdt_free_extradata, \
-    rdt_parse_packet \
+    .enc_name         = s, \
+    .codec_type       = t, \
+    .codec_id         = CODEC_ID_NONE, \
+    .parse_sdp_a_line = rdt_parse_sdp_line, \
+    .open             = rdt_new_context, \
+    .close            = rdt_free_context, \
+    .parse_packet     = rdt_parse_packet \
 };
 
 RDT_HANDLER(live_video, "x-pn-multirate-realvideo-live", CODEC_TYPE_VIDEO);