Skip to content

Commit

Permalink
added OType in file templates to resolve crypted stream type to their…
Browse files Browse the repository at this point in the history
… original types - cf #2769
  • Loading branch information
jeanlf committed Mar 13, 2024
1 parent efd921d commit 67661a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions applications/gpac/gpac_help.c
Expand Up @@ -341,6 +341,7 @@ const char *gpac_doc =
"- URL: URL of source file\n"
"- File: path on disk for source file; if not found, use URL if set, or PID name otherwise\n"
"- Type: name of stream type of PID (`video`, `audio` ...)\n"
"- OType: same as `Type` but uses original type when stream is encrypted (e.g. move from `crypt` to `video`)\n"
"- p4cc=ABCD: uses PID property with 4CC value `ABCD`\n"
"- pname=VAL: uses PID property with name `VAL`\n"
"- cts, dts, dur, sap: uses properties of first packet in PID at template resolution time\n"
Expand Down
2 changes: 2 additions & 0 deletions share/doc/man/gpac.1
Expand Up @@ -2168,6 +2168,8 @@ KEYWORD is case sensitive, and may be present multiple times in the string. Supp
.br
* Type: name of stream type of PID (video, audio ...)
.br
* OType: same as Type but uses original type when stream is encrypted (e.g. move from crypt to video)
.br
* p4cc=ABCD: uses PID property with 4CC value ABCD
.br
* pname=VAL: uses PID property with name VAL
Expand Down
7 changes: 6 additions & 1 deletion src/filter_core/filter_pid.c
Expand Up @@ -5520,6 +5520,7 @@ GF_FilterPid *gf_filter_pid_new(GF_Filter *filter)
GF_FilterPid *pidi = gf_list_get(filter->input_pids, 0);
gf_filter_pid_copy_properties(pid, pidi);
}
GF_LOG(GF_LOG_DEBUG, GF_LOG_FILTER, ("Filter %s created new PID - defer link %d\n", filter->name, filter->deferred_link));
gf_mx_v(filter->tasks_mx);
return pid;
}
Expand Down Expand Up @@ -8479,8 +8480,12 @@ GF_Err gf_filter_pid_resolve_file_template_ex(GF_FilterPid *pid, const char szTe
} else if (!strcmp(name, "FS")) {
str_val = file_suffix ? file_suffix : "";
is_ok = GF_TRUE;
} else if (!strcmp(name, "Type")) {
} else if (!strcmp(name, "Type") || !strcmp(name, "OType")) {
prop_val = gf_filter_pid_get_property_first(pid, GF_PROP_PID_STREAM_TYPE);
//for OType resolve to original type if encrypted
if (!strcmp(name, "OType") && prop_val && (prop_val->value.uint==GF_STREAM_ENCRYPTED)) {
prop_val = gf_filter_pid_get_property_first(pid, GF_PROP_PID_ORIG_STREAM_TYPE);
}
if (prop_val) {
str_val = gf_stream_type_short_name(prop_val->value.uint);
is_ok = GF_TRUE;
Expand Down

0 comments on commit 67661a2

Please sign in to comment.