[FFmpeg-devel] [PATCH] Relay RTP Extension Header
    John Laxson 
    jlaxson at mac.com
       
    Tue Apr 28 23:20:51 EEST 2020
    
    
  
Attached is a small patch-in-concept to provide access to extension headers received in RTP streams by passing the header as AVPacket side data.  My specific use case is accessing metadata embedded in streams from Parrot hardware [1].   Is this functionality something you would be interested in landing?  If so, could you provide some architectural guidance on where to flesh it out - is AV_PKT_DATA_NEW_EXTRADATA appropriate, or define another?  Any other places this needs to be handled?
Sincerely,
John Laxson
[1] https://developer.parrot.com/docs/pdraw/metadata.html
Signed-off-by: John Laxson <jlaxson at mac.com>
---
 libavformat/rtpdec.c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 3d5b200099..03d767a1a3 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -681,6 +681,11 @@ static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,
 
         if (len < ext)
             return -1;
+
+        void *side_buf = av_malloc(ext);
+        memcpy(side_buf, buf, ext);
+        av_packet_add_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, side_buf, ext);
+
         // skip past RTP header extension
         len -= ext;
         buf += ext;
-- 
2.22.0
    
    
More information about the ffmpeg-devel
mailing list