From patchwork Tue Jan 10 16:05:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 2173 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp328292vsb; Tue, 10 Jan 2017 08:06:04 -0800 (PST) X-Received: by 10.28.203.6 with SMTP id b6mr406471wmg.2.1484064364205; Tue, 10 Jan 2017 08:06:04 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p14si1820894wrc.272.2017.01.10.08.06.03; Tue, 10 Jan 2017 08:06:04 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2324A68A4C6; Tue, 10 Jan 2017 18:05:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-1.mx.upcmail.net (vie01a-qmta-pe01-1.mx.upcmail.net [62.179.121.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9527468A43E for ; Tue, 10 Jan 2017 18:05:47 +0200 (EET) Received: from [172.31.218.32] (helo=vie01a-dmta-pe01-2.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1cQyvq-0000H3-Po for ffmpeg-devel@ffmpeg.org; Tue, 10 Jan 2017 17:05:54 +0100 Received: from [172.31.216.44] (helo=vie01a-pemc-psmtp-pe02) by vie01a-dmta-pe01.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1cQyvk-0005mo-Tw for ffmpeg-devel@ffmpeg.org; Tue, 10 Jan 2017 17:05:48 +0100 Received: from [192.168.1.3] ([80.110.105.32]) by vie01a-pemc-psmtp-pe02 with SMTP @ mailcloud.upcmail.net id Wg5n1u03y0hxW7C01g5olY; Tue, 10 Jan 2017 17:05:48 +0100 X-SourceIP: 80.110.105.32 From: Carl Eugen Hoyos To: FFmpeg development discussions and patches Date: Tue, 10 Jan 2017 17:05:47 +0100 User-Agent: KMail/1.9.10 MIME-Version: 1.0 Message-Id: <201701101705.47583.cehoyos@ag.or.at> Subject: [FFmpeg-devel] [PATCH]lavf/matroskaenc: Print an error if an unreadable rawvideo pix_fmt is written 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" Hi! Attached patch copies mov and avi behaviour. Please comment, Carl Eugen From c716fb256cfcc59dfa6adc93ac0810db9c2c1722 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Tue, 10 Jan 2017 17:04:34 +0100 Subject: [PATCH] lavf/matroskaenc: Print an error if rawvideo pix_fmt is invalid for vfw. --- libavformat/matroskaenc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 78a621e..3f06faa 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -51,10 +51,12 @@ #include "libavutil/samplefmt.h" #include "libavutil/sha.h" #include "libavutil/stereo3d.h" +#include "libavutil/pixdesc.h" #include "libavcodec/xiph.h" #include "libavcodec/mpeg4audio.h" #include "libavcodec/internal.h" +#include "libavcodec/raw.h" typedef struct ebml_master { int64_t pos; ///< absolute offset in the file where the master's elements start @@ -1128,6 +1130,11 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv, } if (par->codec_id == AV_CODEC_ID_RAWVIDEO && !par->codec_tag) { if (mkv->allow_raw_vfw) { + enum AVPixelFormat pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi, + par->bits_per_coded_sample); + if (par->format != pix_fmt && par->format != AV_PIX_FMT_NONE) + av_log(s, AV_LOG_ERROR, "%s rawvideo cannot be written to vfw mkv, output file will be unreadable\n", + av_get_pix_fmt_name(par->format)); native_id = 0; } else { av_log(s, AV_LOG_ERROR, "Raw RGB is not supported Natively in Matroska, you can use AVI or NUT or\n"