[FFmpeg-devel] RTP mark bit not passed to parse_packet

Ronald S. Bultje rsbultje
Sun Jan 25 19:43:35 CET 2009


Hi,

On Thu, Jan 15, 2009 at 4:13 AM, Alexandre FERRIEUX -
FT/RD/SIRP/ASF/SOFTL <alexandre.ferrieux at orange-ftgroup.com> wrote:
> In the process of writing an RTP depayloader for H263 (RFC2429, simple
> follow-on packet mode), I see that the current API doesn't pass the RTP
> Mark bit (buf[1]&0x80) to the payload handler callback.

I need this. Attached patch fixes this issue for me.

Ronald
-------------- next part --------------
Index: ffmpeg-svn/libavformat/rdt.c
===================================================================
--- ffmpeg-svn.orig/libavformat/rdt.c	2009-01-25 13:36:18.000000000 -0500
+++ ffmpeg-svn/libavformat/rdt.c	2009-01-25 13:40:31.000000000 -0500
@@ -306,7 +306,7 @@
         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);
         pos = url_ftell(&pb);
@@ -361,7 +361,7 @@
     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;
     }
Index: ffmpeg-svn/libavformat/rtp_internal.h
===================================================================
--- ffmpeg-svn.orig/libavformat/rtp_internal.h	2009-01-25 13:36:18.000000000 -0500
+++ ffmpeg-svn/libavformat/rtp_internal.h	2009-01-25 13:38:30.000000000 -0500
@@ -41,6 +41,8 @@
     uint32_t jitter;            ///< estimated jitter.
 } RTPStatistics;
 
+#define RTP_FLAG_KEY    0x1 ///< RTP packet contains a keyframe
+#define RTP_FLAG_MARKER 0x2 ///< marker bit is set on this RTP packet
 /**
  * Packet parsing for "private" payloads in the RTP specs.
  *
@@ -50,7 +52,7 @@
  * @param timestamp pointer in which to write the timestamp of this RTP packet
  * @param buf pointer to raw RTP packet data
  * @param len length of buf
- * @param flags flags from the RTP packet header (PKT_FLAG_*)
+ * @param flags flags from the RTP packet header (RTP_FLAG_*)
  */
 typedef int (*DynamicPayloadPacketHandlerProc) (PayloadContext *s,
                                                 AVStream *st,
Index: ffmpeg-svn/libavformat/rtpdec.c
===================================================================
--- ffmpeg-svn.orig/libavformat/rtpdec.c	2009-01-25 13:36:18.000000000 -0500
+++ ffmpeg-svn/libavformat/rtpdec.c	2009-01-25 13:41:48.000000000 -0500
@@ -437,6 +437,8 @@
         return -1;
     }
     payload_type = buf[1] & 0x7f;
+    if (buf[1] & 0x80)
+        flags |= RTP_FLAG_MARKER;
     seq  = AV_RB16(buf + 2);
     timestamp = AV_RB32(buf + 4);
     ssrc = AV_RB32(buf + 8);



More information about the ffmpeg-devel mailing list