From patchwork Fri Feb 10 23:21:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jan_Ekstr=C3=B6m?= X-Patchwork-Id: 2495 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp739366vsb; Fri, 10 Feb 2017 15:21:27 -0800 (PST) X-Received: by 10.28.216.130 with SMTP id p124mr9072557wmg.58.1486768887006; Fri, 10 Feb 2017 15:21:27 -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 b31si3971176wra.284.2017.02.10.15.21.26; Fri, 10 Feb 2017 15:21:26 -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; dkim=neutral (body hash did not verify) header.i=@gmail.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; dmarc=fail (p=NONE sp=NONE 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 E102D689D56; Sat, 11 Feb 2017 01:21:19 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0A78D689CFB for ; Sat, 11 Feb 2017 01:21:13 +0200 (EET) Received: by mail-lf0-f51.google.com with SMTP id z134so29905509lff.3 for ; Fri, 10 Feb 2017 15:21:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=vmYXrfOdVg2MaQZqk7crt1UGxqZ0Fj+IlvArAJhcENY=; b=A1OZq3KZRvxGSfxkjyXDz3lOR0+7KeJFM8d/Pk47RMOKe5cBPEv7v8hok/IEh0VXQt WzlaZL7Lp8YUWZmVpvMwN94ltngvg1OJ0FTc7OIymDB0naLOi9rCvTCKPJxyI8qZfEiX QqzcrIFS3uS1gUewnGjhL0w8niXOgOG3sZwZRRi37R/jG9YSUwhspG9mtwZfu6vYawYb Stj0kLA0MtOLW+0TlzkGI2jfRe2dZ31PskJXhz8nPFDT47iAGyy2mDOANynDBKUpHgSJ eYO44YjUryFPckRhEdncA3gA6dj3yICEIJshEebcfoylYgCDmaSHSyy4OPdttTnkDkxc xrpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=vmYXrfOdVg2MaQZqk7crt1UGxqZ0Fj+IlvArAJhcENY=; b=ryMFMv60WDhvTLDb7rML7FFK3Gk6kCe16+P0eT0HjVOOY8a2AvevVN4RCJ1UyS3uAk 0hhkKDyGya+xuWOTb9iR3rTxDfkRsMjxsxm0YcpE3sjzmt/glU6RiEhl2SPhrCR67j0S jk7j+cxAGTfluWLejjixquzhB2GmP42wIYrGmWr6Gc05+9BYUlpTh+EsXjxIgLhQ9tLw 3hkLWOJ7oSLm5iS0VcOB0lwNJwXXRjQdRpaBiuxos1zsTGSh9I7jpfUN20J1fivI+XAt n9zxLB1L8nb9Hmsdwy1f7ypFRdkyokkkGJQmhHK6fG+JuRFuyg/IqEtqahRSOt7/CSgQ 9fJQ== X-Gm-Message-State: AMke39lo8veMJjblkp+A02dmybTLRvhIt59Bgk1tN8hwK4uS+WJS6xB7Wc0/H5EwtxN9KQ== X-Received: by 10.25.39.4 with SMTP id n4mr3661051lfn.0.1486768876295; Fri, 10 Feb 2017 15:21:16 -0800 (PST) Received: from localhost.localdomain (a88-114-245-102.elisa-laajakaista.fi. [88.114.245.102]) by smtp.gmail.com with ESMTPSA id p11sm870251lfd.20.2017.02.10.15.21.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Feb 2017 15:21:15 -0800 (PST) From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 Feb 2017 01:21:14 +0200 Message-Id: <20170210232114.28009-1-jeebjp@gmail.com> X-Mailer: git-send-email 2.9.3 Subject: [FFmpeg-devel] [PATCH] movenc: add support for track names in ISML manifests 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This enables having multiple tracks of the same type which would be treated as different things by the media server (as opposed to different bit rate versions of the same track). According to the smooth streaming specification, just setting the systemLanguage tag is not enough to note that a track with the same attributes differs from another one. --- libavformat/movenc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index a58b6a4..a286210 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -3645,6 +3645,7 @@ static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov, AVFormat MOVTrack *track = &mov->tracks[i]; const char *type; int track_id = track->track_id; + char track_name_buf[32] = { 0 }; AVStream *st = track->st; AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0); @@ -3670,6 +3671,23 @@ static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov, AVFormat param_write_int(pb, "systemBitrate", manifest_bit_rate); param_write_int(pb, "trackID", track_id); param_write_string(pb, "systemLanguage", lang ? lang->value : "und"); + + /* Build track name piece by piece: */ + /* 1. track type */ + av_strlcat(track_name_buf, type, sizeof(track_name_buf)); + /* 2. track language, if available */ + if (lang) + av_strlcatf(track_name_buf, sizeof(track_name_buf), + "_%s", lang->value); + /* 3. special type suffix */ + /* "_cc" = closed captions, "_ad" = audio_description */ + if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) + av_strlcat(track_name_buf, "_cc", sizeof(track_name_buf)); + else if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) + av_strlcat(track_name_buf, "_ad", sizeof(track_name_buf)); + + param_write_string(pb, "trackName", track_name_buf); + if (track->par->codec_type == AVMEDIA_TYPE_VIDEO) { if (track->par->codec_id == AV_CODEC_ID_H264) { uint8_t *ptr;