From patchwork Tue May 15 18:29:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Karmani X-Patchwork-Id: 8978 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp1826568jad; Tue, 15 May 2018 12:02:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoQS8EZKCb71EfS+0MHSugCUdxzqQB9Hgj1Xr7iVRNe3Z1h01wXkQhDQtfBCT/sTdJtGyya X-Received: by 2002:adf:9ae5:: with SMTP id a92-v6mr10894213wrc.180.1526410942787; Tue, 15 May 2018 12:02:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526410942; cv=none; d=google.com; s=arc-20160816; b=tcGBYZ2ACc3Th5m1mGbugRmB39E7hxNEmc9R3ty3Ksq/p4W9vQ2NL5zETMbJt0vSZH EepE0/245niGO79oEpjuubyzGOS1JPN+cjpnsXcFqF9TzH0O2Io+qZC0iF/JZf5UGg5Y WG1BUkBPcrW/4zGUsvebNzZIgibNx3kCnH0buUCDMR70EKQunbs3L/iYRFxsXcYzE+tY WfYRgOIXCECj9dPhyQ7jq2m02Es71neaiWccWN6C2U5sxp7gu+SPftOH3qsroSxGGGzF 3VWLSWTZBMegqz1QmeRQJx29TTpcmR9kxkiYtatrSTpQF/azN3UcXwo/ydgEyK7kp1NF HUFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=RktMsBUMg9XC3vfO3enXieQG3Q18vwG1rWyD3VuuuPc=; b=e6b0keoazM/R2LYifUM4RH+yES7T4c6EtSQnsBWnQvGFhBznxxnqUKJ/9C3OrcZ/ce 4H1w5bmk8Gv5px51x+lXSK/qzBK61t6QQeq20+BOTrWlRhvr5fdFLbmmttBk5LNM+9RX lo0Olc/fbit89NeOocg8z6SoBQEiJUalOqhid/4U3inWg5zvku9KGMJo9gfXc7KxiIDH qskSdpY+kEJLJL+JlMGcJyXn1m4b6YuYdZBLUj/HPUNV/QQj1PC9se/E96OTfzU8L1eA cx2z/5pxQaiqp/T8kibT1G7Xln8vXvmPSb6RcEcNOOzMAWP5COdQL4StN7ia60n2qrL+ XyIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@tmm1-net.20150623.gappssmtp.com header.s=20150623 header.b=GJMTL0sc; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id e15-v6si660009wra.326.2018.05.15.12.02.02; Tue, 15 May 2018 12:02:22 -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=@tmm1-net.20150623.gappssmtp.com header.s=20150623 header.b=GJMTL0sc; 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 40E1E689818; Tue, 15 May 2018 22:01:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg0-f67.google.com (mail-pg0-f67.google.com [74.125.83.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D0145680D30 for ; Tue, 15 May 2018 22:01:16 +0300 (EEST) Received: by mail-pg0-f67.google.com with SMTP id e1-v6so434719pga.6 for ; Tue, 15 May 2018 12:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tmm1-net.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id; bh=OIdV8fdYvc7zdZR8hffwrTHA907vGJjcLwxzVEGgJUg=; b=GJMTL0scNhRS7lIDlc+/faswQbNH9Z/Wc9cLehsWzqpIWhgEk70eumtT4hT4L/MSso 64cVP6usiAEo1qHdY2kAzkfI5oiIAFJAExDT33md27XrROD8kIVKypxnVD7Qyy+E/oy0 CS12fUi4B9fqUuqYjXu3sltq7Y43+L0rBHNoPttv771bJnvwGKDDZUHqmzqhvhvOdzhD luGyFf1l9ygdfpEsu3PqX5U7GM9N+FSSjxwZTWXR1dul6d1Fsk0Xj1MhgEvti1/8K7in rMUSDnrG3XgF1mp18Zz5NT6Sz2KncDMFdH790pfnCrqd2YcHR3eHkUG0VkHtRP6rYEVW R+Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=OIdV8fdYvc7zdZR8hffwrTHA907vGJjcLwxzVEGgJUg=; b=DLnlk0JShpKVdKBoMLQVaKTJzY1Ptil/M2lZprfaB1gow61fEnP3tyGd1Y+w7dlPt3 B0hjITVerWJ84Zn7wAf+V9YLj7R/gMfPTw9GqBRqkx9LqXTCGz5hdzQIY9WnGFK68GW5 zagv0LeUGL93N4cTFaXGQv1kBdKYniDhnkM9/eJijrnEwfL6k7CtAf24D/W0g5TXNoHP lIL5QX+XOVHtA1pQRmORkYCePerj2w34vuCbhJq4JjbY26Y9B96F2VjdcplpGHQ3H3/a /N84ZQHoBmMDw6OhB3JNqMmUOria20n3N9hTVtw6uMGT+YH9zyrAqayxsgqexv5e3ZHQ RScA== X-Gm-Message-State: ALKqPweetLpQn4sLyihvsuET59aQ48tHf99gh9GT9VThK4MHi7192Ddn NHHRzq24gzlW2kgIoSD7N3Ky96Jk X-Received: by 2002:a65:4c4f:: with SMTP id l15-v6mr13153412pgr.61.1526408991590; Tue, 15 May 2018 11:29:51 -0700 (PDT) Received: from localhost.localdomain (c-69-181-54-242.hsd1.ca.comcast.net. [69.181.54.242]) by smtp.gmail.com with ESMTPSA id h6-v6sm758714pgn.65.2018.05.15.11.29.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 15 May 2018 11:29:50 -0700 (PDT) From: Aman Gupta To: ffmpeg-devel@ffmpeg.org Date: Tue, 15 May 2018 11:29:47 -0700 Message-Id: <20180515182947.59629-1-ffmpeg@tmm1.net> X-Mailer: git-send-email 2.14.2 Subject: [FFmpeg-devel] [PATCH] avformat/mpegts: tag video streams with still images 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: michael@niedermayer.cc, cus@passwd.hu, Aman Gupta , jeebjp@gmail.com MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Aman Gupta Parses the video_stream_descriptor (H.222 2.6.2) to look for the still_picture_flag. This is exposed to the user via a new AV_DISPOSITION_STILL_IMAGE. See for example https://tmm1.s3.amazonaws.com/music-choice.ts, whose video stream only updates every ~6 seconds. Signed-off-by: Aman Gupta --- libavformat/avformat.h | 1 + libavformat/dump.c | 2 ++ libavformat/mpegts.c | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index a2fe7c6bb2..155da42ba3 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -846,6 +846,7 @@ typedef struct AVStreamInternal AVStreamInternal; #define AV_DISPOSITION_DESCRIPTIONS 0x20000 #define AV_DISPOSITION_METADATA 0x40000 #define AV_DISPOSITION_DEPENDENT 0x80000 ///< dependent audio stream (mix_type=0 in mpegts) +#define AV_DISPOSITION_STILL_IMAGE 0x100000 ///< still images in video stream (still_picture_flag=1 in mpegts) /** * Options for behavior on timestamp wrap detection. diff --git a/libavformat/dump.c b/libavformat/dump.c index 942e62a581..d1f98bf259 100644 --- a/libavformat/dump.c +++ b/libavformat/dump.c @@ -551,6 +551,8 @@ static void dump_stream_format(AVFormatContext *ic, int i, av_log(NULL, AV_LOG_INFO, " (descriptions)"); if (st->disposition & AV_DISPOSITION_DEPENDENT) av_log(NULL, AV_LOG_INFO, " (dependent)"); + if (st->disposition & AV_DISPOSITION_STILL_IMAGE) + av_log(NULL, AV_LOG_INFO, " (still images)"); av_log(NULL, AV_LOG_INFO, "\n"); dump_metadata(NULL, st->metadata, " "); diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 27b1c30a44..61df7f6cc6 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1683,6 +1683,11 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type mpegts_find_stream_type(st, desc_tag, DESC_types); switch (desc_tag) { + case 0x02: /* video stream descriptor */ + if (get8(pp, desc_end) & 0x1) { + st->disposition |= AV_DISPOSITION_STILL_IMAGE; + } + break; case 0x1E: /* SL descriptor */ desc_es_id = get16(pp, desc_end); if (desc_es_id < 0)