Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
transcode: enable experimental codecs
  • Loading branch information
perexg committed Oct 11, 2014
1 parent 3ba4597 commit 022fcd1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
11 changes: 8 additions & 3 deletions src/plumbing/transcoding.c
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/plumbing/transcoding.h
Expand Up @@ -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);

Expand Down
10 changes: 7 additions & 3 deletions src/profile.c
Expand Up @@ -505,6 +505,8 @@ profile_matroska_builder(void)

#if ENABLE_LIBAV

static int profile_transcode_experimental_codecs = 1;

/*
* Transcoding + packet-like muxers
*/
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 022fcd1

Please sign in to comment.