libgpac
Documentation of the core library of GPAC
Filter Packet

Filter data exchange. More...

+ Collaboration diagram for Filter Packet:

Data Structures

struct  GF_FilterFrameInterface
 

Macros

#define GF_FILTER_PCK_CRYPT   1
 

Typedefs

typedef struct __matrix GF_Matrix_unexposed
 

Enumerations

enum  GF_FilterSAPType {
  GF_FILTER_SAP_NONE = 0 , GF_FILTER_SAP_1 , GF_FILTER_SAP_2 , GF_FILTER_SAP_3 ,
  GF_FILTER_SAP_4 , GF_FILTER_SAP_4_PROL
}
 
enum  GF_FilterClockType { GF_FILTER_CLOCK_NONE =0 , GF_FILTER_CLOCK_PCR , GF_FILTER_CLOCK_PCR_DISC }
 
enum  { GF_FRAME_IFCE_BLOCKING = 1 , GF_FRAME_IFCE_MAIN_GLFB = 1<<1 }
 

Functions

GF_Err gf_filter_pck_ref (GF_FilterPacket **pck)
 
GF_FilterPacket * gf_filter_pck_ref_ex (GF_FilterPacket *pck)
 
void gf_filter_pck_unref (GF_FilterPacket *pck)
 
GF_Err gf_filter_pck_ref_props (GF_FilterPacket **pck)
 
GF_FilterPacket * gf_filter_pck_new_alloc (GF_FilterPid *PID, u32 data_size, u8 **data)
 
GF_FilterPacket * gf_filter_pck_new_shared (GF_FilterPid *PID, const u8 *data, u32 data_size, gf_fsess_packet_destructor destruct)
 
GF_FilterPacket * gf_filter_pck_new_ref (GF_FilterPid *PID, u32 data_offset, u32 data_size, GF_FilterPacket *source_packet)
 
GF_FilterPacket * gf_filter_pck_new_ref_destructor (GF_FilterPid *PID, u32 data_offset, u32 data_size, GF_FilterPacket *source_packet, gf_fsess_packet_destructor destruct)
 
GF_FilterPacket * gf_filter_pck_new_alloc_destructor (GF_FilterPid *PID, u32 data_size, u8 **data, gf_fsess_packet_destructor destruct)
 
GF_FilterPacket * gf_filter_pck_new_clone (GF_FilterPid *PID, GF_FilterPacket *pck_source, u8 **data)
 
GF_FilterPacket * gf_filter_pck_new_copy (GF_FilterPid *PID, GF_FilterPacket *pck_source, u8 **data)
 
GF_FilterPacket * gf_filter_pck_dangling_copy (GF_FilterPacket *pck_source, GF_FilterPacket *cached_pck)
 
GF_FilterPacket * gf_filter_pck_dangling_clone (GF_FilterPacket *pck_source, GF_FilterPacket *cached_pck)
 
GF_Err gf_filter_pck_set_readonly (GF_FilterPacket *pck)
 
void gf_filter_pck_check_realloc (GF_FilterPacket *pck, u8 *data, u32 size)
 
GF_Err gf_filter_pck_send (GF_FilterPacket *pck)
 
void gf_filter_pck_discard (GF_FilterPacket *pck)
 
GF_Err gf_filter_pck_forward (GF_FilterPacket *reference, GF_FilterPid *PID)
 
const u8gf_filter_pck_get_data (GF_FilterPacket *pck, u32 *size)
 
GF_Err gf_filter_pck_set_property (GF_FilterPacket *pck, u32 prop_4cc, const GF_PropertyValue *value)
 
GF_Err gf_filter_pck_set_property_str (GF_FilterPacket *pck, const char *name, const GF_PropertyValue *value)
 
GF_Err gf_filter_pck_set_property_dyn (GF_FilterPacket *pck, char *name, const GF_PropertyValue *value)
 
Bool gf_filter_pck_has_properties (GF_FilterPacket *pck)
 
GF_Err gf_filter_pck_merge_properties (GF_FilterPacket *pck_src, GF_FilterPacket *pck_dst)
 
GF_Err gf_filter_pck_merge_properties_filter (GF_FilterPacket *pck_src, GF_FilterPacket *pck_dst, gf_filter_prop_filter filter_prop, void *cbk)
 
const GF_PropertyValue * gf_filter_pck_get_property (GF_FilterPacket *pck, u32 prop_4cc)
 
const GF_PropertyValue * gf_filter_pck_get_property_str (GF_FilterPacket *pck, const char *prop_name)
 
const GF_PropertyValue * gf_filter_pck_enum_properties (GF_FilterPacket *pck, u32 *idx, u32 *prop_4cc, const char **prop_name)
 
GF_Err gf_filter_pck_set_framing (GF_FilterPacket *pck, Bool is_start, Bool is_end)
 
GF_Err gf_filter_pck_get_framing (GF_FilterPacket *pck, Bool *is_start, Bool *is_end)
 
GF_Err gf_filter_pck_set_dts (GF_FilterPacket *pck, u64 dts)
 
u64 gf_filter_pck_get_dts (GF_FilterPacket *pck)
 
GF_Err gf_filter_pck_set_cts (GF_FilterPacket *pck, u64 cts)
 
u64 gf_filter_pck_get_cts (GF_FilterPacket *pck)
 
u32 gf_filter_pck_get_timescale (GF_FilterPacket *pck)
 
GF_Err gf_filter_pck_set_duration (GF_FilterPacket *pck, u32 duration)
 
u32 gf_filter_pck_get_duration (GF_FilterPacket *pck)
 
GF_Err gf_filter_pck_expand (GF_FilterPacket *pck, u32 nb_bytes_to_add, u8 **data_start, u8 **new_range_start, u32 *new_size)
 
GF_Err gf_filter_pck_truncate (GF_FilterPacket *pck, u32 size)
 
GF_Err gf_filter_pck_set_sap (GF_FilterPacket *pck, GF_FilterSAPType sap_type)
 
GF_FilterSAPType gf_filter_pck_get_sap (GF_FilterPacket *pck)
 
GF_Err gf_filter_pck_set_interlaced (GF_FilterPacket *pck, u32 is_interlaced)
 
u32 gf_filter_pck_get_interlaced (GF_FilterPacket *pck)
 
GF_Err gf_filter_pck_set_corrupted (GF_FilterPacket *pck, Bool is_corrupted)
 
Bool gf_filter_pck_get_corrupted (GF_FilterPacket *pck)
 
GF_Err gf_filter_pck_set_seek_flag (GF_FilterPacket *pck, Bool is_seek)
 
Bool gf_filter_pck_get_seek_flag (GF_FilterPacket *pck)
 
GF_Err gf_filter_pck_set_byte_offset (GF_FilterPacket *pck, u64 byte_offset)
 
u64 gf_filter_pck_get_byte_offset (GF_FilterPacket *pck)
 
GF_Err gf_filter_pck_set_roll_info (GF_FilterPacket *pck, s16 roll_count)
 
s16 gf_filter_pck_get_roll_info (GF_FilterPacket *pck)
 
GF_Err gf_filter_pck_set_crypt_flags (GF_FilterPacket *pck, u8 crypt_flag)
 
u8 gf_filter_pck_get_crypt_flags (GF_FilterPacket *pck)
 
GF_Err gf_filter_pck_set_clock_type (GF_FilterPacket *pck, GF_FilterClockType ctype)
 
GF_FilterClockType gf_filter_pid_get_clock_info (GF_FilterPid *PID, u64 *clock_val, u32 *timescale)
 
GF_FilterClockType gf_filter_pck_get_clock_type (GF_FilterPacket *pck)
 
GF_Err gf_filter_pck_set_carousel_version (GF_FilterPacket *pck, u8 version_number)
 
u8 gf_filter_pck_get_carousel_version (GF_FilterPacket *pck)
 
GF_Err gf_filter_pck_set_dependency_flags (GF_FilterPacket *pck, u8 dep_flags)
 
u8 gf_filter_pck_get_dependency_flags (GF_FilterPacket *pck)
 
GF_Err gf_filter_pck_set_seq_num (GF_FilterPacket *pck, u32 seq_num)
 
u32 gf_filter_pck_get_seq_num (GF_FilterPacket *pck)
 
GF_FilterPacket * gf_filter_pck_new_frame_interface (GF_FilterPid *PID, GF_FilterFrameInterface *frame_ifce, gf_fsess_packet_destructor destruct)
 
GF_FilterFrameInterfacegf_filter_pck_get_frame_interface (GF_FilterPacket *pck)
 
Bool gf_filter_pck_is_blocking_ref (GF_FilterPacket *pck)
 

Detailed Description

Packets consist in block of data or reference to such blocks, passed from the source to the sink only. Internally, a packet created by a filter (output packet) is different from an input packet to a filter (gf_filter_pid_get_packet) but the API has been designed to hide this, so that most packet functions can be called regardless of the input/output nature of the PID.

Packets have native attributes (timing, sap state, ...) but may also have any number of properties associated to them.

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 packet relates to an input packet. Developpers must therefore manually copy packet properties that seem relevant, or more practically copy all properties from input packet to output packet and reassign output packet properties changed by the filter.

In order to handle reordering of packets, it is possible to keep references to either packets (may block the filter chain), or packet properties.

Packets shall always be dispatched in their processing order (decode order). If reordering upon reception is needed, or AU interleaving is used, a filter SHALL do the reordering. However, packets do not have to be sent in their creation order: a created packet is not assigned to PID buffers until it is sent.

Macro Definition Documentation

◆ GF_FILTER_PCK_CRYPT

#define GF_FILTER_PCK_CRYPT   1

Crypt flags for packet

Typedef Documentation

◆ GF_Matrix_unexposed

typedef struct __matrix GF_Matrix_unexposed

Redefinition of GF_Matrix but without the maths.h include which breaks VideoToolBox on OSX/iOS

Enumeration Type Documentation

◆ GF_FilterSAPType

SAP types as defined in annex I of ISOBMFF

Enumerator
GF_FILTER_SAP_NONE 

no SAP

GF_FILTER_SAP_1 

closed gop no leading

GF_FILTER_SAP_2 

closed gop leading

GF_FILTER_SAP_3 

open gop

GF_FILTER_SAP_4 

roll period (GDR or audio roll) - roll distance must be indicated in packet

GF_FILTER_SAP_4_PROL 

Audio preroll period - roll distance must be indicated in packet

◆ GF_FilterClockType

Packet clock reference types - used for MPEG-2 TS

Enumerator
GF_FILTER_CLOCK_NONE 

packet is not a clock reference

GF_FILTER_CLOCK_PCR 

packet is a PCR clock reference, expressed in PID timescale

GF_FILTER_CLOCK_PCR_DISC 

packet is a PCR clock discontinuity, expressed in PID timescale

◆ anonymous enum

anonymous enum

frame interface flags

Enumerator
GF_FRAME_IFCE_BLOCKING 

When set , indicates that the emitting filter will block until this frame is released. Consumers of such a packet shall drop the packet as soon as possible, since it blocks the emiting filter.

GF_FRAME_IFCE_MAIN_GLFB 

When set , indicates that the associated framebuffer is the main GL framebuffer.

Function Documentation

◆ gf_filter_pck_ref()

GF_Err gf_filter_pck_ref ( GF_FilterPacket **  pck)

Keeps a reference to the given input packet. The packet shall be released at some point using gf_filter_pck_unref

Filters keeping reference to packets should check if the packet is a blocking reference using gf_filter_pck_is_blocking_ref. If this is the case, the input chain will likely be blocked until the packet reference is released.

Parameters
pckthe target input packet
Returns
error if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_ref_ex()

GF_FilterPacket* gf_filter_pck_ref_ex ( GF_FilterPacket *  pck)

Same as gf_filter_pck_ref but doesn't use pointer to packet

Parameters
pckthe target input packet
Returns
the new reference to the packet

◆ gf_filter_pck_unref()

void gf_filter_pck_unref ( GF_FilterPacket *  pck)

Remove a reference to the given input packet. The packet might be destroyed after that call.

Parameters
pckthe target input packet
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_ref_props()

GF_Err gf_filter_pck_ref_props ( GF_FilterPacket **  pck)

Creates a reference to the packet properties, but not to the data. This is mostly useful for encoders/decoders/filters with delay, where the input packet needs to be released before getting the corresponding output (frame reordering & co). This allows merging back packet properties after some delay without blocking the filter chain.

Parameters
pckthe target input packet
Returns
error if any
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_new_alloc()

GF_FilterPacket* gf_filter_pck_new_alloc ( GF_FilterPid *  PID,
u32  data_size,
u8 **  data 
)

Allocates a new packet on the output PID with associated allocated data. The packet has by default no DTS, no CTS, no duration framing set to full frame (start=end=1) and all other flags set to 0 (including SAP type).

Parameters
PIDthe target output PID
data_sizethe desired size of the packet - can be changed later
dataset to the writable buffer of the created packet
Returns
new packet or NULL if allocation error or not an output PID
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_new_shared()

GF_FilterPacket* gf_filter_pck_new_shared ( GF_FilterPid *  PID,
const u8 data,
u32  data_size,
gf_fsess_packet_destructor  destruct 
)

Allocates a new packet on the output PID referencing internal data. The packet has by default no DTS, no CTS, no duration framing set to full frame (start=end=1) and all other flags set to 0 (including SAP type).

Parameters
PIDthe target output PID
datathe data block to dispatch
data_sizethe size of the data block to dispatch
destructthe callback function used to destroy the packet when no longer used - may be NULL
Returns
new packet or NULL if allocation error or not an output PID
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_new_ref()

GF_FilterPacket* gf_filter_pck_new_ref ( GF_FilterPid *  PID,
u32  data_offset,
u32  data_size,
GF_FilterPacket *  source_packet 
)

Allocates a new packet on the output PID referencing data of some input packet. The packet has by default no DTS, no CTS, no duration framing set to full frame (start=end=1) and all other flags set to 0 (including SAP type).

Parameters
PIDthe target output PID
data_offsetoffset in the source data block
data_sizethe size of the data block to dispatch - if 0, the entire data of the source packet beginning at offset is used
source_packetthe source packet this data belongs to (at least from the filter point of view).
Returns
new packet or NULL if allocation error or not an output PID
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_new_ref_destructor()

GF_FilterPacket* gf_filter_pck_new_ref_destructor ( GF_FilterPid *  PID,
u32  data_offset,
u32  data_size,
GF_FilterPacket *  source_packet,
gf_fsess_packet_destructor  destruct 
)

Same as gf_filter_pck_new_ref with packet destructor callbacl

Parameters
PIDthe target output PID
data_offsetoffset in the source data block
data_sizethe size of the data block to dispatch - if 0, the entire data of the source packet beginning at offset is used
source_packetthe source packet this data belongs to (at least from the filter point of view).
destructthe callback function used to destroy the packet when no longer used - may be NULL
Returns
new packet or NULL if allocation error or not an output PID
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_new_alloc_destructor()

GF_FilterPacket* gf_filter_pck_new_alloc_destructor ( GF_FilterPid *  PID,
u32  data_size,
u8 **  data,
gf_fsess_packet_destructor  destruct 
)

Allocates a new packet on the output PID with associated allocated data. The packet has by default no DTS, no CTS, no duration framing set to full frame (start=end=1) and all other flags set to 0 (including SAP type).

Parameters
PIDthe target output PID
data_sizethe desired size of the packet - can be changed later
dataset to the writable buffer of the created packet
destructthe callback function used to destroy the packet when no longer used - may be NULL
Returns
new packet or NULL if allocation error or not an output PID
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_new_clone()

GF_FilterPacket* gf_filter_pck_new_clone ( GF_FilterPid *  PID,
GF_FilterPacket *  pck_source,
u8 **  data 
)

Clones a new packet from a source packet and copy all source properties to output. If the source packet uses a frame interface object or has no associated data, returns a copy of the packet. If the source packet is referenced more than once (ie more than just the caller), a new packet on the output PID is allocated with source data copied. Otherwise, the source data is assigned to the output packet. This is typically called by filter wishing to perform in-place processing of input data.

Parameters
PIDthe target output PID
pck_sourcethe desired source packet to clone
dataset to the writable buffer of the created packet
Returns
new packet or NULL if allocation error or not an output PID
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_new_copy()

GF_FilterPacket* gf_filter_pck_new_copy ( GF_FilterPid *  PID,
GF_FilterPacket *  pck_source,
u8 **  data 
)

Copies a new packet from a source packet and copy all source properties to output.

Parameters
PIDthe target output PID
pck_sourcethe desired source packet to clone
dataset to the writable buffer of the created packet
Returns
new packet or NULL if allocation error or not an output PID
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_dangling_copy()

GF_FilterPacket* gf_filter_pck_dangling_copy ( GF_FilterPacket *  pck_source,
GF_FilterPacket *  cached_pck 
)

Creates a read-only detached copy of a packet from a source packet and copy all source properties to output.

If the source packet uses a frame interface object or has no associated data, returns a copy of the packet. If the source packet is referenced more than once (ie more than just the caller), a new packet on the output PID is allocated with source data copied. Otherwise, the source data is assigned to the output packet.

This is typically called by filters requiring read access to data for packets using frame interfaces.

Parameters
pck_sourcethe target source packet
cached_pckif not NULL, will try to reuse this packet if possible (if not possible, this packet will be destroyed)
Returns
new packet or NULL if allocation error or not an output PID
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_dangling_clone()

GF_FilterPacket* gf_filter_pck_dangling_clone ( GF_FilterPacket *  pck_source,
GF_FilterPacket *  cached_pck 
)

Creates a detached clone of a packet from a source packet and copy all source properties to output.

If the source packet uses a frame interface object or has no associated data, returns a copy of the packet. Otherwise, the source data is copied in the output packet.

This is typically called by filters reaggregating packets on their own.

Parameters
pck_sourcethe target source packet
cached_pckif not NULL, will try to reuse this packet if possible (if not possible, this packet will be destroyed)
Returns
new packet or NULL if allocation error or not an output PID
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_readonly()

GF_Err gf_filter_pck_set_readonly ( GF_FilterPacket *  pck)

Marks memory of a shared packet as non-writable. By default gf_filter_pck_new_shared and gf_filter_pck_new_ref allow write access to internal memory in case the packet can be cloned (single reference used). If your filter relies on the content of the shared memory for its internal state, packet must be marked as read-only to avoid later state corruption. Note that packets created with gf_filter_pck_new_frame_interface are always treated as read-only packets

Parameters
pckthe target output packet to send
Returns
error if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_check_realloc()

void gf_filter_pck_check_realloc ( GF_FilterPacket *  pck,
u8 data,
u32  size 
)

Checks if packet data has been reallocated

There are cases where memory allocated by gf_filter_pck_new_ref allow needs to be reallocated without using gf_filter_pck_expand . This function allows checking if the data has changed, and if so reassign the new block to the packet. If the data pointer was not changed, the packet data size is updated to the new size (acts as gf_filter_pck_truncate). The data shall have been reallocated with gf_realloc.

Parameters
pckthe target packet to send
datathe reallocated data pointer
sizethe reallocated data size
+ Here is the caller graph for this function:

◆ gf_filter_pck_send()

GF_Err gf_filter_pck_send ( GF_FilterPacket *  pck)

Sends the packet on its output PID. Packets SHALL be sent in processing order (eg, decoding order for video). However, packets don't have to be sent in their allocation order. Packet shall not be modified after this call, as it may be discarded during the call.

Parameters
pckthe target output packet to send
Returns
error if any
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_discard()

void gf_filter_pck_discard ( GF_FilterPacket *  pck)

Destructs a packet allocated but that cannot be sent. Shall not be used on packet references.

Parameters
pckthe target output packet to send
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_forward()

GF_Err gf_filter_pck_forward ( GF_FilterPacket *  reference,
GF_FilterPid *  PID 
)

Destructs a packet allocated but that cannot be sent. Shall not be used on packet references. This is a shortcut to gf_filter_pck_new_ref + gf_filter_pck_merge_properties + gf_filter_pck_send

Parameters
referencethe input packet to forward
PIDthe output PID to forward to
Returns
error code if any
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_data()

const u8* gf_filter_pck_get_data ( GF_FilterPacket *  pck,
u32 size 
)

Gets data associated with the packet.

Parameters
pckthe target packet
sizeset to the packet data size
Returns
packet data if any, NULL if empty or if the packet uses a frame interface object. See gf_filter_pck_get_frame_interface
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_property()

GF_Err gf_filter_pck_set_property ( GF_FilterPacket *  pck,
u32  prop_4cc,
const GF_PropertyValue *  value 
)

Sets a built-in property of a packet

Parameters
pckthe target packet
prop_4ccthe code of the built-in property to set
valuethe property value to set
Returns
error code if any
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_property_str()

GF_Err gf_filter_pck_set_property_str ( GF_FilterPacket *  pck,
const char *  name,
const GF_PropertyValue *  value 
)

Sets a property of a packet

Parameters
pckthe target packet
namethe name of the property to set
valuethe property value to set
Returns
error code if any
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_property_dyn()

GF_Err gf_filter_pck_set_property_dyn ( GF_FilterPacket *  pck,
char *  name,
const GF_PropertyValue *  value 
)

Sets a property of a packet

Parameters
pckthe target packet
namethe code of the property to set. The name will be copied to the property, and memory destruction performed by the filter session
valuethe property value to set
Returns
error code if any
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_has_properties()

Bool gf_filter_pck_has_properties ( GF_FilterPacket *  pck)

Checks if a packet has properties other than packet built-in ones

This is typically needed to decide whether a packet with no data should be forwarded or not

Parameters
pckthe target packet
Returns
GF_TRUE if packet has properties, GF_FALSE otherwise
+ Here is the caller graph for this function:

◆ gf_filter_pck_merge_properties()

GF_Err gf_filter_pck_merge_properties ( GF_FilterPacket *  pck_src,
GF_FilterPacket *  pck_dst 
)

Merge properties of source packet into destination packet but does NOT reset destination packet properties

Parameters
pck_srcsource packet
pck_dstdestination packet
Returns
error code if any
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_merge_properties_filter()

GF_Err gf_filter_pck_merge_properties_filter ( GF_FilterPacket *  pck_src,
GF_FilterPacket *  pck_dst,
gf_filter_prop_filter  filter_prop,
void *  cbk 
)

Same as gf_filter_pck_merge_properties but uses a filter callback to select properties to merge

Parameters
pck_srcsource packet
pck_dstdestination packet
filter_propcallback filtering function
cbkcallback data passed to the callback function
Returns
error code if any
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_property()

const GF_PropertyValue* gf_filter_pck_get_property ( GF_FilterPacket *  pck,
u32  prop_4cc 
)

Gets built-in property of packet.

Parameters
pcktarget packet
prop_4ccthe code of the built-in property
Returns
the property if found, NULL otherwise
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_property_str()

const GF_PropertyValue* gf_filter_pck_get_property_str ( GF_FilterPacket *  pck,
const char *  prop_name 
)

Gets property of packet.

Parameters
pcktarget packet
prop_namethe name of the property
Returns
the property if found, NULL otherwise
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_enum_properties()

const GF_PropertyValue* gf_filter_pck_enum_properties ( GF_FilterPacket *  pck,
u32 idx,
u32 prop_4cc,
const char **  prop_name 
)

Enumerates properties on packets.

Parameters
pcktarget packet
idxinput/output index of the current property. 0 means first. Incremented by 1 upon success
prop_4ccset to the code of the built-in property
prop_nameset to the name of the property
Returns
the property if found, NULL otherwise
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_framing()

GF_Err gf_filter_pck_set_framing ( GF_FilterPacket *  pck,
Bool  is_start,
Bool  is_end 
)

Sets packet framing info. A full frame is a complete entity for the stream type, ie an access unit for media streams and a complete file for file streams

Parameters
pcktarget packet
is_startpacket is start of the frame
is_endpacket is end of the frame
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_framing()

GF_Err gf_filter_pck_get_framing ( GF_FilterPacket *  pck,
Bool is_start,
Bool is_end 
)

Gets packet framing info. A full frame is a complete entity for the stream type, ie an access unit for media streams and a complete file for file streams

Parameters
pcktarget packet
is_startset to GF_TRUE if packet is start of the frame, to GF_FALSE otherwise
is_endset to GF_TRUE if packet is end of the frame, to GF_FALSE otherwise
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_dts()

GF_Err gf_filter_pck_set_dts ( GF_FilterPacket *  pck,
u64  dts 
)

Sets Decoding Timestamp (DTS) of the packet. Do not set if unknown - automatic packet duration is based on DTS diff if DTS is present, otherwise in CTS diff.

Parameters
pcktarget packet
dtsdecoding timestamp of packet, in PID timescale units
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_dts()

u64 gf_filter_pck_get_dts ( GF_FilterPacket *  pck)

Gets Decoding Timestamp (DTS) of the packet.

Parameters
pcktarget packet
Returns
dts decoding timestamp of packet, in PID timescale units
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_cts()

GF_Err gf_filter_pck_set_cts ( GF_FilterPacket *  pck,
u64  cts 
)

Sets Composition Timestamp (CTS) of the packet. Do not set if unknown - automatic packet duration is based on DTS diff if DTS is present, otherwise in CTS diff.

Parameters
pcktarget packet
ctscomposition timestamp of packet, in PID timescale units
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_cts()

u64 gf_filter_pck_get_cts ( GF_FilterPacket *  pck)

Gets Composition Timestamp (CTS) of the packet.

Parameters
pcktarget packet
Returns
cts composition timestamp of packet, in PID timescale units
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_timescale()

u32 gf_filter_pck_get_timescale ( GF_FilterPacket *  pck)

Returns packet timescale (same as PID timescale)

Parameters
pcktarget packet
Returns
packet timescale
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_duration()

GF_Err gf_filter_pck_set_duration ( GF_FilterPacket *  pck,
u32  duration 
)

Sets packet duration

Parameters
pcktarget packet
durationduration of packet, in PID timescale units
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_duration()

u32 gf_filter_pck_get_duration ( GF_FilterPacket *  pck)

Gets packet duration

Parameters
pcktarget packet
Returns
duration duration of packet, in PID timescale units
+ Here is the caller graph for this function:

◆ gf_filter_pck_expand()

GF_Err gf_filter_pck_expand ( GF_FilterPacket *  pck,
u32  nb_bytes_to_add,
u8 **  data_start,
u8 **  new_range_start,
u32 new_size 
)

reallocates packet not yet sent. Returns data start and new range of data. This will reset byte offset information to not available.

Parameters
pcktarget packet
nb_bytes_to_addbytes to add to packet
data_startrealloc pointer of packet data start - may be NULL if new_range_start is set
new_range_startpointer to new (apppended space) data - may be NULL if data_start is set
new_sizefull size of allocated block. - may be be NULL
Returns
error code if any
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_truncate()

GF_Err gf_filter_pck_truncate ( GF_FilterPacket *  pck,
u32  size 
)

Truncates packet not yet sent to given size

Parameters
pcktarget packet
sizenew size to truncate to
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_sap()

GF_Err gf_filter_pck_set_sap ( GF_FilterPacket *  pck,
GF_FilterSAPType  sap_type 
)

Sets packet SAP type

Parameters
pcktarget packet
sap_typeSAP type of the packet
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_sap()

GF_FilterSAPType gf_filter_pck_get_sap ( GF_FilterPacket *  pck)

Sets packet SAP type

Parameters
pcktarget packet
Returns
sap_type SAP type of the packet
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_interlaced()

GF_Err gf_filter_pck_set_interlaced ( GF_FilterPacket *  pck,
u32  is_interlaced 
)

Sets packet video interlacing flag

Parameters
pcktarget packet
is_interlacedset to 0: not interlaced 1: top field first or contains only top field if packet not full frame 2: bottom field first or contains only bottom field.
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_interlaced()

u32 gf_filter_pck_get_interlaced ( GF_FilterPacket *  pck)

Gets packet video interlacing flag

Parameters
pcktarget packet
Returns
interlaced flag, see gf_filter_pck_set_interlaced
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_corrupted()

GF_Err gf_filter_pck_set_corrupted ( GF_FilterPacket *  pck,
Bool  is_corrupted 
)

Sets packet corrupted data flag

Parameters
pcktarget packet
is_corruptedindicates if data in packet is corrupted
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_corrupted()

Bool gf_filter_pck_get_corrupted ( GF_FilterPacket *  pck)

Gets packet corrupted data flag

Parameters
pcktarget packet
Returns
GF_TRUE if data in packet is corrupted
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_seek_flag()

GF_Err gf_filter_pck_set_seek_flag ( GF_FilterPacket *  pck,
Bool  is_seek 
)

Sets seek flag of packet. For PIDs of stream type FILE with GF_PROP_PID_DISABLE_PROGRESSIVE set, the seek flag set to GF_TRUE indicates that the packet is a PATCH packet, replacing bytes located at gf_filter_pck_get_byte_offset in file if the interlaced flag of the packet is not set, or inserting bytes located at gf_filter_pck_get_byte_offset in file if the interlaced flag of the packet is set. If the corrupted flag is set, this indicates the data will be replaced later on. A seek packet is not meant to be displayed but is needed for decoding.

Note
If a packet is partially skipped but completely decoded, it shall not be marked as seek but have the property "SkipBegin" set.
Raw audio packets MUST be split at the proper boundary
Parameters
pcktarget packet
is_seekindicates packet is seek frame
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_seek_flag()

Bool gf_filter_pck_get_seek_flag ( GF_FilterPacket *  pck)

Gets packet seek data flag

Parameters
pcktarget packet
Returns
GF_TRUE if packet is a seek packet
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_byte_offset()

GF_Err gf_filter_pck_set_byte_offset ( GF_FilterPacket *  pck,
u64  byte_offset 
)

Sets packet byte offset in source. byte offset should only be set if the data in the packet is exactly the same as the one at the given byte offset

Parameters
pcktarget packet
byte_offsetindicates the byte offset in the source. By default packets are created with no byte offset
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_byte_offset()

u64 gf_filter_pck_get_byte_offset ( GF_FilterPacket *  pck)

Sets packet byte offset in source

Parameters
pcktarget packet
Returns
byte offset in the source
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_roll_info()

GF_Err gf_filter_pck_set_roll_info ( GF_FilterPacket *  pck,
s16  roll_count 
)

Sets packet roll info (number of packets to rewind/forward and decode to get a clean access point).

Parameters
pcktarget packet
roll_countindicates the roll distance of this packet - only used for SAP 4 for now
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_roll_info()

s16 gf_filter_pck_get_roll_info ( GF_FilterPacket *  pck)

Gets packet roll info.

Parameters
pcktarget packet
Returns
roll distance of this packet
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_crypt_flags()

GF_Err gf_filter_pck_set_crypt_flags ( GF_FilterPacket *  pck,
u8  crypt_flag 
)

Sets packet crypt flags

Parameters
pcktarget packet
crypt_flagpacket crypt flag
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_crypt_flags()

u8 gf_filter_pck_get_crypt_flags ( GF_FilterPacket *  pck)

Gets packet crypt flags

Parameters
pcktarget packet
Returns
packet crypt flag
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_clock_type()

GF_Err gf_filter_pck_set_clock_type ( GF_FilterPacket *  pck,
GF_FilterClockType  ctype 
)

Sets packet clock type

Parameters
pcktarget packet
ctypepacket clock flag
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pid_get_clock_info()

GF_FilterClockType gf_filter_pid_get_clock_info ( GF_FilterPid *  PID,
u64 clock_val,
u32 timescale 
)

Gets last clock type and clock value on PID. Always returns 0 if the source filter manages clock references internally cd gf_filter_pid_set_clock_mode.

Parameters
PIDtarget PID to query for clock
clock_vallast clock reference found
timescalelast clock reference timescale
Returns
ctype packet clock flag
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_clock_type()

GF_FilterClockType gf_filter_pck_get_clock_type ( GF_FilterPacket *  pck)

Gets clock type of packet. Always returns 0 if the source filter does NOT manages clock references internally cd gf_filter_pid_set_clock_mode.

Parameters
pcktarget packet
Returns
ctype packet clock flag
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_carousel_version()

GF_Err gf_filter_pck_set_carousel_version ( GF_FilterPacket *  pck,
u8  version_number 
)

Sets packet carousel info

Parameters
pcktarget packet
version_numbercarousel version number associated with this data chunk
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_carousel_version()

u8 gf_filter_pck_get_carousel_version ( GF_FilterPacket *  pck)

Gets packet carousel info

Parameters
pcktarget packet
Returns
version_number carousel version number associated with this data chunk
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_dependency_flags()

GF_Err gf_filter_pck_set_dependency_flags ( GF_FilterPacket *  pck,
u8  dep_flags 
)

Sets packet sample dependency flags.

Sample dependency flags have the same semantics as ISOBMFF:
bit(2)is_leading bit(2)sample_depends_on (2)sample_is_depended_on (2)sample_has_redundancy

is_leading takes one of the following four values:
0: the leading nature of this sample is unknown;
1: this sample is a leading sample that has a dependency before the referenced I-picture (and is therefore not decodable);
2: this sample is not a leading sample;
3: this sample is a leading sample that has no dependency before the referenced I-picture (and is therefore decodable);
sample_depends_on takes one of the following four values:
0: the dependency of this sample is unknown;
1: this sample does depend on others (not an I picture);
2: this sample does not depend on others (I picture);
3: reserved
sample_is_depended_on takes one of the following four values:
0: the dependency of other samples on this sample is unknown;
1: other samples may depend on this one (not disposable);
2: no other sample depends on this one (disposable);
3: reserved
sample_has_redundancy takes one of the following four values:
0: it is unknown whether there is redundant coding in this sample;
1: there is redundant coding in this sample;
2: there is no redundant coding in this sample;
3: reserved

Parameters
pcktarget packet
dep_flagssample dependency flags
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_dependency_flags()

u8 gf_filter_pck_get_dependency_flags ( GF_FilterPacket *  pck)

Gets packet sample dependency flags.

Parameters
pcktarget packet
Returns
dep_flags sample dependency flags - see gf_filter_pck_set_dependency_flags for syntax.
+ Here is the caller graph for this function:

◆ gf_filter_pck_set_seq_num()

GF_Err gf_filter_pck_set_seq_num ( GF_FilterPacket *  pck,
u32  seq_num 
)

Sets packet sequence number. Shall only be used when a filter handles a PLAY request based on packet sequence number

Parameters
pcktarget packet
seq_numsequence number of packet
Returns
error code if any
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_seq_num()

u32 gf_filter_pck_get_seq_num ( GF_FilterPacket *  pck)

Gets packet sequence number info

Parameters
pcktarget packet
Returns
sequence number associated with this packet
+ Here is the caller graph for this function:

◆ gf_filter_pck_new_frame_interface()

GF_FilterPacket* gf_filter_pck_new_frame_interface ( GF_FilterPid *  PID,
GF_FilterFrameInterface frame_ifce,
gf_fsess_packet_destructor  destruct 
)

Allocates a new packet holding a reference to a frame interface object. The packet has by default no DTS, no CTS, no duration framing set to full frame (start=end=1) and all other flags set to 0 (including SAP type).

Parameters
PIDthe target output PID
frame_ifcethe associated frame interface object
destructthe destructor to be called upon packet release
Returns
new packet
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_filter_pck_get_frame_interface()

GF_FilterFrameInterface* gf_filter_pck_get_frame_interface ( GF_FilterPacket *  pck)

Gets a frame interface associated with a packet if any.

Consumers will typically first check if the packet has associated data using gf_filter_pck_get_data.

Parameters
pckthe target packet
Returns
the associated frame interface object if any, or NULL otherwise
+ Here is the caller graph for this function:

◆ gf_filter_pck_is_blocking_ref()

Bool gf_filter_pck_is_blocking_ref ( GF_FilterPacket *  pck)

Checks if the packet is a blocking reference, i.e. a parent filter in the chain is waiting for its destruction to emit a new packet. This is typically used by sink filters to decide if they can hold references to input packets without blocking the chain.

Parameters
pckthe target packet
Returns
GF_TRUE if the packet is blocking or is a reference to a blocking packet, GF_FALSE otherwise
+ Here is the caller graph for this function: