From patchwork Tue Apr 28 20:20:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Laxson X-Patchwork-Id: 19348 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 0B96E44B234 for ; Tue, 28 Apr 2020 23:21:01 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D0A9168C459; Tue, 28 Apr 2020 23:21:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mr85p00im-hyfv06021301.me.com (mr85p00im-hyfv06021301.me.com [17.58.23.188]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6BCBC68BEC8 for ; Tue, 28 Apr 2020 23:20:54 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=1a1hai; t=1588105252; bh=HyzY8zhRxNhmqEqPM3rmbPqMi0bWAm6+cHB67XDytpo=; h=From:Content-Type:Subject:Message-Id:Date:To; b=CAqJOIwaLl4c50mc0epY4LWE0q1yzLipJQFDT5HwEYsdq/yj0q8Lk5XeIP1ySiqJq VMyxcQzcWmpMZGoMg6Fr1kWBvSj2Wbcc6dTRS+aevmpcNDpDV9cm5CGmGDz0FpdSYN TxR7a6e47/IjwRtQgu3xtldAaS64K98mgjEob69ybJWyvnFWn91x2cvkpCvf21Rip3 BYs4cWYsar9Q7VC35Xgot2Y6E4PkNegjMGBQdDZNYkDsxDqdgvlKZBMcH+9qx9fZDt orNwDFXtrEUx8VOT+nvj0/4OJqLnB8xdqOF2GYax058qsxnWFOkUsB9arv+IHfS1wD R+xUkHzo/AJEA== Received: from johns-mbp-2.attlocal.net (172-3-142-26.lightspeed.sntcca.sbcglobal.net [172.3.142.26]) by mr85p00im-hyfv06021301.me.com (Postfix) with ESMTPSA id 7DB9F4086B for ; Tue, 28 Apr 2020 20:20:52 +0000 (UTC) From: John Laxson Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Message-Id: <33824A70-C125-441B-9666-E1F7006B0EB9@mac.com> Date: Tue, 28 Apr 2020 13:20:51 -0700 To: ffmpeg-devel@ffmpeg.org X-Mailer: Apple Mail (2.3445.104.11) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-28_14:2020-04-28, 2020-04-28 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2002250000 definitions=main-2004280159 Subject: [FFmpeg-devel] [PATCH] Relay RTP Extension Header X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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 --- 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;