From bce2c52e63ddd22120b1b8a36f4de36f5b94cdb4 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 15 Oct 2014 12:05:20 +0200 Subject: [PATCH] Add VP9 stream type, but VP9 encoding does not work (1-pass VP9 encoder in libvpx is broken) --- src/esfilter.h | 2 +- src/libav.c | 6 ++++++ src/muxer/tvh/mkmux.c | 5 +++++ src/plumbing/transcoding.c | 11 ++++++----- src/streaming.c | 1 + src/tvheadend.h | 3 ++- 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/esfilter.h b/src/esfilter.h index f98d30d5..38113406 100644 --- a/src/esfilter.h +++ b/src/esfilter.h @@ -46,7 +46,7 @@ extern const idclass_t esfilter_class_other; #define ESF_MASK_VIDEO \ (SCT_MASK(SCT_MPEG2VIDEO) | SCT_MASK(SCT_H264) | SCT_MASK(SCT_VP8) | \ - SCT_MASK(SCT_HEVC)) + SCT_MASK(SCT_HEVC) | SCT_MASK(SCT_VP9)) #define ESF_MASK_AUDIO \ (SCT_MASK(SCT_MPEG2AUDIO) | SCT_MASK(SCT_AC3) | SCT_MASK(SCT_AAC) | \ diff --git a/src/libav.c b/src/libav.c index 8a79254a..dfb195fb 100644 --- a/src/libav.c +++ b/src/libav.c @@ -65,6 +65,9 @@ streaming_component_type2codec_id(streaming_component_type_t type) case SCT_VP8: codec_id = AV_CODEC_ID_VP8; break; + case SCT_VP9: + codec_id = AV_CODEC_ID_VP9; + break; case SCT_AC3: codec_id = AV_CODEC_ID_AC3; break; @@ -116,6 +119,9 @@ codec_id2streaming_component_type(enum AVCodecID id) case AV_CODEC_ID_VP8: type = SCT_VP8; break; + case AV_CODEC_ID_VP9: + type = SCT_VP9; + break; case AV_CODEC_ID_AC3: type = SCT_AC3; break; diff --git a/src/muxer/tvh/mkmux.c b/src/muxer/tvh/mkmux.c index f6e278d7..c3ade157 100644 --- a/src/muxer/tvh/mkmux.c +++ b/src/muxer/tvh/mkmux.c @@ -274,6 +274,11 @@ mk_build_tracks(mk_mux_t *mkm, const streaming_start_t *ss) codec_id = "V_VP8"; break; + case SCT_VP9: + tracktype = 1; + codec_id = "V_VP9"; + break; + case SCT_HEVC: tvherror("mkv", "HEVC (H265) codec is not suppored for Matroska muxer (work in progress)"); continue; diff --git a/src/plumbing/transcoding.c b/src/plumbing/transcoding.c index d00e3951..2353e948 100644 --- a/src/plumbing/transcoding.c +++ b/src/plumbing/transcoding.c @@ -121,10 +121,11 @@ typedef struct transcoder { -#define WORKING_ENCODER(x) (x == AV_CODEC_ID_H264 || x == AV_CODEC_ID_MPEG2VIDEO || \ - x == AV_CODEC_ID_VP8 || x == AV_CODEC_ID_AAC || \ - x == AV_CODEC_ID_MP2 || x == AV_CODEC_ID_VORBIS) - +#define WORKING_ENCODER(x) \ + ((x) == AV_CODEC_ID_H264 || (x) == AV_CODEC_ID_MPEG2VIDEO || \ + (x) == AV_CODEC_ID_VP8 || /* (x) == AV_CODEC_ID_VP9 || */ \ + (x) == AV_CODEC_ID_AAC || \ + (x) == AV_CODEC_ID_MP2 || (x) == AV_CODEC_ID_VORBIS) /** * @@ -1420,7 +1421,7 @@ transcoder_init_video(transcoder_t *t, streaming_start_component_t *ssc) vs->vid_ictx->thread_count = sysconf(_SC_NPROCESSORS_ONLN); vs->vid_octx->thread_count = sysconf(_SC_NPROCESSORS_ONLN); - + vs->vid_dec_frame = avcodec_alloc_frame(); vs->vid_enc_frame = avcodec_alloc_frame(); diff --git a/src/streaming.c b/src/streaming.c index 2da04ed7..3cabff9c 100644 --- a/src/streaming.c +++ b/src/streaming.c @@ -501,6 +501,7 @@ static struct strtab streamtypetab[] = { { "VP8", SCT_VP8 }, { "VORBIS", SCT_VORBIS }, { "HEVC", SCT_HEVC }, + { "VP9", SCT_VP9 }, }; /** diff --git a/src/tvheadend.h b/src/tvheadend.h index 87ca0114..4bba2ab8 100644 --- a/src/tvheadend.h +++ b/src/tvheadend.h @@ -230,13 +230,14 @@ typedef enum { SCT_VP8, SCT_VORBIS, SCT_HEVC, + SCT_VP9, SCT_LAST = SCT_HEVC } streaming_component_type_t; #define SCT_MASK(t) (1 << (t)) #define SCT_ISVIDEO(t) ((t) == SCT_MPEG2VIDEO || (t) == SCT_H264 || \ - (t) == SCT_VP8 || (t) == SCT_HEVC) + (t) == SCT_VP8 || (t) == SCT_HEVC || (t) == SCT_VP9) #define SCT_ISAUDIO(t) ((t) == SCT_MPEG2AUDIO || (t) == SCT_AC3 || \ (t) == SCT_AAC || (t) == SCT_MP4A || \