Skip to content

Commit

Permalink
[ffmpeg] Add MVC support from Koying
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed May 22, 2015
1 parent c3a5830 commit c04ccf6
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/depends/target/ffmpeg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
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
Expand Down Expand Up @@ -85,6 +86,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
cd $(PLATFORM); patch -p1 < ../0001-libavformat-add-mvcC-handling-in-.mov-.mp4.patch
cd $(PLATFORM); patch -p1 < ../hevcdsp_ARM_NEON_optimized_epel_functions.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)" \
Expand Down
82 changes: 82 additions & 0 deletions tools/depends/target/ffmpeg/add_h264_MVC_support.patch
Original file line number Diff line number Diff line change
@@ -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 c04ccf6

Please sign in to comment.