From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 273AD43865 for ; Thu, 1 Sep 2022 13:29:20 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1F66D68BA86; Thu, 1 Sep 2022 16:29:19 +0300 (EEST) Received: from out203-205-221-210.mail.qq.com (out203-205-221-210.mail.qq.com [203.205.221.210]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2370F68BA85 for ; Thu, 1 Sep 2022 16:29:11 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1662038948; bh=DoFXTLePSEggPpsFUGPytmV7kXdSNfcqLGT3aSsPcXs=; h=From:To:Cc:Subject:Date; b=n1EL1gey7P3T6cpuf9Q07g8N/VQh+TJXqD8RbYdKT8GBXxVvXefCbbG/ajB9lYiRn blNbimuFbvQbZqaax6UfU+aTJ0WdVdWShZd91NJYDcDYRV03eOiqqA8AptVOwxdnJE v1BmHebJ5iPztwlSZyvTYl7Xi7HPQ2P7yMIqqvz8= Received: from localhost.localdomain ([103.107.217.225]) by newxmesmtplogicsvrsza35.qq.com (NewEsmtp) with SMTP id 7468A653; Thu, 01 Sep 2022 21:29:06 +0800 X-QQ-mid: xmsmtpt1662038946t2wbq6d5l Message-ID: X-QQ-XMAILINFO: NDgMZBR9sMmavHtAI1gWi95rK9Q3Ka3cG8CBKMa/CHeSAJbbPZxT51f8GH62L6 Uz4Ee3mV5uzaPYqWrLXAhP8ZH1aRNH2Pv8QZnevJekGdx2qKhDTc2CswKclJi+/7+rtXG5kgjsw/ vCsT5OK/vf37wkwtSniBjwFaY0y+JOWdbusx2G8BbXsGVe/Uj14+/OBb2Ph7pDHsX7sr+tZA5tIp 3B9qbyZ7iww4swYSz3vhDrPQSwBFSjfgHnyPekpDfKHTJnvf8GGEJtUvZD4HW6hN6h08ZoDNi2z0 l9ZQS9uv+EScpXUOrlSQ8Mq9B2LHfoNM4iR2fWoBkr/+wxAXOBHvpWxUNhAKCCg28E/3hwAb8poj /hwvqHQL5a1JLJITjX44iH3SCqSco7iQ45d88Wwq4veu1qPtI1jq/1f9gVk29mofBqkb/bvv691R 2Qd6PnIg/eSVapzjOu1gH30X0dh4nAPd+eWzMMH8prRQ6DVs8WTCnjwxDgKrqDrsnDOSlR4DTAnM hfsFXCeHCATBnZqQAQsbEwCZ//f+hkbcaI/PX+c2VOGWysWBclyaMwZKrJ17um255IkDlEcMKyOc 5sI8/7egYf0u+558D3n1/eWFFXON0m5/tyT+rHIDHAFY5atvwxyfjpi/GoPA2vypLqY1SrcMjFBC Vkivv6hUPct9QRsUOZlKQ553WBAn5mVOFVmGl9Nj8G+UfCr2TSIjgPSMzsh7RggKjvErvuLaRpWM tcjcov3vPXR7pQGlTiQTOd238YUBuwOp2j2xTdQ+U2QCao5AMSIpC3SPKnskrRs/Bgs2YbeUs7zd bcLPyjUad4OCOQvae3Wbb4wyHtalUfBkh501e94VZNWE9xAQZ1DU/Jb1MGpHiSxVG8/Pthe3g8bT odzR8JjMU/sTTU2thY3AJ30V6XOKd8kanGi99nvqRG From: 1035567130@qq.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 1 Sep 2022 21:29:03 +0800 X-OQ-MSGID: <20220901132903.91967-1-1035567130@qq.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/mov: get the correct fragment stsd_id when decrypting the sample X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Cc: Wang Yaqiang Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Wang Yaqiang When determining whether a packet should be decrypted, should use the stsd_id of the fragment where the current packet is located. Signed-off-by: Wang Yaqiang --- libavformat/isom.h | 1 + libavformat/mov.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libavformat/isom.h b/libavformat/isom.h index fd236b985f..64fb7065d5 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -139,6 +139,7 @@ typedef struct MOVFragmentStreamInfo { int index_base; int index_entry; MOVEncryptionIndex *encryption_index; + int stsd_id; // current fragment stsd_id } MOVFragmentStreamInfo; typedef struct MOVFragmentIndexItem { diff --git a/libavformat/mov.c b/libavformat/mov.c index 35e2271b14..a2c6a4f2a3 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4956,9 +4956,10 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_TRACE, "frag flags 0x%x\n", frag->flags); frag_stream_info = get_current_frag_stream_info(&c->frag_index); - if (frag_stream_info) + if (frag_stream_info) { frag_stream_info->next_trun_dts = AV_NOPTS_VALUE; - + frag_stream_info->stsd_id = frag->stsd_id; + } return 0; } @@ -7223,7 +7224,7 @@ static int cenc_filter(MOVContext *mov, AVStream* st, MOVStreamContext *sc, AVPa encryption_index = NULL; if (frag_stream_info) { // Note this only supports encryption info in the first sample descriptor. - if (mov->fragment.stsd_id == 1) { + if (frag_stream_info->stsd_id == 1) { if (frag_stream_info->encryption_index) { encrypted_index = current_index - frag_stream_info->index_base; encryption_index = frag_stream_info->encryption_index; -- 2.33.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".