Skip to content
Permalink
Browse files

[ffmpeg] Add MVC support from Koying

  • Loading branch information...
popcornmix committed May 16, 2015
1 parent f5d0c05 commit 26f644d3d9de74e53b90b2253ccf6ff2a84a66b5
Showing with 85 additions and 1 deletion.
  1. +3 −1 tools/depends/target/ffmpeg/Makefile
  2. +82 −0 tools/depends/target/ffmpeg/add_h264_MVC_support.patch
@@ -5,7 +5,8 @@ DEPS= ../../Makefile.include FFMPEG-VERSION Makefile ffmpeg_Speed_up_wtv_index_c
0001-Discard-data-before-VO-VOL-in-mpeg-4-over-mpegts.patch \
0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch \
hevcdsp_ARM_NEON_optimized_epel_functions.patch added_ARM_NEON_optimized_SAO_patches.patch \
pfcd_hevc_optimisations.patch
pfcd_hevc_optimisations.patch \
add_h264_MVC_support.patch

# set to "yes" to enable patching
# we don't apply patches until we move to a vanilla ffmpeg tarball
@@ -86,6 +87,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
cd $(PLATFORM); patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.patch
cd $(PLATFORM); patch -p1 < ../added_ARM_NEON_optimized_SAO_patches.patch
cd $(PLATFORM); patch -p1 < ../pfcd_hevc_optimisations.patch
cd $(PLATFORM); patch -p1 < ../add_h264_MVC_support.patch

cd $(PLATFORM);\
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \
@@ -0,0 +1,82 @@
From 437127b0d709b7ce660816807e31cf5bbad55c0b Mon Sep 17 00:00:00 2001
From: "Chris \"koying\" Browet" <cbro@semperpax.com>
Date: Mon, 11 May 2015 15:02:11 +0200
Subject: [PATCH] add h264 MVC support

---
libavcodec/avcodec.h | 4 ++++
libavcodec/h264.c | 6 ++++++
libavcodec/h264.h | 3 +++
libavformat/mov.c | 29 +++++++++++++++++++++++++++++
libavformat/mpegts.c | 4 +++-
5 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 4ea6e5a..c7e9492 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -292,6 +292,10 @@ enum AVCodecID {
AV_CODEC_ID_MVC2_DEPRECATED,
AV_CODEC_ID_HQX,

+ /* H264 MVC type */
+ AV_CODEC_ID_H264MVC = MKBETAG('M','V','C','C'),
+
+
AV_CODEC_ID_BRENDER_PIX= MKBETAG('B','P','I','X'),
AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),
AV_CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'),
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 6529d98..8bcf0e1 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1668,6 +1668,12 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size,
case NAL_SPS_EXT:
case NAL_AUXILIARY_SLICE:
break;
+ case NAL_14:
+ case NAL_15:
+ case NAL_20:
+ av_log(avctx, AV_LOG_ERROR, "NAL type: %d for MVC\n", hx->nal_unit_type);
+ avctx->codec_tag = AV_CODEC_ID_H264MVC;
+ break;
case NAL_FF_IGNORE:
break;
default:
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 5cb7851..22b09a9 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -122,7 +122,10 @@ enum {
NAL_END_STREAM = 11,
NAL_FILLER_DATA = 12,
NAL_SPS_EXT = 13,
+ NAL_14 = 14,
+ NAL_15 = 15,
NAL_AUXILIARY_SLICE = 19,
+ NAL_20 = 20,
NAL_FF_IGNORE = 0xff0f001,
};

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 336d869..067deee 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -679,7 +679,7 @@ static const StreamType ISO_types[] = {
{ 0x11, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC_LATM }, /* LATM syntax */
#endif
{ 0x1b, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 },
- { 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 },
+ { 0x20, AVMEDIA_TYPE_DATA, AV_CODEC_ID_H264 },
{ 0x24, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC },
{ 0x42, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_CAVS },
{ 0xd1, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_DIRAC },
@@ -813,6 +813,8 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
sub_pes->sub_st = pes->sub_st = sub_st;
}
}
+ if (pes->stream_type == 0x20) // MVC
+ st->codec->codec_tag = AV_CODEC_ID_H264MVC;
if (st->codec->codec_id == AV_CODEC_ID_NONE)
mpegts_find_stream_type(st, pes->stream_type, MISC_types);
if (st->codec->codec_id == AV_CODEC_ID_NONE) {

0 comments on commit 26f644d

Please sign in to comment.
You can’t perform that action at this time.