Skip to content

Commit

Permalink
added ttml_agg option to dasher - cf #2842
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanlf committed May 31, 2024
1 parent 85559fa commit e73ccd0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/gpac/filters.h
Original file line number Diff line number Diff line change
Expand Up @@ -2159,7 +2159,7 @@ enum
GF_CAPFLAG_LOADED_FILTER = 1<<4,
/*! indicates that this capability (input or output) applies to all following bundles. This avoids repeating capabilities common to all bundles by setting them only in the first*/
GF_CAPFLAG_STATIC = 1<<5,
/*! Only used for input capabilities, indicates that this capability is optional in the input PID */
/*! Currently only used for output capabilities, indicates that this capability is optional in the PID */
GF_CAPFLAG_OPTIONAL = 1<<6,
};

Expand Down
15 changes: 14 additions & 1 deletion src/filters/dasher.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ typedef struct
Bool check_dur, skip_seg, loop, reschedule, scope_deps, keep_src, tpl_force, keep_segs;
Double refresh, tsb, subdur;
u64 *_p_gentime, *_p_mpdtime;
Bool cmpd, dual, sreg;
Bool cmpd, dual, sreg, ttml_agg;
char *styp;
Bool sigfrag;
u32 sbound, pswitch;
Expand Down Expand Up @@ -3576,6 +3576,18 @@ static void dasher_open_pid(GF_Filter *filter, GF_DasherCtx *ctx, GF_DashStream
} else {
gf_filter_pid_set_property(ds->opid, GF_PROP_PID_TIMESHIFT_SEGS, NULL);
}

//inject ttml agg filter
if (ctx->ttml_agg && !ctx->rawsub && (ds->codec_id==GF_CODECID_SUBS_XML)) {
GF_Err e;
GF_Filter *ttml_agg = gf_filter_load_filter(filter, "ttmlmerge", &e);
gf_filter_set_source(ttml_agg, filter, NULL);

sprintf(szSRC, "MuxSrc%cdasher_%p", gf_filter_get_sep(filter, GF_FS_SEP_NAME), ds->dst_filter);
gf_filter_reset_source(ds->dst_filter);
gf_filter_set_source(ds->dst_filter, ttml_agg, szSRC);
}

}

static void dasher_set_content_components(GF_DashStream *ds)
Expand Down Expand Up @@ -10724,6 +10736,7 @@ static const GF_FilterArgs DasherArgs[] =
"- auto: default KID only injected if no key roll is detected (as per DASH-IF guidelines)"
, GF_PROP_UINT, "auto", "off|on|auto", GF_FS_ARG_HINT_EXPERT},
{ OFFS(tpl_force), "use template string as is without trying to add extension or solve conflicts in names", GF_PROP_BOOL, "false", NULL, GF_FS_ARG_HINT_EXPERT},
{ OFFS(ttml_agg), "force aggregation of TTML samples of a DASH segment into a single sample", GF_PROP_BOOL, "false", NULL, GF_FS_ARG_HINT_EXPERT},

{0}
};
Expand Down
4 changes: 2 additions & 2 deletions src/filters/write_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2105,7 +2105,7 @@ static GF_Err ttmlmerge_initialize(GF_Filter *filter)
return GF_OK;
}

/* writeuf: same as writegen but declare unframed output cap rather than mime / ext , used to force unframed format for all streams handled by writegen */
/* ttml merger: we reuse writegen logic for TTML merging, but keeping sample timing*/
static GF_FilterCapability TTMLMergeCaps[] =
{
CAP_UINT(GF_CAPS_INPUT_OUTPUT, GF_PROP_PID_STREAM_TYPE, GF_STREAM_TEXT),
Expand All @@ -2118,7 +2118,7 @@ const GF_FilterRegister TTMLMergeRegister = {
.name = "ttmlmerge",
GF_FS_SET_DESCRIPTION("TTML sample merger")
GF_FS_SET_HELP("Merge input samples into a single TTML sample. Merging restarts at the start of DASH segments.\n")
.flags = GF_FS_REG_EXPLICIT_ONLY,
// .flags = GF_FS_REG_EXPLICIT_ONLY,
.private_size = sizeof(GF_GenDumpCtx),
.initialize = ttmlmerge_initialize,
.finalize = writegen_finalize,
Expand Down

0 comments on commit e73ccd0

Please sign in to comment.