From patchwork Fri Jun 11 20:30:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Diederick C. Niehorster" X-Patchwork-Id: 28219 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp764027iol; Fri, 11 Jun 2021 13:34:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwLtME4BJiXtBscoSUOT/6IzdZJQNEJJ3zdAsBA/BNRTt8GT7WOw1cb43iCjRbD0QEB2ch X-Received: by 2002:a50:d54c:: with SMTP id f12mr5397407edj.301.1623443696527; Fri, 11 Jun 2021 13:34:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623443696; cv=none; d=google.com; s=arc-20160816; b=IxaZ3dadb5KWVTy9lyEZvKVNOcvpIjvu+a4KPidYdRADedYTSZDLD36HW8VwX0/ih8 dUoKif4cHGewGvukH+2VRaGR5AzQvi6/nOHulyWz9syCpmiKCl9Nu2tusuRyVGLWdvg4 NEgAc54qgSWIBhDvHnul9IB7ANPjqvbumXQJOebVK4m0z8HqcYC4XNWXpkr1vwtqN/Xr ZYoX11mOBdkMNBxsqoW+Dh5ysejTWQ5iufvb97z2DN5xQsGdiYjLEt5nVPyogV+NgIHE tzecHx7ozlD/rGfxLnP4P8BeJoSCWz2B+ALeqIe1RdwmfuF5+rSAv8yzwfoT0Ac/2CEu C9Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=Lhr7c0A5CcpDAjfasLOmPhMMxOy3fS8sMdOLJ/T4DhM=; b=CzXJ4u6i+XqEbWN88DQli0yFKVDnT7Nfvr8NapUg3B0BgdNsQ4qJdqoJ36K2FUMg/U IBoNgbMcfWKYrHtCSD657SGeQzWHuIj+E4+yXetZZsVEFwk3SFJvjOm+keAYarM+eWzZ kF1n/jyc63BSeaIvkhuSoAHzcvvnLiOg0cvm+b5QzRxUwPoenH0qDYWXkI7asbPFj/9O +QG+o5z+gAYq61xEbFSxCDrRaGfshxLYOCEf82/la2/1eLvNIUPQ9Td0B7J8JRNH2xJx 5SRUCxYeDC98K3fLO1eWup8LyWqhlbTSz+vpOhHFPfAPA6n1QhdKnnwLvalcLdl+mhtM /BPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=IClQ++s3; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y21si5603463ejb.616.2021.06.11.13.34.49; Fri, 11 Jun 2021 13:34:56 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=IClQ++s3; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4AA086883D3; Fri, 11 Jun 2021 23:34:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 80900680869 for ; Fri, 11 Jun 2021 23:34:45 +0300 (EEST) Received: by mail-lf1-f45.google.com with SMTP id bp38so10431081lfb.0 for ; Fri, 11 Jun 2021 13:34:45 -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 :mime-version:content-transfer-encoding; bh=AOr5y9ufe2X1eTxCLAimNaBYZyAhYJD5nOwwUGmduZg=; b=IClQ++s3Q7biagZrlZUkFQwrIXdu26FBvhaIG5sAP2ATEzMoDzjuOwM0a7K6k4bDRW lyAO+sX1d4ttWwGa8dSSmpofeNKea1OrrqooZCXwRNI/B7mCZREKHZUwbOz7nGkohAX/ Uka6iaH5XaYJNMNri73VyxD4pFl4xAlQpRxSVIvvX+WDEagdx6/VAYzrc1r/2LvY+D81 Yq5mCafyso2IH4r6fLwwAbUxLd3kpNSM57q0UQ5W0nOZchaBFEe1wlt8yHvzL74j1giN mc6XN2VHDetPjJ+TdUXjW4g3D7IQztFZPb11qjlaFzMAwME6tKY5Ym1khhx865lSzlnF O3Qg== 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:mime-version:content-transfer-encoding; bh=AOr5y9ufe2X1eTxCLAimNaBYZyAhYJD5nOwwUGmduZg=; b=WMwT5FYDvYIXgb4PVY33JgTU4fyE27c70b36xbQG3fxod63N/3Dtq6GApVEbiwOlM2 FsUYdmkmcxOBCYD4LqTepeL+Nts/5YR+UF6sj5bdLQDNFPtA1oqycJThyhRZO2LLbquF J7QnjJjHyKAhbIAPMjaiW6tkk3wxmoGtCVQqNNCaotWdQiQvqeuvT9lpESYX7gYP5r7L 2YIuCvrB/8tU9XzfweCMEb5NsLTlyfUR1+6E/PmcMBwcFg8uLo61CzeO2+wQ68sx1jUv wDjTZLTriSmNXeo9G911mqs2XL0japb/eHKOBk8PB71AizlX21+FennfvXi0OQTnaMOW FdUA== X-Gm-Message-State: AOAM5314FUByHtzqEvmp1+NhbeJWGAXaVwUCFuwVPWgR4FLApC/P3GRT PD+f4HMadyths8Lnq87ptunkASaweITJLg== X-Received: by 2002:a05:6512:3b26:: with SMTP id f38mr3837319lfv.102.1623443684576; Fri, 11 Jun 2021 13:34:44 -0700 (PDT) Received: from localhost.localdomain ([196.196.203.214]) by smtp.gmail.com with ESMTPSA id x11sm686061lfn.137.2021.06.11.13.34.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 13:34:43 -0700 (PDT) From: Diederick Niehorster To: ffmpeg-devel@ffmpeg.org Date: Fri, 11 Jun 2021 22:30:42 +0200 Message-Id: <20210611203104.1692-12-dcnieho@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20210611203104.1692-1-dcnieho@gmail.com> References: <20210611203104.1692-1-dcnieho@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 11/33] avformat: add control_message function to AVInputFormat 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: Diederick Niehorster Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: UGuveBVnK+KF Control messages are useful for programmatic control of not only outdevs but also indevs. Bumping avformat version. Signed-off-by: Diederick Niehorster --- libavdevice/avdevice.c | 8 +++++--- libavformat/avformat.h | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c index 4a40929007..e339cebf2d 100644 --- a/libavdevice/avdevice.c +++ b/libavdevice/avdevice.c @@ -53,9 +53,11 @@ const char * avdevice_license(void) int avdevice_app_to_dev_control_message(struct AVFormatContext *s, enum AVAppToDevMessageType type, void *data, size_t data_size) { - if (!s->oformat || !s->oformat->control_message) - return AVERROR(ENOSYS); - return s->oformat->control_message(s, type, data, data_size); + if (s->oformat && s->oformat->control_message) + return s->oformat->control_message(s, type, data, data_size); + if (s->iformat && s->iformat->control_message) + return s->iformat->control_message(s, type, data, data_size); + return AVERROR(ENOSYS); } int avdevice_dev_to_app_control_message(struct AVFormatContext *s, enum AVDevToAppMessageType type, diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 043baeea1f..7e9db81d26 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -742,6 +742,12 @@ typedef struct AVInputFormat { */ int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); + /** + * Allows sending messages from application to device. + */ + int (*control_message)(struct AVFormatContext *s, int type, + void *data, size_t data_size); + /** * Returns device list with it properties. * @see avdevice_list_devices() for more details.