From patchwork Sat Nov 19 16:37:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Dekker X-Patchwork-Id: 1488 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp713758vsb; Sat, 19 Nov 2016 08:37:17 -0800 (PST) X-Received: by 10.28.36.193 with SMTP id k184mr4202894wmk.40.1479573437140; Sat, 19 Nov 2016 08:37:17 -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 g29si6681646wmi.66.2016.11.19.08.37.16; Sat, 19 Nov 2016 08:37:17 -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=@itanimul.li; dkim=neutral (body hash did not verify) header.i=@messagingengine.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 C1492689F6C; Sat, 19 Nov 2016 18:37:12 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F3D42689B6E for ; Sat, 19 Nov 2016 18:37:05 +0200 (EET) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 776572072D for ; Sat, 19 Nov 2016 11:37:06 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Sat, 19 Nov 2016 11:37:06 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=itanimul.li; h= date:from:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc:x-sasl-enc; s=mesmtp; bh=kO9sGBha9wwTWFx8Zqd59JEbpvI =; b=j+Pv88hYjNBs1fBgJ0stdpiTL8iIQZWb2FXYwKr6W3Ap6E8Xsa/5tBdN0ug 18tIedvCUehlalcdeQleAXa93Cvdzq9W+M0anlThr/eq/cMHr8nhQmxnYs6UcPg7 RkwXDEcVM6Ch8T/lJrWXXZetDYxXxU8LMcIdEpK5fMihCU1o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=kO 9sGBha9wwTWFx8Zqd59JEbpvI=; b=uxHasUE2fP/95m/5VfqrYn05LUOFV6vHGR fMHjA00nZ3BDgsKBw3nbQ/jugbooYnzXCm9CyJr8rzlffuGL5RpEcYcL2ct08lfR d3DyHGh6FhWlULlPdR/9/3AcW37KokE3jh7OkiRLsRUgk5yT3q4o+Ezkx4b6sLDJ mouEVHQ6w= X-ME-Sender: X-Sasl-enc: ssRS46ypyqOEN9y6TjVMan3lbXOkjVPV03Js0vmhXTbP 1479573425 Received: from localhost (cpc76692-cosh16-2-0-cust283.6-1.cable.virginm.net [86.2.81.28]) by mail.messagingengine.com (Postfix) with ESMTPA id DF37B7E2E1 for ; Sat, 19 Nov 2016 11:37:05 -0500 (EST) From: Josh de Kock To: ffmpeg-devel@ffmpeg.org Date: Sat, 19 Nov 2016 16:37:00 +0000 Message-Id: <20161119163700.58344-1-josh@itanimul.li> X-Mailer: git-send-email 2.9.3 (Apple Git-75) Subject: [FFmpeg-devel] [RFC] lavf: add CoreMedia AVCodecTag mappings 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" I've mapped a fair amount of the CoreMedia FourCCs to their respective AVCodecIDs. The ones I didn't know or thought didn't exist in FFmpeg have been mapped to AV_CODEC_ID_NONE. Signed-off-by: Josh de Kock --- libavformat/Makefile | 1 + libavformat/avformat.h | 32 ++++++++++ libavformat/coremedia.c | 165 ++++++++++++++++++++++++++++++++++++++++++++++++ libavformat/coremedia.h | 36 +++++++++++ 4 files changed, 234 insertions(+) create mode 100644 libavformat/coremedia.c create mode 100644 libavformat/coremedia.h diff --git a/libavformat/Makefile b/libavformat/Makefile index f93658d..89ba8c7 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -10,6 +10,7 @@ OBJS = allformats.o \ avio.o \ aviobuf.o \ cutils.o \ + coremedia.o \ dump.o \ format.o \ id3v1.o \ diff --git a/libavformat/avformat.h b/libavformat/avformat.h index f9f4d72..a29e892 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -2865,6 +2865,38 @@ const struct AVCodecTag *avformat_get_mov_video_tags(void); * @return the table mapping MOV FourCCs for audio to AVCodecID. */ const struct AVCodecTag *avformat_get_mov_audio_tags(void); +/** + * @return the table mapping Apple's CoreMedia FourCCs for video to AVCodecID. + */ +const struct AVCodecTag *avformat_get_coremedia_video_tags(void); +/** + * @return the table mapping Apple's CoreMedia FourCCs for audio to AVCodecID. + */ +const struct AVCodecTag *avformat_get_coremedia_audio_tags(void); +/** + * @return the table mapping Apple's CoreMedia FourCCs for muxed data to AVCodecID. + */ +const struct AVCodecTag *avformat_get_coremedia_muxed_tags(void); +/** + * @return the table mapping Apple's CoreMedia FourCCs for subtitle to AVCodecID. + */ +const struct AVCodecTag *avformat_get_coremedia_subtitle_tags(void); +/** + * @return the table mapping Apple's CoreMedia FourCCs for closed captions to AVCodecID. + */ +const struct AVCodecTag *avformat_get_coremedia_closedcaption_tags(void); +/** + * @return the table mapping Apple's CoreMedia FourCCs for metadata to AVCodecID. + */ +const struct AVCodecTag *avformat_get_coremedia_metadata_tags(void); +/** + * @return the table mapping Apple's CoreMedia FourCCs for text to AVCodecID. + */ +const struct AVCodecTag *avformat_get_coremedia_text_tags(void); +/** + * @return the table mapping Apple's CoreMedia FourCCs for timecode to AVCodecID. + */ +const struct AVCodecTag *avformat_get_coremedia_timecode_tags(void); /** * @} diff --git a/libavformat/coremedia.c b/libavformat/coremedia.c new file mode 100644 index 0000000..16eb2bd --- /dev/null +++ b/libavformat/coremedia.c @@ -0,0 +1,165 @@ +/* + * CoreMedia routines + * Copyright (c) 2016 Josh de Kock + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavcodec/avcodec.h" +#include "avformat.h" +#include "libavformat/coremedia.h" + +const AVCodecTag ff_coremedia_muxed_tags[] = { + { AV_CODEC_ID_DVVIDEO, MKBETAG('d','v',' ',' ') }, + /**< MPEG-1 System stream */ + { AV_CODEC_ID_NONE, MKBETAG('m','p','1','s') }, + /**< MPEG-2 Transport stream */ + { AV_CODEC_ID_MPEG2TS, MKBETAG('m','p','2','t') }, + /**< MPEG-2 Program stream */ + { AV_CODEC_ID_NONE, MKBETAG('m','p','2','p') }, + /**< DV stream */ + { AV_CODEC_ID_DVVIDEO, MKBETAG('d','v',' ',' ') }, + { 0 } +}; + +const AVCodecTag ff_coremedia_video_tags[] = { + /**< Component Y'CbCr 8-bit 4:2:2 ordered Cb Y'0 Cr Y'1 */ + { AV_CODEC_ID_NONE, MKBETAG('2','v','u','y') }, + /**< Apple Animation format */ + { AV_CODEC_ID_QTRLE, MKBETAG('r','l','e',' ') }, + /**< Cinepak format */ + { AV_CODEC_ID_CINEPAK, MKBETAG('c','v','i','d') }, + /**< Joint Photographic Experts Group (JPEG) format */ + { AV_CODEC_ID_MJPEG, MKBETAG('j','p','e','g') }, + /**< JPEG format with Open-DML extensions */ + { AV_CODEC_ID_NONE, MKBETAG('d','m','b','1') }, + /**< Sorenson video format */ + { AV_CODEC_ID_SVQ1, MKBETAG('S','V','Q','1') }, + /**< Sorenson 3 video format */ + { AV_CODEC_ID_SVQ3, MKBETAG('S','V','Q','3') }, + /**< ITU-T H.263 format */ + { AV_CODEC_ID_H263, MKBETAG('h','2','6','3') }, + /**< ITU-T H.264 format (AKA ISO/IEC 14496-10 - MPEG-4 Part 10, Advanced Video Coding format) */ + { AV_CODEC_ID_H264, MKBETAG('a','v','c','1') }, + /**< ITU-T HEVC format */ + { AV_CODEC_ID_HEVC, MKBETAG('h','v','c','1') }, + /**< ISO/IEC Moving Picture Experts Group (MPEG) MPEG-4 Part 2 video format */ + { AV_CODEC_ID_MPEG4, MKBETAG('m','p','4','v') }, + /**< MPEG-2 video format */ + { AV_CODEC_ID_MPEG2VIDEO, MKBETAG('m','p','2','v') }, + /**< MPEG-1 video format */ + { AV_CODEC_ID_MPEG1VIDEO, MKBETAG('m','p','1','v') }, + /**< DV NTSC format */ + { AV_CODEC_ID_DVVIDEO, MKBETAG('d','v','c',' ') }, + /**< DV PAL format */ + { AV_CODEC_ID_DVVIDEO, MKBETAG('d','v','c','p') }, + /**< Panasonic DVCPro PAL format */ + { AV_CODEC_ID_DVVIDEO, MKBETAG('d','v','p','p') }, + /**< Panasonic DVCPro-50 NTSC format */ + { AV_CODEC_ID_DVVIDEO, MKBETAG('d','v','5','n') }, + /**< Panasonic DVCPro-50 PAL format */ + { AV_CODEC_ID_DVVIDEO, MKBETAG('d','v','5','p') }, + /**< Panasonic DVCPro-HD 720p60 format */ + { AV_CODEC_ID_DVVIDEO, MKBETAG('d','v','h','p') }, + /**< Panasonic DVCPro-HD 720p50 format */ + { AV_CODEC_ID_DVVIDEO, MKBETAG('d','v','h','q') }, + /**< Panasonic DVCPro-HD 1080i60 format */ + { AV_CODEC_ID_DVVIDEO, MKBETAG('d','v','h','6') }, + /**< Panasonic DVCPro-HD 1080i50 format */ + { AV_CODEC_ID_DVVIDEO, MKBETAG('d','v','h','5') }, + /**< Panasonic DVCPro-HD 1080p30 format */ + { AV_CODEC_ID_DVVIDEO, MKBETAG('d','v','h','3') }, + /**< Panasonic DVCPro-HD 1080p25 format */ + { AV_CODEC_ID_DVVIDEO, MKBETAG('d','v','h','2') }, + /**< Apple ProRes 4444 format */ + { AV_CODEC_ID_PRORES, MKBETAG('a','p','4','h') }, + /**< Apple ProRes 422 HQ format */ + { AV_CODEC_ID_PRORES, MKBETAG('a','p','c','h') }, + /**< Apple ProRes 422 format */ + { AV_CODEC_ID_PRORES, MKBETAG('a','p','c','n') }, + /**< Apple ProRes 422 LT format */ + { AV_CODEC_ID_PRORES, MKBETAG('a','p','c','s') }, + /**< Apple ProRes 422 Proxy format */ + { AV_CODEC_ID_PRORES, MKBETAG('a','p','c','o') }, + { 0 } +}; +const AVCodecTag ff_coremedia_audio_tags[] = { + /**< iTMS protected low-complexity AAC */ + { AV_CODEC_ID_NONE, MKBETAG('p','a','a','c') }, + /**< Audible's protected AAC */ + { AV_CODEC_ID_NONE, MKBETAG('a','a','a','c') }, + { 0 } +}; +const AVCodecTag ff_coremedia_metadata_tags[] = { + /**< SHOUTCast format */ + { AV_CODEC_ID_NONE, MKBETAG('i','c','y',' ') }, + /**< ID3 format */ + { AV_CODEC_ID_TIMED_ID3, MKBETAG('i','d','3',' ') }, + /**< Boxed format */ + { AV_CODEC_ID_NONE, MKBETAG('m','e','b','x') }, +}; +const AVCodecTag ff_coremedia_timecode_tags[] = { + /**< 32-bit timeCode sample */ + { AV_CODEC_ID_NONE, MKBETAG('t','m','c','d') }, + /**< 64-bit timeCode sample */ + { AV_CODEC_ID_NONE, MKBETAG('t','c','6','4') }, + /**< 32-bit counter-mode sample */ + { AV_CODEC_ID_NONE, MKBETAG('c','n','3','2') }, + /**< 64-bit counter-mode sample */ + { AV_CODEC_ID_NONE, MKBETAG('c','n','6','4') }, + { 0 } +}; +const AVCodecTag ff_coremedia_subtitle_tags[] = { + /**< 3GPP Text media/MPEG-4 Part 17 */ + { AV_CODEC_ID_MOV_TEXT, MKBETAG('t','x','3','g') }, + /**< WebVTT (Web Video Text Tracks) */ + { AV_CODEC_ID_WEBVTT, MKBETAG('w','v','t','t') }, + { 0 } +}; +const AVCodecTag ff_coremedia_closedcaption_tags[] = { + /**< CEA 608-compliant samples */ + { AV_CODEC_ID_EIA_608, MKBETAG('c','6','0','8') }, + /**< CEA 708-compliant samples */ + { AV_CODEC_ID_NONE, MKBETAG('c','7','0','8') }, + /**< ATSC/52 part-4 compliant samples */ + { AV_CODEC_ID_NONE, MKBETAG('a','t','c','c') }, + { 0 } +}; +const AVCodecTag ff_coremedia_text_tags[] = { + /**< QuickTime Text media */ + { AV_CODEC_ID_NONE, MKBETAG('t','e','x','t') }, + /**< 3GPP Text media/MPEG-4 Part 17 */ + { AV_CODEC_ID_MOV_TEXT, MKBETAG('t','x','3','g') }, + { 0 } +}; + + +#define avformat_get_coremedia_tags(type) \ + const struct AVCodecTag *avformat_get_coremedia_ ## type ## _tags(void) { \ + return ff_coremedia_ ## type ## _tags; \ + } + +avformat_get_coremedia_tags(muxed); +avformat_get_coremedia_tags(video); +avformat_get_coremedia_tags(audio); +avformat_get_coremedia_tags(subtitle); +avformat_get_coremedia_tags(timecode); +avformat_get_coremedia_tags(text); +avformat_get_coremedia_tags(metadata); +avformat_get_coremedia_tags(closedcaption); + +#undef avformat_get_coremedia_tags diff --git a/libavformat/coremedia.h b/libavformat/coremedia.h new file mode 100644 index 0000000..20e99c5 --- /dev/null +++ b/libavformat/coremedia.h @@ -0,0 +1,36 @@ +/* + * CoreMedia routines + * Copyright (c) 2016 Josh de Kock + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_COREMEDIA_H +#define AVFORMAT_COREMEDIA_H + +#include "internal.h" + +extern const struct AVCodecTag ff_coremedia_muxed_tags[]; +extern const struct AVCodecTag ff_coremedia_video_tags[]; +extern const struct AVCodecTag ff_coremedia_audio_tags[]; +extern const struct AVCodecTag ff_coremedia_subtitle_tags[]; +extern const struct AVCodecTag ff_coremedia_closedcaption_tags[]; +extern const struct AVCodecTag ff_coremedia_text_tags[]; +extern const struct AVCodecTag ff_coremedia_subtitle_tags[]; +extern const struct AVCodecTag ff_coremedia_metadata_tags[]; + +#endif /* AVFORMAT_COREMEDIA_H */