From patchwork Fri Oct 12 13:41:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Zhao X-Patchwork-Id: 10658 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 41E944468A9 for ; Fri, 12 Oct 2018 16:41:17 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 602E068A50B; Fri, 12 Oct 2018 16:40:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F06DE68A4CF for ; Fri, 12 Oct 2018 16:40:51 +0300 (EEST) Received: by mail-pl1-f196.google.com with SMTP id q19-v6so2888304pll.5 for ; Fri, 12 Oct 2018 06:41:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=GFaVaI8RqbM3LzCO9KfErZClxelFgK6Cy0nJFYg0Y1k=; b=igc5l7y+XfnOK67iEtNZPiTnol4RoK1KXAUm25mqmc2BKot6NRgsxum9g6ADOEfU5A 4NNxELIP7yfQzC7qML8uad8xrKNxq5F8GN3qWEQ9zalwN2wkREspqbPeQobH5oVDebEX f0J17agKGHDfD78jJRFqIHZPQKs/lT5MFFl8kBLfDr76Zg8MRg7Mft3GkRUj9y6O2zhM +4zOYisF5tKFPTi7qF0MBAbHsEBJjcy0NLUBptawfehqjHlOLAxYGG4TQOu0y3OTBO4q L6Y/cf9Yk5CXoO5Vd2NjIq6grjCHlbxJN53o1sPKwlO1w+nhj8Z1zyBvFT0kzC4S/lLl KJcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=GFaVaI8RqbM3LzCO9KfErZClxelFgK6Cy0nJFYg0Y1k=; b=QkmmaVJlGCDfP6nVOswlnwiljO0Hk+akZyMSdpwEQG+8xEyRzCu1l2uuI0tBVpOMpd Ykqn3U/0ngpzeIhhhOw8G2SE04/I6BFgXHhIZ/6X5jPxkywlf7Ag+D27DKm84y9FbqTT mc1UXD10NU8aJpvHLVab6vIDBKygyu4cl1YWqyaHrpwAMD7xYo9HW6YdFGcvruTauETV eLD2uTbinSrlIiO+gxHlkyDCuMAi2Lh5zs1z0JrE1MQpMSmMcRSwPc1127Ldwagk+d9T eVbnvw0EeBNeZrtKQQjKgrIK/Owzp8jIrqFv70Kd3RlG/vEpaRUMs5bK3SteS2f2SCY9 w1nQ== X-Gm-Message-State: ABuFfogSMR21TEu1ihILrmDl6v4wokKHPd1f/pvNDkD5QYuGjuHfpjS1 jDs1EOBV4otIph3CGv7AmXRpgLD0jWg= X-Google-Smtp-Source: ACcGV60IJHh185/S9NjdEC1OkRT/2qCQtPvVnSDt4X5fhFcE1X4bJCt/LjWcx3AG/CjZZm5JJ8zgcw== X-Received: by 2002:a17:902:8ec2:: with SMTP id x2-v6mr6076046plo.157.1539351673248; Fri, 12 Oct 2018 06:41:13 -0700 (PDT) Received: from localhost.localdomain ([47.90.47.25]) by smtp.gmail.com with ESMTPSA id h88-v6sm4895200pfa.184.2018.10.12.06.41.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 06:41:12 -0700 (PDT) From: Jun Zhao To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Oct 2018 21:41:04 +0800 Message-Id: <1539351665-18001-1-git-send-email-mypopydev@gmail.com> X-Mailer: git-send-email 1.7.1 Subject: [FFmpeg-devel] [PATCH V2 1/2] lavf/vc1test: fix vc1test can't probe some RCV file. 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 Cc: "Yan, FengX" , Jun Zhao , Jun Zhao MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" case 1: use the hexdump -C SMM0005.rcv get: size skip (size - 4) | | V V 00000000 18 00 00 c5 05 00 00 00 4d f1 0a 11 00 e0 01 00 00000010 00 d0 02 00 00 0c 00 00 00 88 13 00 00 c0 65 52 ^ | size + 16 case 2: same the command for SMM0015.rcv get: size | V 00000000 19 00 00 c5 04 00 00 00 41 f3 80 01 40 02 00 00 00000010 d0 02 00 00 0c 00 00 00 00 00 00 10 00 00 00 00 ^ | size + 16 There are different the RCV file format for VC-1, vc1test just handle the case 2 now, this fix will support the case 1. (Both of test clips come from: RP 228:2008 - SMPTE Recommended Practice - VC-1 Decoder and Bitstream Conformance). Signed-off-by: Jun Zhao Signed-off-by: Yan, FengX --- libavformat/vc1test.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c index a801f4b..82e155a 100644 --- a/libavformat/vc1test.c +++ b/libavformat/vc1test.c @@ -34,9 +34,13 @@ static int vc1t_probe(AVProbeData *p) { + int size; + if (p->buf_size < 24) return 0; - if (p->buf[3] != 0xC5 || AV_RL32(&p->buf[4]) != 4 || AV_RL32(&p->buf[20]) != 0xC) + + size = AV_RL32(&p->buf[4]); + if (p->buf[3] != 0xC5 || AV_RL32(&p->buf[size+16]) != 0xC) return 0; return AVPROBE_SCORE_EXTENSION; @@ -48,9 +52,10 @@ static int vc1t_read_header(AVFormatContext *s) AVStream *st; int frames; uint32_t fps; + int size; frames = avio_rl24(pb); - if(avio_r8(pb) != 0xC5 || avio_rl32(pb) != 4) + if (avio_r8(pb) != 0xC5 || ((size = avio_rl32(pb)) < 4)) return AVERROR_INVALIDDATA; /* init video codec */ @@ -63,6 +68,8 @@ static int vc1t_read_header(AVFormatContext *s) if (ff_get_extradata(s, st->codecpar, pb, VC1_EXTRADATA_SIZE) < 0) return AVERROR(ENOMEM); + + avio_skip(pb, size - 4); st->codecpar->height = avio_rl32(pb); st->codecpar->width = avio_rl32(pb); if(avio_rl32(pb) != 0xC)