[FFmpeg-devel] [PATCH v2 2/2] lavf/movenc: cosmetics

2019-10-29 Thread Yuki.Tsuchiya
Signed-off-by: Yuki.Tsuchiya 
---
 libavformat/movenc.c | 72 +++-
 1 file changed, 38 insertions(+), 34 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index ff234d9..85f978a 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2411,7 +2411,9 @@ static int mov_preroll_write_stbl_atoms(AVIOContext *pb, 
MOVTrack *track)
 if (!sgpd_entries)
 return AVERROR(ENOMEM);
 
-av_assert0(track->par->codec_id == AV_CODEC_ID_OPUS || 
track->par->codec_id == AV_CODEC_ID_AAC || track->par->codec_id == 
AV_CODEC_ID_MPEGH_3D_AUDIO);
+av_assert0(track->par->codec_id == AV_CODEC_ID_OPUS ||
+   track->par->codec_id == AV_CODEC_ID_AAC ||
+   track->par->codec_id == AV_CODEC_ID_MPEGH_3D_AUDIO);
 
 if (track->par->codec_id == AV_CODEC_ID_OPUS) {
 for (i = 0; i < track->entry; i++) {
@@ -2513,7 +2515,9 @@ static int mov_write_stbl_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContext
 if (track->cenc.aes_ctr) {
 ff_mov_cenc_write_stbl_atoms(>cenc, pb);
 }
-if (track->par->codec_id == AV_CODEC_ID_OPUS || track->par->codec_id == 
AV_CODEC_ID_AAC || track->par->codec_id == AV_CODEC_ID_MPEGH_3D_AUDIO) {
+if (track->par->codec_id == AV_CODEC_ID_OPUS ||
+track->par->codec_id == AV_CODEC_ID_AAC ||
+track->par->codec_id == AV_CODEC_ID_MPEGH_3D_AUDIO) {
 mov_preroll_write_stbl_atoms(pb, track);
 }
 return update_size(pb, pos);
@@ -6847,39 +6851,39 @@ static const AVCodecTag codec_3gp_tags[] = {
 };
 
 const AVCodecTag codec_mp4_tags[] = {
-{ AV_CODEC_ID_MPEG4   , MKTAG('m', 'p', '4', 'v') },
-{ AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') },
-{ AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '3') },
-{ AV_CODEC_ID_HEVC, MKTAG('h', 'e', 'v', '1') },
-{ AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1') },
-{ AV_CODEC_ID_MPEG2VIDEO  , MKTAG('m', 'p', '4', 'v') },
-{ AV_CODEC_ID_MPEG1VIDEO  , MKTAG('m', 'p', '4', 'v') },
-{ AV_CODEC_ID_MJPEG   , MKTAG('m', 'p', '4', 'v') },
-{ AV_CODEC_ID_PNG , MKTAG('m', 'p', '4', 'v') },
-{ AV_CODEC_ID_JPEG2000, MKTAG('m', 'p', '4', 'v') },
-{ AV_CODEC_ID_VC1 , MKTAG('v', 'c', '-', '1') },
-{ AV_CODEC_ID_DIRAC   , MKTAG('d', 'r', 'a', 'c') },
-{ AV_CODEC_ID_TSCC2   , MKTAG('m', 'p', '4', 'v') },
-{ AV_CODEC_ID_VP9 , MKTAG('v', 'p', '0', '9') },
-{ AV_CODEC_ID_AV1 , MKTAG('a', 'v', '0', '1') },
-{ AV_CODEC_ID_AAC , MKTAG('m', 'p', '4', 'a') },
-{ AV_CODEC_ID_MP4ALS  , MKTAG('m', 'p', '4', 'a') },
-{ AV_CODEC_ID_MP3 , MKTAG('m', 'p', '4', 'a') },
-{ AV_CODEC_ID_MP2 , MKTAG('m', 'p', '4', 'a') },
-{ AV_CODEC_ID_AC3 , MKTAG('a', 'c', '-', '3') },
-{ AV_CODEC_ID_EAC3, MKTAG('e', 'c', '-', '3') },
-{ AV_CODEC_ID_DTS , MKTAG('m', 'p', '4', 'a') },
-{ AV_CODEC_ID_TRUEHD  , MKTAG('m', 'l', 'p', 'a') },
-{ AV_CODEC_ID_FLAC, MKTAG('f', 'L', 'a', 'C') },
-{ AV_CODEC_ID_OPUS, MKTAG('O', 'p', 'u', 's') },
-{ AV_CODEC_ID_VORBIS  , MKTAG('m', 'p', '4', 'a') },
-{ AV_CODEC_ID_QCELP   , MKTAG('m', 'p', '4', 'a') },
-{ AV_CODEC_ID_EVRC, MKTAG('m', 'p', '4', 'a') },
-{ AV_CODEC_ID_DVD_SUBTITLE, MKTAG('m', 'p', '4', 's') },
-{ AV_CODEC_ID_MOV_TEXT, MKTAG('t', 'x', '3', 'g') },
-{ AV_CODEC_ID_BIN_DATA, MKTAG('g', 'p', 'm', 'd') },
+{ AV_CODEC_ID_MPEG4 , MKTAG('m', 'p', '4', 'v') },
+{ AV_CODEC_ID_H264  , MKTAG('a', 'v', 'c', '1') },
+{ AV_CODEC_ID_H264  , MKTAG('a', 'v', 'c', '3') },
+{ AV_CODEC_ID_HEVC  , MKTAG('h', 'e', 'v', '1') },
+{ AV_CODEC_ID_HEVC  , MKTAG('h', 'v', 'c', '1') },
+{ AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', '4', 'v') },
+{ AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', '4', 'v') },
+{ AV_CODEC_ID_MJPEG , MKTAG('m', 'p', '4', 'v') },
+{ AV_CODEC_ID_PNG   , MKTAG('m', 'p', '4', 'v') },
+{ AV_CODEC_ID_JPEG2000  , MKTAG('m', 'p', '4', 'v') },
+{ AV_CODEC_ID_VC1   , MKTAG('v', 'c', '-', '1') },
+{ AV_CODEC_ID_DIRAC , MKTAG('d', 'r', 'a', 'c') },
+{ AV_CODEC_ID_TSCC2 , MKTAG('m', 'p', '4', 'v') },
+{ AV_CODEC_ID_VP9   , MKTAG('v', 'p', '0', '9') },
+{ AV_CODEC_ID_AV1   , MKTAG('a', 'v', '0', '1') },
+{ AV_CODEC_ID_AAC   , MKTAG('m', 'p', '4', 'a') },
+{ AV_CODEC_ID_MP4ALS, MKTAG('m', 'p', '4', 'a') },
+{ AV_CODEC_ID_MP3   , MKTAG('m', 'p', '4', 'a') },
+{ AV_CODEC_ID_MP2   , MKTAG('m', 'p', '4', 'a') },
+{ AV_CODEC_ID_AC3   , MKTAG('a', 'c', '-', '3') },
+{ AV_CODEC_ID_EAC3  , MKTAG('e', 'c', '-', '3') },
+{ AV_CODE

[FFmpeg-devel] [PATCH v2 1/2] lavf/isom: support for demuxing MPEG-H 3D Audio in MP4

2019-10-29 Thread Yuki.Tsuchiya
Implemented according to the specification at 
https://www.iso.org/standard/69561.html
The 'mhm1' sample entry is registered with MP4RA, which is defined as MHAS 
encapsulated single stream MPEG-H 3D Audio.
'MHAS' stands for MPEG-H audio stream, which contains encoded audio data and 
corresponds metadata for decoding.
This patch enables extracting the MHAS bitstream from MP4.

Signed-off-by: Yuki.Tsuchiya 
---
 Changelog   | 1 +
 libavcodec/avcodec.h| 1 +
 libavcodec/codec_desc.c | 7 +++
 libavcodec/version.h| 2 +-
 libavformat/isom.c  | 1 +
 libavformat/movenc.c| 6 --
 libavformat/utils.c | 3 ++-
 7 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/Changelog b/Changelog
index 7c971fc..afb3bff 100644
--- a/Changelog
+++ b/Changelog
@@ -20,6 +20,7 @@ version :
 - maskedmin and maskedmax filters
 - VDPAU VP9 hwaccel
 - median filter
+- Support for demuxing MPEG-H 3D Audio in mp4
 
 
 version 4.2:
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index bcb931f..8c1a85d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -654,6 +654,7 @@ enum AVCodecID {
 AV_CODEC_ID_ATRAC9,
 AV_CODEC_ID_HCOM,
 AV_CODEC_ID_ACELP_KELVIN,
+AV_CODEC_ID_MPEGH_3D_AUDIO,
 
 /* subtitle codecs */
 AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,  ///< A dummy ID pointing at 
the start of subtitle codecs.
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 0602ecb..a970fae 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2998,6 +2998,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Sipro ACELP.KELVIN"),
 .props = AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_MPEGH_3D_AUDIO,
+.type  = AVMEDIA_TYPE_AUDIO,
+.name  = "mpegh_3d_audio",
+.long_name = NULL_IF_CONFIG_SMALL("MPEG-H 3D Audio"),
+.props = AV_CODEC_PROP_LOSSY,
+},
 
 /* subtitle codecs */
 {
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 27c126e..64e2365 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  60
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavformat/isom.c b/libavformat/isom.c
index edd0d81..824e811 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -371,6 +371,7 @@ const AVCodecTag ff_codec_movaudio_tags[] = {
 { AV_CODEC_ID_FLAC,MKTAG('f', 'L', 'a', 'C') }, /* nonstandard 
*/
 { AV_CODEC_ID_TRUEHD,  MKTAG('m', 'l', 'p', 'a') }, /* mp4ra.org */
 { AV_CODEC_ID_OPUS,MKTAG('O', 'p', 'u', 's') }, /* mp4ra.org */
+{ AV_CODEC_ID_MPEGH_3D_AUDIO,  MKTAG('m', 'h', 'm', '1') }, /* MPEG-H 3D 
Audio bitstream */
 { AV_CODEC_ID_NONE, 0 },
 };
 
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 715bec1..ff234d9 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2411,7 +2411,7 @@ static int mov_preroll_write_stbl_atoms(AVIOContext *pb, 
MOVTrack *track)
 if (!sgpd_entries)
 return AVERROR(ENOMEM);
 
-av_assert0(track->par->codec_id == AV_CODEC_ID_OPUS || 
track->par->codec_id == AV_CODEC_ID_AAC);
+av_assert0(track->par->codec_id == AV_CODEC_ID_OPUS || 
track->par->codec_id == AV_CODEC_ID_AAC || track->par->codec_id == 
AV_CODEC_ID_MPEGH_3D_AUDIO);
 
 if (track->par->codec_id == AV_CODEC_ID_OPUS) {
 for (i = 0; i < track->entry; i++) {
@@ -2493,6 +2493,7 @@ static int mov_write_stbl_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContext
 mov_write_stts_tag(pb, track);
 if ((track->par->codec_type == AVMEDIA_TYPE_VIDEO ||
  track->par->codec_id == AV_CODEC_ID_TRUEHD ||
+ track->par->codec_id == AV_CODEC_ID_MPEGH_3D_AUDIO ||
  track->par->codec_tag == MKTAG('r','t','p',' ')) &&
 track->has_keyframes && track->has_keyframes < track->entry)
 mov_write_stss_tag(pb, track, MOV_SYNC_SAMPLE);
@@ -2512,7 +2513,7 @@ static int mov_write_stbl_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContext
 if (track->cenc.aes_ctr) {
 ff_mov_cenc_write_stbl_atoms(>cenc, pb);
 }
-if (track->par->codec_id == AV_CODEC_ID_OPUS || track->par->codec_id == 
AV_CODEC_ID_AAC) {
+if (track->par->codec_id == AV_CODEC_ID_OPUS || track->par->codec_id == 
AV_CODEC_ID_AAC || track->par->codec_id == AV_CODEC_ID_MPEGH_3D_AUDIO) {
 mov_preroll_write_stbl_atoms(pb, track);
 }
 return update_size(pb, pos);
@@ -6877,6 +6878,7 @@ const AVCodecTag codec_mp4_tags[] = {
  

[FFmpeg-devel] [PATCH v2 0/2] lavf/isom: support for demuxing MPEG-H 3D Audio in MP4

2019-10-29 Thread Yuki.Tsuchiya
Hi,



Here is the sample content of the MPEG-H 3D Audio.
https://www.filehosting.org/file/details/829625/mpeg-h_3d_audio_mhm1_sample.mp4

> If this patch allows remuxing with ffmpeg (I believe it does) but if the 
> output file is not compatible with something that supports mpeg-h 3D audio, 
> the patch has to be changed before it can be committed. 
I added some codes for copying mandatory boxes. I confirmed with following 
command that the remuxed.mp4 is compatible with MPEG-H 3D Audio standard.



  ffmpeg -i mpegh_3d_audio_mhm1_sample.mp4 -codec:a copy remuxed.mp4

Yuki.Tsuchiya (2):
  lavf/isom: support for demuxing MPEG-H 3D Audio in MP4
  lavf/movenc: cosmetics

 Changelog   |  1 +
 libavcodec/avcodec.h|  1 +
 libavcodec/codec_desc.c |  7 +
 libavcodec/version.h|  2 +-
 libavformat/isom.c  |  1 +
 libavformat/movenc.c| 74 ++---
 libavformat/utils.c |  3 +-
 7 files changed, 53 insertions(+), 36 deletions(-)

-- 
2.7.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] lavf/isom: support for demuxing MPEG-H 3D Audio in MP4

2019-10-17 Thread Yuki.Tsuchiya
Implemented according to the specification at 
https://www.iso.org/standard/69561.html
The 'mhm1' sample entry is registered with MP4RA, which is defined as MHAS 
encapsulated single stream MPEG-H 3D Audio.
'MHAS' stands for MPEG-H audio stream, which contains encoded audio data and 
corresponds metadata for decoding.
This patch enables extracting the MHAS bitstream from MP4.

Signed-off-by: Yuki.Tsuchiya 
---
 Changelog   | 1 +
 libavcodec/avcodec.h| 1 +
 libavcodec/codec_desc.c | 7 +++
 libavcodec/version.h| 2 +-
 libavformat/isom.c  | 1 +
 5 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 44e4184..2a79a1a 100644
--- a/Changelog
+++ b/Changelog
@@ -16,6 +16,7 @@ version :
 - photosensitivity filter
 - anlms filter
 - arnndn filter
+- Support for demuxing MPEG-H 3D Audio in mp4
 
 
 version 4.2:
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index bcb931f..8c1a85d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -654,6 +654,7 @@ enum AVCodecID {
 AV_CODEC_ID_ATRAC9,
 AV_CODEC_ID_HCOM,
 AV_CODEC_ID_ACELP_KELVIN,
+AV_CODEC_ID_MPEGH_3D_AUDIO,
 
 /* subtitle codecs */
 AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,  ///< A dummy ID pointing at 
the start of subtitle codecs.
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 0602ecb..a970fae 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2998,6 +2998,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Sipro ACELP.KELVIN"),
 .props = AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_MPEGH_3D_AUDIO,
+.type  = AVMEDIA_TYPE_AUDIO,
+.name  = "mpegh_3d_audio",
+.long_name = NULL_IF_CONFIG_SMALL("MPEG-H 3D Audio"),
+.props = AV_CODEC_PROP_LOSSY,
+},
 
 /* subtitle codecs */
 {
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 2e047a6..0992d1e 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  59
-#define LIBAVCODEC_VERSION_MICRO 102
+#define LIBAVCODEC_VERSION_MICRO 103
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavformat/isom.c b/libavformat/isom.c
index edd0d81..c1a64c7 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -371,6 +371,7 @@ const AVCodecTag ff_codec_movaudio_tags[] = {
 { AV_CODEC_ID_FLAC,MKTAG('f', 'L', 'a', 'C') }, /* nonstandard 
*/
 { AV_CODEC_ID_TRUEHD,  MKTAG('m', 'l', 'p', 'a') }, /* mp4ra.org */
 { AV_CODEC_ID_OPUS,MKTAG('O', 'p', 'u', 's') }, /* mp4ra.org */
+{ AV_CODEC_ID_MPEGH_3D_AUDIO,  MKTAG('m', 'h', 'm', '1') }, /* MPEG-H 3D 
Audio */
 { AV_CODEC_ID_NONE, 0 },
 };
 
-- 
2.7.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".