From 53b168cc10146206e49976e7b63b0b85e36c45cd Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 17 Oct 2014 20:53:57 +0200 Subject: [PATCH] libav muxer: added WEBM support --- Makefile.ffmpeg | 2 +- src/muxer.h | 1 + src/muxer/muxer_libav.c | 10 ++++++++++ src/muxer/tvh/mkmux.c | 4 ++++ src/profile.c | 1 + 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Makefile.ffmpeg b/Makefile.ffmpeg index 7d6bc7fd..fc72ff2f 100644 --- a/Makefile.ffmpeg +++ b/Makefile.ffmpeg @@ -57,7 +57,7 @@ EXTLIBS = libx264 libvorbis libvpx COMPONENTS = avutil avformat avcodec swresample swscale avresample DECODERS = mpeg2video mp2 ac3 eac3 h264 h264_vdpau aac aac_latm vorbis libvorbis ENCODERS = mpeg2video mp2 libx264 libvpx_vp8 libvpx_vp9 aac libaacplus vorbis libvorbis -MUXERS = mpegts mpeg2dvd matroska +MUXERS = mpegts mpeg2dvd matroska webm BSFS = h264_mp4toannexb LIBOGG = libogg-1.3.2 diff --git a/src/muxer.h b/src/muxer.h index d70c10fe..5ebb6f58 100644 --- a/src/muxer.h +++ b/src/muxer.h @@ -32,6 +32,7 @@ typedef enum { MC_RAW = 5, MC_WEBM = 6, MC_AVMATROSKA = 7, + MC_AVWEBM = 8, } muxer_container_type_t; typedef enum { diff --git a/src/muxer/muxer_libav.c b/src/muxer/muxer_libav.c index d2476e62..ea2d8d65 100644 --- a/src/muxer/muxer_libav.c +++ b/src/muxer/muxer_libav.c @@ -163,6 +163,12 @@ lav_muxer_support_stream(muxer_container_type_t mc, ret |= SCT_ISSUBTITLE(type); break; + case MC_WEBM: + case MC_AVWEBM: + ret |= type == SCT_VP8; + ret |= type == SCT_VORBIS; + break; + case MC_MPEGTS: ret |= (type == SCT_MPEG2VIDEO); ret |= (type == SCT_H264); @@ -517,6 +523,10 @@ lav_muxer_create(const muxer_config_t *m_cfg) case MC_AVMATROSKA: mux_name = "matroska"; break; + case MC_WEBM: + case MC_AVWEBM: + mux_name = "webm"; + break; default: mux_name = muxer_container_type2txt(m_cfg->m_type); break; diff --git a/src/muxer/tvh/mkmux.c b/src/muxer/tvh/mkmux.c index 0c8352cb..0c6d6c50 100644 --- a/src/muxer/tvh/mkmux.c +++ b/src/muxer/tvh/mkmux.c @@ -258,6 +258,10 @@ mk_build_tracks(mk_mux_t *mkm, const streaming_start_t *ss) mkm->tracks[i].sri = ssc->ssc_sri; mkm->tracks[i].nextpts = PTS_UNSET; + if (mkm->webm && ssc->ssc_type != SCT_VP8 && ssc->ssc_type != SCT_VORBIS) + tvhwarn("mkv", "WEBM format supports only VP8+VORBIS streams (detected %s)", + streaming_component_type2txt(ssc->ssc_type)); + switch(ssc->ssc_type) { case SCT_MPEG2VIDEO: tracktype = 1; diff --git a/src/profile.c b/src/profile.c index 9ad6c7ab..7d396569 100644 --- a/src/profile.c +++ b/src/profile.c @@ -646,6 +646,7 @@ profile_class_mc_list ( void *o ) { "MPEG-TS /av-lib", MC_MPEGTS }, { "MPEG-PS (DVD) /av-lib", MC_MPEGPS }, { "Matroska (mkv) /av-lib", MC_AVMATROSKA }, + { "WEBM /av-lib", MC_AVWEBM }, }; return strtab2htsmsg(tab); }