From 022fcd195f2700488389c007a8f49655af6670cc Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sat, 11 Oct 2014 10:42:23 +0200 Subject: [PATCH] transcode: enable experimental codecs --- src/plumbing/transcoding.c | 11 ++++++++--- src/plumbing/transcoding.h | 2 +- src/profile.c | 10 +++++++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/plumbing/transcoding.c b/src/plumbing/transcoding.c index 821aec46..413d51d9 100644 --- a/src/plumbing/transcoding.c +++ b/src/plumbing/transcoding.c @@ -135,8 +135,11 @@ static AVCodecContext * avcodec_alloc_context3_tvh(const AVCodec *codec) { AVCodecContext *ctx = avcodec_alloc_context3(codec); - if (ctx) + if (ctx) { ctx->codec_id = AV_CODEC_ID_NONE; + ctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL; + + } return ctx; } @@ -205,7 +208,6 @@ transcoder_get_encoder(streaming_component_type_t ty) streaming_component_type2txt(ty)); return NULL; } - tvhlog(LOG_DEBUG, "transcode", "Using encoder %s", codec->name); return codec; @@ -1933,7 +1935,7 @@ transcoder_destroy(streaming_target_t *st) * */ htsmsg_t * -transcoder_get_capabilities(void) +transcoder_get_capabilities(int experimental) { AVCodec *p = NULL; streaming_component_type_t sct; @@ -1947,6 +1949,9 @@ transcoder_get_capabilities(void) if (!WORKING_ENCODER(p->id)) continue; + if ((p->capabilities & CODEC_CAP_EXPERIMENTAL) && !experimental) + continue; + sct = codec_id2streaming_component_type(p->id); if (sct == SCT_NONE) continue; diff --git a/src/plumbing/transcoding.h b/src/plumbing/transcoding.h index 107f2275..16e00332 100644 --- a/src/plumbing/transcoding.h +++ b/src/plumbing/transcoding.h @@ -36,7 +36,7 @@ extern uint32_t transcoding_enabled; streaming_target_t *transcoder_create (streaming_target_t *output); void transcoder_destroy(streaming_target_t *tr); -htsmsg_t *transcoder_get_capabilities(void); +htsmsg_t *transcoder_get_capabilities(int experimental); void transcoder_set_properties (streaming_target_t *tr, transcoder_props_t *prop); diff --git a/src/profile.c b/src/profile.c index b604aaa9..a055c921 100644 --- a/src/profile.c +++ b/src/profile.c @@ -505,6 +505,8 @@ profile_matroska_builder(void) #if ENABLE_LIBAV +static int profile_transcode_experimental_codecs = 1; + /* * Transcoding + packet-like muxers */ @@ -600,7 +602,7 @@ profile_class_vcodec_list(void *o) htsmsg_add_s32(e, "key", 0); htsmsg_add_str(e, "val", "Copy codec type"); htsmsg_add_msg(l, NULL, e); - c = transcoder_get_capabilities(); + c = transcoder_get_capabilities(profile_transcode_experimental_codecs); for (i = 0; i <= SCT_LAST; i++) { if (!SCT_ISVIDEO(i)) continue; @@ -629,7 +631,7 @@ profile_class_acodec_list(void *o) htsmsg_add_s32(e, "key", 0); htsmsg_add_str(e, "val", "Copy codec type"); htsmsg_add_msg(l, NULL, e); - c = transcoder_get_capabilities(); + c = transcoder_get_capabilities(profile_transcode_experimental_codecs); for (i = 0; i <= SCT_LAST; i++) { if (!SCT_ISAUDIO(i)) continue; @@ -658,7 +660,7 @@ profile_class_scodec_list(void *o) htsmsg_add_s32(e, "key", 0); htsmsg_add_str(e, "val", "Copy codec type"); htsmsg_add_msg(l, NULL, e); - c = transcoder_get_capabilities(); + c = transcoder_get_capabilities(profile_transcode_experimental_codecs); for (i = 0; i <= SCT_LAST; i++) { if (!SCT_ISSUBTITLE(i)) continue; @@ -835,6 +837,8 @@ profile_init(void) profile_register(&profile_mpegts_pass_class, profile_mpegts_pass_builder); profile_register(&profile_matroska_class, profile_matroska_builder); #if ENABLE_LIBAV + profile_transcode_experimental_codecs = + getenv("TVHEADEND_LIBAV_NO_EXPERIMENTAL_CODECS") ? 0 : 1; profile_register(&profile_transcode_class, profile_transcode_builder); #endif