From patchwork Sat Oct 13 22:53:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Zhao X-Patchwork-Id: 10670 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 5466C446DF1 for ; Sun, 14 Oct 2018 02:01:42 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ACB1068A0F5; Sun, 14 Oct 2018 02:01:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9BA74689F35 for ; Sun, 14 Oct 2018 02:01:16 +0300 (EEST) Received: by mail-pg1-f196.google.com with SMTP id t70-v6so7426451pgd.12 for ; Sat, 13 Oct 2018 16:01:40 -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:in-reply-to:references; bh=mfRXA89+HqvhS5Pi9+SVBwTacrG0+aQCCLUw/YRp4CE=; b=fGdzQkH0I4tqsSzrPEasp0tGDJBkFMxENFwWlfUJKBe+UUAXlYaj2hxLWW8GyBm5Jf vp0sFGwm/x3w1vEDOVNR6cRcRgyb0NFtrS5Om1uUOKsQhTbQTts5x3IpJtRhVb1hYWI3 45w94V4YJnA8VzvRK3YnXtCRC3zRfzlbGc85g6QcqZViKCM5/JGI/Ad9B9OqBZBLsI1o A4q3Q0YMdPoLc8azNTJYM4xGT51Fx4uYcBf5niB0MEbTjM0NcyHcly6X2l/uUT6apivA BwxsoKBf+c2pcWpK1hcJRJ/4CWfO7Yk+55wXUVRs/STWZwLmCFL5LsdPW4SraNINKcg6 yrzw== 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:in-reply-to :references; bh=mfRXA89+HqvhS5Pi9+SVBwTacrG0+aQCCLUw/YRp4CE=; b=oqdnjZ4KO9npjmb3GiVwtzzfer5BLvZ4Da0k7uFReeBkyyomVX74l+tCdrT55WjVKu 4QZoyRaWMZ40XEY18vUYwzApICY7dIeWDF7Gl2XkP39CrTUIJDd5W56xf3Utj4JV8QO9 ZLL2RDRUBKhgxlJTZjYyv21Vli/Ds4DoiFMMJRhj2Fz59hjJxeaznpQbMRcuOTXfyUxj T9jaabpxJOsk9w+8SdDjNCXxYXccFsNdM6sPwdUA2QmDFvv/CBjPPYdsxB2XxPfXPDtU UsJFXrfaoqrLYCrgoJ3cYTEcGOc+FUo/SZqRQ4uMjg5AeYyUC9oj9GtfpFGVf9k9k9zN 6ubg== X-Gm-Message-State: ABuFfogRA3k1na+HBWVceJirAgTMZ6SsbPFvaEW89Af40CbheD1W5PMY hIEm/sT1tJtkyQnShdPgpKgXgZDt X-Google-Smtp-Source: ACcGV61n4ScFD+iAUF30pA1LmYc6BxtiAGwoYbomDBmeuRUJdbWmsNNU3qBr1U/ukW89SGJXKsbylg== X-Received: by 2002:a62:be1a:: with SMTP id l26-v6mr11991484pff.204.1539471244012; Sat, 13 Oct 2018 15:54:04 -0700 (PDT) Received: from localhost.localdomain ([47.90.47.25]) by smtp.gmail.com with ESMTPSA id i29-v6sm10921273pfj.82.2018.10.13.15.54.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Oct 2018 15:54:03 -0700 (PDT) From: Jun Zhao To: ffmpeg-devel@ffmpeg.org Date: Sun, 14 Oct 2018 06:53:51 +0800 Message-Id: <1539471232-4198-2-git-send-email-mypopydev@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1539471232-4198-1-git-send-email-mypopydev@gmail.com> References: <1539471232-4198-1-git-send-email-mypopydev@gmail.com> Subject: [FFmpeg-devel] [PATCH V3 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: SMPTE Recommended Practice - VC-1 Decoder and Bitstream Conformance). And I think I got a older VC-1 test clip in the case 1. Reviewed-by: Carl Eugen Hoyos Reviewed-by: Jerome Borsboom Reviewed-by: Michael Niedermayer 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..e029ff4 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 || size < 4 || 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)