libgpac
Documentation of the core library of GPAC
|
Filter Interconnection. More...
Data Structures | |
struct | GF_FilterPidStatistics |
Typedefs | |
typedef Bool(* | gf_filter_prop_filter) (void *cbk, u32 prop_4cc, const char *prop_name, const GF_PropertyValue *src_prop) |
Enumerations | |
enum | GF_FilterPidStatsLocation { GF_STATS_LOCAL = 0 , GF_STATS_LOCAL_INPUTS , GF_STATS_DECODER_SINK , GF_STATS_DECODER_SOURCE , GF_STATS_ENCODER_SINK , GF_STATS_ENCODER_SOURCE , GF_STATS_SINK } |
Functions | |
GF_FilterPid * | gf_filter_pid_new (GF_Filter *filter) |
void | gf_filter_pid_remove (GF_FilterPid *PID) |
GF_Err | gf_filter_pid_raw_new (GF_Filter *filter, const char *url, const char *local_file, const char *mime_type, const char *fext, const u8 *probe_data, u32 probe_size, Bool trust_mime, GF_FilterPid **out_pid) |
GF_Err | gf_filter_pid_set_property (GF_FilterPid *PID, u32 prop_4cc, const GF_PropertyValue *value) |
GF_Err | gf_filter_pid_set_property_str (GF_FilterPid *PID, const char *name, const GF_PropertyValue *value) |
GF_Err | gf_filter_pid_set_property_dyn (GF_FilterPid *PID, char *name, const GF_PropertyValue *value) |
GF_Err | gf_filter_pid_set_info (GF_FilterPid *PID, u32 prop_4cc, const GF_PropertyValue *value) |
GF_Err | gf_filter_pid_set_info_str (GF_FilterPid *PID, const char *name, const GF_PropertyValue *value) |
GF_Err | gf_filter_pid_set_info_dyn (GF_FilterPid *PID, char *name, const GF_PropertyValue *value) |
void | gf_filter_pid_set_udta (GF_FilterPid *PID, void *udta) |
void * | gf_filter_pid_get_udta (GF_FilterPid *PID) |
u32 | gf_filter_pid_get_udta_flags (GF_FilterPid *PID) |
GF_Err | gf_filter_pid_set_udta_flags (GF_FilterPid *PID, u32 flags) |
void | gf_filter_pid_set_name (GF_FilterPid *PID, const char *name) |
const char * | gf_filter_pid_get_name (GF_FilterPid *PID) |
const char * | gf_filter_pid_get_filter_name (GF_FilterPid *PID) |
const char * | gf_filter_pid_orig_src_args (GF_FilterPid *PID, Bool for_unicity) |
const char * | gf_filter_pid_get_source_filter_name (GF_FilterPid *PID) |
const char * | gf_filter_pid_get_args (GF_FilterPid *PID) |
void | gf_filter_pid_set_max_buffer (GF_FilterPid *PID, u32 total_duration_us) |
u32 | gf_filter_pid_get_max_buffer (GF_FilterPid *PID) |
Bool | gf_filter_pid_is_filter_in_parents (GF_FilterPid *PID, GF_Filter *filter) |
Bool | gf_filter_pid_share_origin (GF_FilterPid *PID, GF_FilterPid *other_pid) |
Bool | gf_filter_pid_get_buffer_occupancy (GF_FilterPid *PID, u32 *max_units, u32 *nb_pck, u32 *max_duration, u32 *duration) |
void | gf_filter_pid_set_loose_connect (GF_FilterPid *PID) |
GF_Err | gf_filter_pid_push_properties (GF_FilterPid *PID, char *args, Bool direct_merge, Bool use_default_seps) |
GF_Err | gf_filter_pid_negotiate_property (GF_FilterPid *PID, u32 prop_4cc, const GF_PropertyValue *value) |
GF_Err | gf_filter_pid_negotiate_property_str (GF_FilterPid *PID, const char *name, const GF_PropertyValue *value) |
GF_Err | gf_filter_pid_negotiate_property_dyn (GF_FilterPid *PID, char *name, const GF_PropertyValue *value) |
const GF_PropertyValue * | gf_filter_pid_caps_query (GF_FilterPid *PID, u32 prop_4cc) |
const GF_PropertyValue * | gf_filter_pid_caps_query_str (GF_FilterPid *PID, const char *prop_name) |
GF_Err | gf_filter_pid_get_statistics (GF_FilterPid *PID, GF_FilterPidStatistics *stats, GF_FilterPidStatsLocation location) |
GF_Err | gf_filter_pid_reset_properties (GF_FilterPid *PID) |
GF_Err | gf_filter_pid_copy_properties (GF_FilterPid *dst_pid, GF_FilterPid *src_pid) |
GF_Err | gf_filter_pid_merge_properties (GF_FilterPid *dst_pid, GF_FilterPid *src_pid, gf_filter_prop_filter filter_prop, void *cbk) |
const GF_PropertyValue * | gf_filter_pid_get_property (GF_FilterPid *PID, u32 prop_4cc) |
const GF_PropertyValue * | gf_filter_pid_get_property_str (GF_FilterPid *PID, const char *prop_name) |
const GF_PropertyValue * | gf_filter_pid_enum_properties (GF_FilterPid *PID, u32 *idx, u32 *prop_4cc, const char **prop_name) |
const GF_PropertyValue * | gf_filter_pid_enum_info (GF_FilterPid *PID, u32 *idx, u32 *prop_4cc, const char **prop_name) |
GF_Err | gf_filter_pid_set_framing_mode (GF_FilterPid *PID, Bool requires_full_blocks) |
u64 | gf_filter_pid_query_buffer_duration (GF_FilterPid *PID, Bool check_pid_full) |
void | gf_filter_pid_try_pull (GF_FilterPid *PID) |
const GF_PropertyValue * | gf_filter_pid_get_info (GF_FilterPid *PID, u32 prop_4cc, GF_PropertyEntry **propentry) |
const GF_PropertyValue * | gf_filter_pid_get_info_str (GF_FilterPid *PID, const char *prop_name, GF_PropertyEntry **propentry) |
void | gf_filter_pid_set_eos (GF_FilterPid *PID) |
void | gf_filter_pid_send_flush (GF_FilterPid *PID) |
Bool | gf_filter_pid_has_seen_eos (GF_FilterPid *PID) |
Bool | gf_filter_pid_eos_received (GF_FilterPid *PID) |
Bool | gf_filter_pid_is_eos (GF_FilterPid *PID) |
Bool | gf_filter_pid_is_flush_eos (GF_FilterPid *PID) |
Bool | gf_filter_pid_first_packet_is_empty (GF_FilterPid *PID) |
Bool | gf_filter_pid_first_packet_is_blocking_ref (GF_FilterPid *PID) |
GF_FilterPacket * | gf_filter_pid_get_packet (GF_FilterPid *PID) |
Bool | gf_filter_pid_get_first_packet_cts (GF_FilterPid *PID, u64 *cts) |
void | gf_filter_pid_drop_packet (GF_FilterPid *PID) |
u32 | gf_filter_pid_get_packet_count (GF_FilterPid *PID) |
Bool | gf_filter_pid_check_caps (GF_FilterPid *PID) |
Bool | gf_filter_pid_would_block (GF_FilterPid *PID) |
Bool | gf_filter_pid_is_sparse (GF_FilterPid *PID) |
u32 | gf_filter_pid_get_timescale (GF_FilterPid *PID) |
void | gf_filter_pid_clear_eos (GF_FilterPid *PID, Bool all_pids) |
void | gf_filter_pid_set_clock_mode (GF_FilterPid *PID, Bool filter_in_charge) |
GF_Err | gf_filter_pid_resolve_file_template (GF_FilterPid *PID, const char szTemplate[GF_MAX_PATH], char szFinalName[GF_MAX_PATH], u32 file_number, const char *file_suffix) |
GF_Err | gf_filter_pid_resolve_file_template_ex (GF_FilterPid *PID, const char szTemplate[GF_MAX_PATH], char szFinalName[GF_MAX_PATH], u32 file_number, const char *file_suffix, const char *file_name) |
GF_Err | gf_filter_pid_set_discard (GF_FilterPid *PID, Bool discard_on) |
void | gf_filter_pid_discard_block (GF_FilterPid *PID) |
char * | gf_filter_pid_get_destination (GF_FilterPid *PID) |
char * | gf_filter_pid_get_source (GF_FilterPid *PID) |
GF_Err | gf_filter_pid_require_source_id (GF_FilterPid *PID) |
void | gf_filter_pid_recompute_dts (GF_FilterPid *PID, Bool do_recompute) |
u32 | gf_filter_pid_get_min_pck_duration (GF_FilterPid *PID) |
void | gf_filter_pid_send_event (GF_FilterPid *PID, GF_FilterEvent *evt) |
void | gf_filter_pid_init_play_event (GF_FilterPid *PID, GF_FilterEvent *evt, Double start, Double speed, const char *log_name) |
Bool | gf_filter_pid_is_playing (GF_FilterPid *PID) |
GF_Err | gf_filter_pid_allow_direct_dispatch (GF_FilterPid *PID) |
void * | gf_filter_pid_get_alias_udta (GF_FilterPid *PID) |
GF_Filter * | gf_filter_pid_get_owner (GF_FilterPid *PID) |
GF_Filter * | gf_filter_pid_get_source_filter (GF_FilterPid *PID) |
GF_Filter * | gf_filter_pid_enum_destinations (GF_FilterPid *PID, u32 idx) |
GF_Err | gf_filter_pid_ignore_blocking (GF_FilterPid *PID, Bool do_ignore) |
u64 | gf_filter_pid_get_next_ts (GF_FilterPid *PID) |
Bool | gf_filter_pid_has_decoder (GF_FilterPid *PID) |
GF_Err | gf_filter_pid_set_rt_stats (GF_FilterPid *PID, u32 rtt_ms, u32 jitter_us, u32 loss_rate) |
GF_Err | gf_filter_pid_get_rfc_6381_codec_string (GF_FilterPid *PID, char *szCodec, Bool force_inband, Bool force_sbr, const GF_PropertyValue *tile_base_dcd, u32 *out_inband_forced) |
A PID is a connection between two filters, holding packets to process. Internally, a PID created by a filter (output PID) is different from an input PID to a filter (configure_pid) but the API has been designed to hide this, so that most PID functions can be called regardless of the input/output nature of the PID.
All setters functions (gf_filter_pid_set*) will fail on an input PID.
The generic design of the architecture is that each filter is free to decide how it handle PIDs and their packets. This implies that the filter session has no clue how an output PID relates to an input PID (same goes for packets). Developpers must therefore manually copy PID properties that seem relevant, or more practically copy all properties from input PID to output PID and reassign output PID properties changed by the filter.
PIDs can be reconfigured multiple times, even potentially changing caps on the fly. The current architecture does not check for capability matching during reconfigure, it is up to the filter to do so.
It is also up to filters to decide how to handle a an input PID removal: remove the output PID immediately, keep it open to flush internal data or keep generating data on the output. The usual practice is to remove the output as soon as the input is removed.
Once an input PID has been notified to be removed, it shall no longer be used by the filter, as it may be discarded/freed (PID are NOT reference counted).
struct GF_FilterPidStatistics |
Statistics for PID
Data Fields | ||
---|---|---|
u32 | disconnected |
if set, indicates the PID is disconnected and stats are not valid |
u32 | average_process_rate |
average process rate on that PID in bits per seconds |
u32 | max_process_rate |
max process rate on that PID in bits per seconds |
u32 | average_bitrate |
average bitrate for that PID |
u32 | max_bitrate |
max bitrate for that PID |
u32 | nb_processed |
number of packets processed on that PID |
u32 | max_process_time |
max packet process time of the filter in us |
u64 | total_process_time |
total process time of the filter in us |
u64 | first_process_time |
process time of first packet of the filter in us |
u64 | last_process_time |
process time of the last packet on that PID in us |
u32 | min_frame_dur |
minimum frame duration on that PID in us |
u32 | nb_saps |
number of saps 1/2/3 on that PID |
u32 | max_sap_process_time |
max process time of SAP packets on that PID in us |
u64 | total_sap_process_time |
total process time of SAP packets on that PID in us |
u64 | max_buffer_time |
max buffer time in us - only set when querying decoder stats |
u64 | max_playout_time |
max playout buffer time in us - only set when querying decoder stats |
u64 | min_playout_time |
min playout buffer time in us - only set when querying decoder stats |
u64 | buffer_time |
current buffer time in us - only set when querying decoder stats |
u32 | nb_buffer_units |
number of units in input buffer of the filter - only set when querying decoder stats |
u64 | last_rt_report |
last RT info update time in microsec (cf gf_sys_clock_high_res) - input pid only |
u32 | rtt |
estimated round-trip time in ms - input pid only |
u32 | jitter |
estimated interarrival jitter in microseconds - input pid only |
u32 | loss_rate |
loss rate in per-thousand - input pid only |
GF_Fraction64 | last_ts_drop |
timestamp and timescale of last packet dropped
|
GF_Fraction64 | last_ts_sent |
timestamp and timescale of last packet send on PID (for output PID) or on parent PID (for input PID) |
typedef Bool(* gf_filter_prop_filter) (void *cbk, u32 prop_4cc, const char *prop_name, const GF_PropertyValue *src_prop) |
Function protoype for filtering properties.
cbk | callback data |
prop_4cc | the built-in property code |
prop_name | property name |
src_prop | the property value in the source packet |
Direction for stats querying
GF_FilterPid* gf_filter_pid_new | ( | GF_Filter * | filter | ) |
Creates a new output PID for the filter. If the filter has a single input PID already connected, the PID properties are copied by default
filter | the target filter |
void gf_filter_pid_remove | ( | GF_FilterPid * | PID | ) |
Removes an output PID from the filter. This will trigger removal of the PID upward in the chain
PID | the target filter PID to remove |
GF_Err gf_filter_pid_raw_new | ( | GF_Filter * | filter, |
const char * | url, | ||
const char * | local_file, | ||
const char * | mime_type, | ||
const char * | fext, | ||
const u8 * | probe_data, | ||
u32 | probe_size, | ||
Bool | trust_mime, | ||
GF_FilterPid ** | out_pid | ||
) |
Creates an output PID for a raw input filter (file, sockets, pipe, etc). This will assign file name, local name, mime and extension properties to the created PID
filter | the target filter |
url | URL of the source, SHALL be set |
local_file | path on local host, can be NULL |
mime_type | mime type of the content. If none provided and propbe_data is not null, the data will be probed for mime type resolution |
fext | file extension of the content. If NULL, will be extracted from URL |
probe_data | data of the stream to probe in order to solve its mime type |
probe_size | size of the probe data |
trust_mime | if set and mime_type is set, disables data probing |
out_pid | the output PID to create or update. If no referer PID, a new PID will be created otherwise the PID will be updated |
GF_Err gf_filter_pid_set_property | ( | GF_FilterPid * | PID, |
u32 | prop_4cc, | ||
const GF_PropertyValue * | value | ||
) |
Sets a new property on an output PID for built-in property names. Setting a new property will trigger a PID reconfigure at the consumption point of the next dispatched packet. Previous properties (ones set before last packet dispatch) will still be valid. You can remove any of them using gf_filter_pid_set_property with NULL property, or reset the properties with gf_filter_pid_reset_properties. There cannot be two instances of a property a given type/name:
Warning: changing a property at the final end of stream (i.e. if no more packets are sent) will have no effect. You must use gf_filter_pid_set_info and gf_filter_pid_get_info for this.
PID | the target filter PID |
prop_4cc | the built-in property code to modify |
value | the new value to assign, or NULL if the property is to be removed |
GF_Err gf_filter_pid_set_property_str | ( | GF_FilterPid * | PID, |
const char * | name, | ||
const GF_PropertyValue * | value | ||
) |
Sets a new property on an output PID - see gf_filter_pid_set_property.
PID | the target filter PID |
name | the name of the property to modify |
value | the new value to assign, or NULL if the property is to be removed |
GF_Err gf_filter_pid_set_property_dyn | ( | GF_FilterPid * | PID, |
char * | name, | ||
const GF_PropertyValue * | value | ||
) |
Sets a new property on an output PID - see gf_filter_pid_set_property.
PID | the target filter PID |
name | the name of the property to modify. The name will be copied to the property, and memory destruction performed by the filter session |
value | the new value to assign, or NULL if the property is to be removed |
Sets a new info property on an output PID for built-in property names. Similar to gf_filter_pid_set_property, but infos are not copied up the chain and to not trigger PID reconfiguration. First packet dispatched after calling this function will be marked, and its fetching by the consuming filter will trigger a process_event notification. If the consuming filter copies properties from source packet to output packet, the flag will be passed to such new output packet.
If an info property with same type/name exists and has the same value, assignment will be skipped. In that case, if the property contains memory to be passed to the filter session, this memory will be destroyed (eg GF_PROP_STRING_NO_COPY, GF_PROP_DATA_NO_COPY, GF_PROP_STRING_LIST).
PID | the target filter PID |
prop_4cc | the built-in property code to modify |
value | the new value to assign, or NULL if the property is to be removed |
GF_Err gf_filter_pid_set_info_str | ( | GF_FilterPid * | PID, |
const char * | name, | ||
const GF_PropertyValue * | value | ||
) |
Sets a new info property on an output PID - see gf_filter_pid_set_info See gf_filter_pid_set_info
PID | the target filter PID |
name | the name of the property to modify |
value | the new value to assign, or NULL if the property is to be removed |
GF_Err gf_filter_pid_set_info_dyn | ( | GF_FilterPid * | PID, |
char * | name, | ||
const GF_PropertyValue * | value | ||
) |
Sets a new property on an output PID. See gf_filter_pid_set_info
PID | the target filter PID |
name | the name of the property to modify. The name will be copied to the property, and memory destruction performed by the filter session |
value | the new value to assign, or NULL if the property is to be removed |
void gf_filter_pid_set_udta | ( | GF_FilterPid * | PID, |
void * | udta | ||
) |
Sets user data pointer for a PID - see gf_filter_pid_set_info
PID | the target filter PID |
udta | user data pointer |
void* gf_filter_pid_get_udta | ( | GF_FilterPid * | PID | ) |
Gets user data pointer for a PID
PID | the target filter PID |
u32 gf_filter_pid_get_udta_flags | ( | GF_FilterPid * | PID | ) |
get user 32-bits flags
PID | the target filter PID |
set user 32-bits flags
PID | the target filter PID |
flags | the flags (replaces the entire flags)) |
void gf_filter_pid_set_name | ( | GF_FilterPid * | PID, |
const char * | name | ||
) |
Gets PID name. Mostly used for logging purposes
PID | the target filter PID |
name | the new PID name. function ignored if NULL. |
const char* gf_filter_pid_get_name | ( | GF_FilterPid * | PID | ) |
Gets PID name
PID | the target filter PID |
const char* gf_filter_pid_get_filter_name | ( | GF_FilterPid * | PID | ) |
Gets filter name of input PID
PID | the target filter PID |
const char* gf_filter_pid_orig_src_args | ( | GF_FilterPid * | PID, |
Bool | for_unicity | ||
) |
Gets the source arguments of the PID, walking down the chain until the source filter
PID | the target filter PID |
for_unicity | if GF_TRUE, will return the arguments of the first filter responsible for a fan-out leading to this PID |
const char* gf_filter_pid_get_source_filter_name | ( | GF_FilterPid * | PID | ) |
Gets the source filter name or class name for the PID, walking down the chain until the source filter (only the first input PID of each filter is used).
PID | the target filter PID |
const char* gf_filter_pid_get_args | ( | GF_FilterPid * | PID | ) |
Gets the arguments for the filter
PID | the target filter PID |
void gf_filter_pid_set_max_buffer | ( | GF_FilterPid * | PID, |
u32 | total_duration_us | ||
) |
Sets max buffer requirement of an output PID. Typically used by audio to make sure several packets can be dispatched on a PID that would otherwise block after one packet
PID | the target filter PID |
total_duration_us | buffer max occupancy in us |
u32 gf_filter_pid_get_max_buffer | ( | GF_FilterPid * | PID | ) |
Returns max buffer requirement of a PID.
PID | the target filter PID |
Bool gf_filter_pid_is_filter_in_parents | ( | GF_FilterPid * | PID, |
GF_Filter * | filter | ||
) |
Checks if a given filter is in the PID parent chain. This is used to identify sources (rather than checking URL/...)
PID | the target filter PID |
filter | the source filter to check |
Bool gf_filter_pid_share_origin | ( | GF_FilterPid * | PID, |
GF_FilterPid * | other_pid | ||
) |
Checks if a given PID has a common filter with another PID in the parent graph
PID | the target filter PID |
other_pid | the other PID to check |
Bool gf_filter_pid_get_buffer_occupancy | ( | GF_FilterPid * | PID, |
u32 * | max_units, | ||
u32 * | nb_pck, | ||
u32 * | max_duration, | ||
u32 * | duration | ||
) |
Gets current buffer levels of the PID
PID | the target filter PID |
max_units | maximum number of packets allowed - can be 0 if buffer is measured in time |
nb_pck | number of packets in PID |
max_duration | maximum buffer duration allowed in us - can be 0 if buffer is measured in units |
duration | buffer duration in us |
void gf_filter_pid_set_loose_connect | ( | GF_FilterPid * | PID | ) |
Sets loose connect for a PID, avoiding to throw an error if connection of the PID fails. Used by the compositor filter which acts as both sink and filter.
PID | the target filter PID |
GF_Err gf_filter_pid_push_properties | ( | GF_FilterPid * | PID, |
char * | args, | ||
Bool | direct_merge, | ||
Bool | use_default_seps | ||
) |
Adds PID properties from textual description - this does not reset the PID properties
PID | the target filter PID |
args | one or more serialized properties to set, as documented in gpac -h doc |
direct_merge | if true, next packet to be sent will not trigger a property change |
use_default_seps | if GF_TRUE, the serialized properties are using the default separator set, otherwise they are using the current separator set of the session |
GF_Err gf_filter_pid_negotiate_property | ( | GF_FilterPid * | PID, |
u32 | prop_4cc, | ||
const GF_PropertyValue * | value | ||
) |
Negotiate a given property on an input PID for built-in properties Filters may accept some PID connection but may need an adaptation chain to be able to process packets, eg change pixel format or sample rate This function will trigger a reconfiguration of the filter chain to try to adapt this. If failing, the filter chain will disconnect This process is asynchronous, the filter asking for a PID negotiation will see the notification through a pid_reconfigure if success.
PID | the target filter PID - this MUST be an input PID |
prop_4cc | the built-in property code to negotiate |
value | the new value to negotiate, SHALL NOT be NULL |
GF_Err gf_filter_pid_negotiate_property_str | ( | GF_FilterPid * | PID, |
const char * | name, | ||
const GF_PropertyValue * | value | ||
) |
Negotiate a given property on an input PID for regular properties see gf_filter_pid_negotiate_property
PID | the target filter PID - this MUST be an input PID |
name | name of the property to negotiate |
value | the new value to negotiate, SHALL NOT be NULL |
GF_Err gf_filter_pid_negotiate_property_dyn | ( | GF_FilterPid * | PID, |
char * | name, | ||
const GF_PropertyValue * | value | ||
) |
Negotiate a given property on an input PID for regular properties see gf_filter_pid_negotiate_property
PID | the target filter PID - this MUST be an input PID |
name | the name of the property to modify. The name will be copied to the property, and memory destruction performed by the filter session |
value | the new value to negotiate, SHALL NOT be NULL |
const GF_PropertyValue* gf_filter_pid_caps_query | ( | GF_FilterPid * | PID, |
u32 | prop_4cc | ||
) |
Queries a negotiated built-in capability on an output PID Filters may check if a property negotiation was done on an output PID, and check the property value. This can be done on an output PID in a filter->reconfigure_output if the filter accepts caps negotiation This can be done on an input PID in a generic reconfigure_pid
PID | the target filter PID |
prop_4cc | the built-in property code to negotiate |
const GF_PropertyValue* gf_filter_pid_caps_query_str | ( | GF_FilterPid * | PID, |
const char * | prop_name | ||
) |
Queries a negotiated capability on an output PID - see gf_filter_pid_caps_query
PID | the target filter PID |
prop_name | the property name to negotiate |
GF_Err gf_filter_pid_get_statistics | ( | GF_FilterPid * | PID, |
GF_FilterPidStatistics * | stats, | ||
GF_FilterPidStatsLocation | location | ||
) |
Gets statistics for the PID
PID | the target filter PID |
stats | the retrieved statistics |
location | indicates where to locate the filter to query stats on it. |
GF_Err gf_filter_pid_reset_properties | ( | GF_FilterPid * | PID | ) |
Resets current properties of the PID
PID | the target filter PID |
GF_Err gf_filter_pid_copy_properties | ( | GF_FilterPid * | dst_pid, |
GF_FilterPid * | src_pid | ||
) |
Push a new set of properties on destination PID using all properties from source PID. Old properties in destination will be lost (i.e. reset properties is always performed during copy properties)
dst_pid | the destination filter PID |
src_pid | the source filter PID |
GF_Err gf_filter_pid_merge_properties | ( | GF_FilterPid * | dst_pid, |
GF_FilterPid * | src_pid, | ||
gf_filter_prop_filter | filter_prop, | ||
void * | cbk | ||
) |
Push a new set of properties on destination PID, using all properties from source PID, potentially filtering them. Currently defined properties are not reseted.
dst_pid | the destination filter PID |
src_pid | the source filter PID |
filter_prop | callback filtering function |
cbk | callback data passed to the callback function |
const GF_PropertyValue* gf_filter_pid_get_property | ( | GF_FilterPid * | PID, |
u32 | prop_4cc | ||
) |
Gets a built-in property of the PID Warning: properties are only valid until the next configure_pid is called. Attempting to use a property value (either the pointer or one of the value) queried before the current configure_pid will result in unpredictable behavior, potentially crashes.
PID | the target filter PID |
prop_4cc | the code of the built-in property to retrieve |
const GF_PropertyValue* gf_filter_pid_get_property_str | ( | GF_FilterPid * | PID, |
const char * | prop_name | ||
) |
Gets a property of the PID - see gf_filter_pid_get_property
PID | the target filter PID |
prop_name | the name of the property to retrieve |
const GF_PropertyValue* gf_filter_pid_enum_properties | ( | GF_FilterPid * | PID, |
u32 * | idx, | ||
u32 * | prop_4cc, | ||
const char ** | prop_name | ||
) |
Enumerates properties of a PID - see gf_filter_pid_get_property
PID | the target filter PID |
idx | input/output index of the current property. 0 means first. Incremented by 1 upon success |
prop_4cc | set to the built-in code of the property if built-in |
prop_name | set to the name of the property if not built-in |
const GF_PropertyValue* gf_filter_pid_enum_info | ( | GF_FilterPid * | PID, |
u32 * | idx, | ||
u32 * | prop_4cc, | ||
const char ** | prop_name | ||
) |
Enumerates info of a PID
PID | the target filter PID |
idx | input/output index of the current info. 0 means first. Incremented by 1 upon success |
prop_4cc | set to the built-in code of the info if built-in |
prop_name | set to the name of the info if not built-in |
Sets PID framing mode. filters can consume packets as they arrive, or may want to only process full frames/files
PID | the target filter PID |
requires_full_blocks | if GF_TRUE, the packets on the PID will be reaggregated to form complete frame/files. |
Gets cumulated buffer duration of PID (recursive until source)
PID | the target filter PID |
check_pid_full | if GF_TRUE, returns 0 if the PID buffer is not yet full, or GF_FILTER_NO_TS if pid buffer is full |
void gf_filter_pid_try_pull | ( | GF_FilterPid * | PID | ) |
Try to force a synchronous flush of the filter chain downwards this PID. If refetching a packet returns NULL, this failed.
PID | the target filter PID |
const GF_PropertyValue* gf_filter_pid_get_info | ( | GF_FilterPid * | PID, |
u32 | prop_4cc, | ||
GF_PropertyEntry ** | propentry | ||
) |
Looks for a built-in property value on a PIDs. This is a recursive call on input chain Info query is NOT threadsafe in gpac, you Properties retrieved shall be released using gf_filter_release_property. See gf_filter_pid_get_info for more details.
PID | the target filter PID to query |
prop_4cc | the code of the built-in property to fetch |
propentry | the property reference object for later release. See gf_filter_pid_get_info for more details. |
const GF_PropertyValue* gf_filter_pid_get_info_str | ( | GF_FilterPid * | PID, |
const char * | prop_name, | ||
GF_PropertyEntry ** | propentry | ||
) |
Looks for a property value on a PIDs. This is a recursive call on both input and output chain Properties retrieved shall be released using gf_filter_release_property. See gf_filter_pid_get_info for more details.
PID | the target filter PID to query |
prop_name | the name of the property to fetch |
propentry | the property reference object for later release. See gf_filter_pid_get_info for more details. |
void gf_filter_pid_set_eos | ( | GF_FilterPid * | PID | ) |
Signals end of stream on a PID. Each filter needs to call this when EOS is reached on a given stream since there is no explicit link between input PIDs and output PIDs
PID | the target filter PID |
void gf_filter_pid_send_flush | ( | GF_FilterPid * | PID | ) |
Signals end of stream on a PID but force stream to be kept alive - used by source filters triggering a pipeline flush, the source filter will remain active after this call The flush signal sets all receiving PIDs into end of stream mode
PID | the target filter PID |
Bool gf_filter_pid_has_seen_eos | ( | GF_FilterPid * | PID | ) |
Checks for end of stream has been signaled a PID input chain. This is a recursive call on input chain. The function is typically used to abort buffering or synchronisation init in muxers.
PID | the target filter PID |
Bool gf_filter_pid_eos_received | ( | GF_FilterPid * | PID | ) |
Checks for end of stream has been signaled a PID. Contrary to gf_filter_pid_has_seen_eos this is not a recursive call and only checks the given pid.
PID | the target filter PID |
Bool gf_filter_pid_is_eos | ( | GF_FilterPid * | PID | ) |
Checks for end of stream signaling on a PID.
PID | the target filter PID |
Bool gf_filter_pid_is_flush_eos | ( | GF_FilterPid * | PID | ) |
Checks for flush-only end of stream signaling on a PID. Some filters may request a flush of the pipeline but will send further packets later on. This is signaled by a flush end of stream state Only filters storing the state of the pids internally should need to check this state.
PID | the target filter PID |
Bool gf_filter_pid_first_packet_is_empty | ( | GF_FilterPid * | PID | ) |
Checks if there is a packet ready on an input PID.
PID | the target filter PID |
Bool gf_filter_pid_first_packet_is_blocking_ref | ( | GF_FilterPid * | PID | ) |
Checks if the first packet on an input PID is a blocking ref.
PID | the target filter PID |
GF_FilterPacket* gf_filter_pid_get_packet | ( | GF_FilterPid * | PID | ) |
Gets the first packet in the input PID buffer. This may trigger a reconfigure signal on the filter. If reconfigure is not OK, returns NULL and the PID passed to the filter NO LONGER EXISTS (implicit remove) The packet is still present in the PID buffer until explicitly removed by gf_filter_pid_drop_packet
The returned packet is only valid for the current filter execution (process callback, task, ...), and may be discarded in-between calls, typically when the session is aborted. If a filter needs to keep a packet across calls, it must use gf_filter_pck_ref and gf_filter_pck_unref
If no packet is returned, the pid may be empty, in end of stream (cf gf_filter_pid_is_eos) or in flush (cf gf_filter_pid_is_flush_eos).
The first time this function is called on a PID at a flush point, it will return NULL even if some packets are pending. This allows the calling filter to detect if a flush point is reached and take appropriate actions. Subsequent calls will return the pending packet if any.
PID | the target filter PID |
Fetches the CTS of the first packet in the input PID buffer.
PID | the target filter PID |
cts | set to the composition time of the first packet, in PID timescale |
void gf_filter_pid_drop_packet | ( | GF_FilterPid * | PID | ) |
Drops the first packet in the input PID buffer.
PID | the target filter PID |
u32 gf_filter_pid_get_packet_count | ( | GF_FilterPid * | PID | ) |
Gets the number of packets in input PID buffer.
PID | the target filter PID |
Bool gf_filter_pid_check_caps | ( | GF_FilterPid * | PID | ) |
Checks the capability of the input PID match its destination filter.
PID | the target filter PID |
Bool gf_filter_pid_would_block | ( | GF_FilterPid * | PID | ) |
Checks if the PID would enter a blocking state if a new packet is sent. This function should be called by eg demuxers to regulate the rate at which they send packets
PID | the target filter PID |
Bool gf_filter_pid_is_sparse | ( | GF_FilterPid * | PID | ) |
Checks if the PID is sparse. A sparse PID may have holes in its timeline.
A sparse PID is always considered blocking for the regulation, even if gf_filter_pid_would_block for this PID can return FALSE (buffers not full). This avoids unblocking a filter when only its sparse output PIDs are not full (typically text streams).
A PID is sparse if:
PID | the target filter PID |
u32 gf_filter_pid_get_timescale | ( | GF_FilterPid * | PID | ) |
Shortcut to access the timescale of the PID - faster than get property as the timescale is locally cached for buffer management
PID | the target filter PID |
void gf_filter_pid_clear_eos | ( | GF_FilterPid * | PID, |
Bool | all_pids | ||
) |
Clears the end of stream flag on a PID.
PID | the target filter PID |
all_pids | if sets, clear end oof stream for all PIDs coming from the same filter as the target PID |
void gf_filter_pid_set_clock_mode | ( | GF_FilterPid * | PID, |
Bool | filter_in_charge | ||
) |
Indicates how clock references (PCR of MPEG-2) should be handled. By default these references are passed from input packets to output packets by the filter session (this assumes the filter doesn't modify composition timestamps). This default can be changed with this function.
PID | the target filter PID |
filter_in_charge | if set to GF_TRUE, clock references are not forwarded by the filter session and the filter is in charge of handling them |
GF_Err gf_filter_pid_resolve_file_template | ( | GF_FilterPid * | PID, |
const char | szTemplate[GF_MAX_PATH], | ||
char | szFinalName[GF_MAX_PATH], | ||
u32 | file_number, | ||
const char * | file_suffix | ||
) |
Resolves file template using PID properties and file index. Templates follow the DASH mechanism:
Supported KEYWORD (case insensitive):
PID | the target filter PID |
szTemplate | source template to solve |
szFinalName | buffer for final name |
file_number | number of file to use |
file_suffix | if not null, will be appended after the value of the §File$ keyword if present |
GF_Err gf_filter_pid_resolve_file_template_ex | ( | GF_FilterPid * | PID, |
const char | szTemplate[GF_MAX_PATH], | ||
char | szFinalName[GF_MAX_PATH], | ||
u32 | file_number, | ||
const char * | file_suffix, | ||
const char * | file_name | ||
) |
Same as gf_filter_pid_resolve_file_template but overrides file name with given name
PID | the target filter PID |
szTemplate | source template to solve |
szFinalName | buffer for final name |
file_number | number of file to use |
file_suffix | if not null, will be appended after the value of the §File$ keyword if present |
file_name | if not null, will be used instead of PID URL or local path |
Sets discard mode on or off on an input PID. When discard is on, all input packets for this PID are no longer dispatched.
This only affect the current PID, not the source filter(s) for that PID.
PID reconfigurations are still forwarded to the filter, so that a filter may decide to re-enable regular mode. Packets sent after a PID reconfiguration are kept until the PID is reconfigured, and discarded if the PID is still in discard mode.
This is typically needed for filters that stop consuming data for a while (dash forced period duration for example) but may resume consumption later on (stream moving from period 1 to period 2 for example).
PID | the target filter PID |
discard_on | enables/disables discard |
void gf_filter_pid_discard_block | ( | GF_FilterPid * | PID | ) |
Discard blocking mode for PID on end of stream. The filter is blocked when all output PIDs are in end of stream, this function unblocks the filter. This can be needed for playlist type filters dispatching end of stream at the end of each file but setting up next file in the following process() call.
PID | the target filter PID |
char* gf_filter_pid_get_destination | ( | GF_FilterPid * | PID | ) |
Gets URL argument of first destination of PID if any - memory shall be freed by caller.
PID | the target filter PID |
char* gf_filter_pid_get_source | ( | GF_FilterPid * | PID | ) |
Gets URL argument of first source of PID if any - memory shall be freed by caller.
PID | the target filter PID |
GF_Err gf_filter_pid_require_source_id | ( | GF_FilterPid * | PID | ) |
Indicates that this output PID requires a sourceID on the destination filter to be present. This prevents trying to link to other filters with no source IDs but accepting the PID
PID | the target filter PID |
void gf_filter_pid_recompute_dts | ( | GF_FilterPid * | PID, |
Bool | do_recompute | ||
) |
Enables decoding time reconstruction on PID for packets with DTS not set. If not enabled (default), dts not set implies dts = cts
PID | the target filter PID |
do_recompute | if set, dts will be recomputed when not set |
u32 gf_filter_pid_get_min_pck_duration | ( | GF_FilterPid * | PID | ) |
Queries minimum packet duration as computed from DTS/CTS info on the PID
PID | the target filter PID |
void gf_filter_pid_send_event | ( | GF_FilterPid * | PID, |
GF_FilterEvent * | evt | ||
) |
Sends an event down the filter chain for input PID, or up the filter chain for output PIDs.
PID | the target filter PID |
evt | the event to send |
void gf_filter_pid_init_play_event | ( | GF_FilterPid * | PID, |
GF_FilterEvent * | evt, | ||
Double | start, | ||
Double | speed, | ||
const char * | log_name | ||
) |
Helper function to init play events, that checks the PID GF_FilterPidPlaybackMode and adjust start/speed accordingly. This does not send the event.
PID | the target filter PID |
evt | the event to initialize |
start | playback start time of request |
speed | playback speed time of request |
log_name | name used for logs in case of capability mismatched |
Bool gf_filter_pid_is_playing | ( | GF_FilterPid * | PID | ) |
Check if the given PID is marked as playing or not.
PID | the target filter PID |
GF_Err gf_filter_pid_allow_direct_dispatch | ( | GF_FilterPid * | PID | ) |
Enables direct dispatch of packets to connected filters. This mode is useful when a filter may send a very large number of packets in one process() call; this is for example the case of the isobmff muxer in interleave mode. Using this mode avoids overloading the PID buffer with packets. If the session is multi-threaded, this parameter has no effect.
PID | the target filter PID |
void* gf_filter_pid_get_alias_udta | ( | GF_FilterPid * | PID | ) |
Gets the private stack of the alias filter associated with an input PID, if any
PID | the target filter PID |
GF_Filter* gf_filter_pid_get_owner | ( | GF_FilterPid * | PID | ) |
Gets the filter owning the PID
PID | the target filter PID |
GF_Filter* gf_filter_pid_get_source_filter | ( | GF_FilterPid * | PID | ) |
Gets the filter owning the input PID
PID | the target filter PID |
GF_Filter* gf_filter_pid_enum_destinations | ( | GF_FilterPid * | PID, |
u32 | idx | ||
) |
Enumerates the destination filters of an output PID
PID | the target filter PID |
idx | the target destination index |
Ignore this PID in blocking mode estimations.
This is typically used when a filter consumes N pids, with some at very low frequency for which an empty queue should not imply unblocking the filter to refill the queue.
PID | the target filter PID |
do_ignore | if GF_TRUE, the PID will not be considered when trying to unblock the filter |
u64 gf_filter_pid_get_next_ts | ( | GF_FilterPid * | PID | ) |
Gets next estimated time on this PID, ie last_pck(DTS+dur) or last_pck(CTS+dur)
PID | the target filter PID |
Bool gf_filter_pid_has_decoder | ( | GF_FilterPid * | PID | ) |
Checks if a decoder is present in parent chain of this pid. This is a recursive call on input chain. The function is typically used when setting up buffer levels on raw media pids.
PID | the target filter PID |
Sets real-time stats on PID (input PID only for now)
PID | the target filter PID |
rtt_ms | estimated round-trip time in ms |
jitter_us | estimated packet inter-arrival jitter in us |
loss_rate | loss rate in per-thousand |
GF_Err gf_filter_pid_get_rfc_6381_codec_string | ( | GF_FilterPid * | PID, |
char * | szCodec, | ||
Bool | force_inband, | ||
Bool | force_sbr, | ||
const GF_PropertyValue * | tile_base_dcd, | ||
u32 * | out_inband_forced | ||
) |
Returns RFC6381 "codec" string of a PID
PID | the target filter PID |
szCodec | string to be written, must be RFC6381_CODEC_NAME_SIZE_MAX at least |
force_inband | forces inband signaling for avc/hevc/etc |
force_sbr | forces SBR signaling for AAC |
tile_base_dcd | decoder config of tiled base track if known, may be NULL otherwise |
out_inband_forced | set to 1 if inband is to be forced (dasher only) - may be NULL |