AVCodec *icodec, *ocodec;
transcoder_props_t *tp = &t->t_props;
int sct;
+ char *str, *token, *saveptr, codec_list[sizeof(tp->tp_src_vcodec)];
+ int codec_match=0;
+
+ strncpy(codec_list, tp->tp_src_vcodec, sizeof(tp->tp_src_vcodec)-1);
+
+ tvhinfo(LS_TRANSCODE, "tp->tp_src_vcodec=\"%s\" ssc->ssc_type=%d (%s)\n",
+ tp->tp_src_vcodec,
+ ssc->ssc_type,
+ streaming_component_type2txt(ssc->ssc_type));
+
+ if (codec_list[0] != '\0') {
+ for (str=codec_list; ; str = NULL) {
+ token = strtok_r(str," ,|;" , &saveptr);
+ if (token == NULL)
+ break; //no match found, use profile settings
+ if(!strcasecmp(token, streaming_component_type2txt(ssc->ssc_type))) {//match found
+ codec_match=1;
+ }
+ }
+ }
+
+ if(!codec_match)
+ return transcoder_init_stream(t, ssc); //copy codec
if (tp->tp_vcodec[0] == '\0')
return 0;
tp->tp_resolution = props->tp_resolution;
memcpy(tp->tp_language, props->tp_language, 4);
+
+ strncpy(tp->tp_src_vcodec, props->tp_src_vcodec, sizeof(tp->tp_src_vcodec)-1);
}
char *pro_vcodec_preset;
char *pro_acodec;
char *pro_scodec;
+ char *pro_src_vcodec;
} profile_transcode_t;
+
+static htsmsg_t *
+profile_class_src_vcodec_list ( void *o, const char *lang )
+{
+ static const struct strtab_str tab[] = {
+ { N_("Any"), "" },
+ { "MPEG2VIDEO", "MPEG2VIDEO" },
+ { "H264", "H264" },
+ { "VP8", "VP8" },
+ { "HEVC", "HEVC" },
+ { "VP9", "VP9" },
+ };
+ return strtab2htsmsg_str(tab, 1, lang);
+}
+
static htsmsg_t *
profile_class_mc_list ( void *o, const char *lang )
{
.opts = PO_ADVANCED,
.group = 2
},
+ {
+ .type = PT_STR,
+ .id = "src_vcodec",
+ .name = N_("Source video codec"),
+ .desc = N_("Transcode video only if source video codec mattch. "
+ "\"Any\" will ingnore source vcodec check and always do transcode. "
+ "Separate codec names with coma. "
+ "If no codec match found - transcode with \"copy\" codec, "
+ "if match found - transcode with parameters in this profile."),
+ .off = offsetof(profile_transcode_t, pro_src_vcodec),
+ .def.i = SCT_UNKNOWN,
+ .list = profile_class_src_vcodec_list,
+ .opts = PO_ADVANCED,
+ .group = 2
+ },
{
.type = PT_STR,
.id = "vcodec",
props.tp_abitrate = profile_transcode_abitrate(pro);
strncpy(props.tp_language, pro->pro_language ?: "", 3);
+ if (!pro->pro_src_vcodec) {
+ strcpy(props.tp_src_vcodec, "");
+ } else if(!strncasecmp("Any",pro->pro_src_vcodec,3)) {
+ strcpy(props.tp_src_vcodec, "");
+ } else {
+ strncpy(props.tp_src_vcodec, pro->pro_src_vcodec ?: "", sizeof(props.tp_src_vcodec)-1);
+ }
+
dst = prch->prch_gh = globalheaders_create(dst);
#if ENABLE_TIMESHIFT