libgpac
Documentation of the core library of GPAC
Loading...
Searching...
No Matches
dmx_gsf.c File Reference
#include <gpac/filters.h>
#include <gpac/constants.h>
#include <gpac/bitstream.h>
#include <gpac/network.h>
#include <gpac/internal/media_dev.h>
#include <gpac/crypt.h>

Data Structures

struct  GSF_PacketFragment
 
struct  GSF_Packet
 
struct  GSF_Stream
 
struct  GSF_DemuxCtx
 

Macros

#define OFFS(_n)   #_n, offsetof(GSF_DemuxCtx, _n)
 

Enumerations

enum  GSF_PacketType {
  GFS_PCKTYPE_HDR =0 , GFS_PCKTYPE_PID_CONFIG , GFS_PCKTYPE_PID_INFO_UPDATE , GFS_PCKTYPE_PID_REMOVE ,
  GFS_PCKTYPE_PID_EOS , GFS_PCKTYPE_PCK , GFS_PCKTYPE_UNDEF1 , GFS_PCKTYPE_UNDEF2 ,
  GFS_PCKTYPE_UNDEF3 , GFS_PCKTYPE_UNDEF4 , GFS_PCKTYPE_UNDEF5 , GFS_PCKTYPE_UNDEF6 ,
  GFS_PCKTYPE_UNDEF7 , GFS_PCKTYPE_UNDEF8 , GFS_PCKTYPE_UNDEF9 , GFS_PCKTYPE_UNDEF10
}
 

Functions

static void gsfdmx_stream_del (GSF_DemuxCtx *ctx, GSF_Stream *gst, Bool is_flush)
 
GF_Err gsfdmx_configure_pid (GF_Filter *filter, GF_FilterPid *pid, Bool is_remove)
 
static Bool gsfdmx_process_event (GF_Filter *filter, const GF_FilterEvent *evt)
 
static void gsfdmx_decrypt (GSF_DemuxCtx *ctx, char *data, u32 size)
 
static GFINLINE u32 gsfdmx_read_vlen (GF_BitStream *bs)
 
static GF_Err gsfdmx_read_prop (GF_BitStream *bs, GF_PropertyValue *p)
 
static GSF_Streamgsfdmx_get_stream (GF_Filter *filter, GSF_DemuxCtx *ctx, u32 idx, u32 pkt_type)
 
static GF_Err gsfdmx_parse_pid_info (GF_Filter *filter, GSF_DemuxCtx *ctx, GSF_Stream *gst, GSF_Packet *pck, Bool is_info_update)
 
static GF_Err gsfdmx_tune (GF_Filter *filter, GSF_DemuxCtx *ctx, char *pck_data, u32 pck_size, Bool is_crypted)
 
static GFINLINE void gsfdmx_pck_reset (GSF_Packet *pck)
 
static GFINLINE GSF_Packetgsfdmx_get_packet (GSF_DemuxCtx *ctx, GSF_Stream *gst, Bool pck_frag, s32 frame_sn, u8 pkt_type, u32 frame_size)
 
static void gsfdmx_packet_append_frag (GSF_Packet *pck, u32 size, u32 offset)
 
GF_Err gsfdmx_read_data_pck (GSF_DemuxCtx *ctx, GSF_Stream *gst, GSF_Packet *gpck, u32 pck_len, Bool full_pck, GF_BitStream *bs)
 
static const char * gsfdmx_pck_name (u32 pck_type)
 
static GF_Err gsfdmx_process_packets (GF_Filter *filter, GSF_DemuxCtx *ctx, GSF_Stream *gst)
 
static GF_Err gsfdmx_demux (GF_Filter *filter, GSF_DemuxCtx *ctx, char *data, u32 data_size)
 
GF_Err gsfdmx_process (GF_Filter *filter)
 
static const char * gsfdmx_probe_data (const u8 *data, u32 data_size, GF_FilterProbeScore *score)
 
static void gsfdmx_not_enough_bytes (void *par)
 
static GF_Err gsfdmx_initialize (GF_Filter *filter)
 
static void gsfdmx_finalize (GF_Filter *filter)
 
const GF_FilterRegister * gsfdmx_register (GF_FilterSession *session)
 

Variables

static const GF_FilterCapability GSFDemuxCaps []
 
static const GF_FilterArgs GSFDemuxArgs []
 
GF_FilterRegister GSFDemuxRegister
 

Data Structure Documentation

◆ GSF_PacketFragment

struct GSF_PacketFragment
Data Fields
u32 offset
u32 size

◆ GSF_Packet

struct GSF_Packet
Data Fields
GF_FilterPacket * pck
u8 * output
u32 full_block_size
u32 nb_bytes
u32 recv_bytes
Bool corrupted
u16 frame_sn
u8 pck_type
u8 crypted
u32 nb_frags
u32 nb_alloc_frags
u32 nb_recv_frags
Bool complete
GSF_PacketFragment * frags

◆ GSF_Stream

struct GSF_Stream
Data Fields
GF_FilterPid * opid
GF_List * packets
u32 idx
u16 nb_pck
u8 config_version
u16 last_frame_sn

◆ GSF_DemuxCtx

struct GSF_DemuxCtx
Data Fields
const char * magic
GF_PropData key
u32 pad
u32 mq
GF_FilterPid * ipid
GF_List * streams
bin128 crypt_IV
GF_Crypt * crypt
u16 crypt_blocks
u16 skip_blocks
u32 nb_playing
Double start_range
Bool is_file
u64 file_pos
u64 file_size
GF_Fraction64 duration
Bool initial_play_done
GF_BitStream * bs_r
GF_BitStream * bs_pck
GSF_Stream * signal_st
char * buffer
u32 alloc_size
u32 buf_size
u32 missing_bytes
Bool tuned
Bool tune_error
Bool use_seq_num
Bool wait_for_play
GF_List * pck_res
Bool buffer_too_small
Bool corrupted
Bool file_pids
Bool stop_pending

Macro Definition Documentation

◆ OFFS

#define OFFS (   _n)    #_n, offsetof(GSF_DemuxCtx, _n)

Enumeration Type Documentation

◆ GSF_PacketType

Enumerator
GFS_PCKTYPE_HDR 
GFS_PCKTYPE_PID_CONFIG 
GFS_PCKTYPE_PID_INFO_UPDATE 
GFS_PCKTYPE_PID_REMOVE 
GFS_PCKTYPE_PID_EOS 
GFS_PCKTYPE_PCK 
GFS_PCKTYPE_UNDEF1 
GFS_PCKTYPE_UNDEF2 
GFS_PCKTYPE_UNDEF3 
GFS_PCKTYPE_UNDEF4 
GFS_PCKTYPE_UNDEF5 
GFS_PCKTYPE_UNDEF6 
GFS_PCKTYPE_UNDEF7 
GFS_PCKTYPE_UNDEF8 
GFS_PCKTYPE_UNDEF9 
GFS_PCKTYPE_UNDEF10 

Function Documentation

◆ gsfdmx_stream_del()

static void gsfdmx_stream_del ( GSF_DemuxCtx ctx,
GSF_Stream gst,
Bool  is_flush 
)
static

◆ gsfdmx_configure_pid()

GF_Err gsfdmx_configure_pid ( GF_Filter *  filter,
GF_FilterPid *  pid,
Bool  is_remove 
)

◆ gsfdmx_process_event()

static Bool gsfdmx_process_event ( GF_Filter *  filter,
const GF_FilterEvent *  evt 
)
static

◆ gsfdmx_decrypt()

static void gsfdmx_decrypt ( GSF_DemuxCtx ctx,
char *  data,
u32  size 
)
static

◆ gsfdmx_read_vlen()

static GFINLINE u32 gsfdmx_read_vlen ( GF_BitStream *  bs)
static

◆ gsfdmx_read_prop()

static GF_Err gsfdmx_read_prop ( GF_BitStream *  bs,
GF_PropertyValue *  p 
)
static

◆ gsfdmx_get_stream()

static GSF_Stream * gsfdmx_get_stream ( GF_Filter *  filter,
GSF_DemuxCtx ctx,
u32  idx,
u32  pkt_type 
)
static

◆ gsfdmx_parse_pid_info()

static GF_Err gsfdmx_parse_pid_info ( GF_Filter *  filter,
GSF_DemuxCtx ctx,
GSF_Stream gst,
GSF_Packet pck,
Bool  is_info_update 
)
static

◆ gsfdmx_tune()

static GF_Err gsfdmx_tune ( GF_Filter *  filter,
GSF_DemuxCtx ctx,
char *  pck_data,
u32  pck_size,
Bool  is_crypted 
)
static

◆ gsfdmx_pck_reset()

static GFINLINE void gsfdmx_pck_reset ( GSF_Packet pck)
static

◆ gsfdmx_get_packet()

static GFINLINE GSF_Packet * gsfdmx_get_packet ( GSF_DemuxCtx ctx,
GSF_Stream gst,
Bool  pck_frag,
s32  frame_sn,
u8  pkt_type,
u32  frame_size 
)
static

◆ gsfdmx_packet_append_frag()

static void gsfdmx_packet_append_frag ( GSF_Packet pck,
u32  size,
u32  offset 
)
static

◆ gsfdmx_read_data_pck()

GF_Err gsfdmx_read_data_pck ( GSF_DemuxCtx ctx,
GSF_Stream gst,
GSF_Packet gpck,
u32  pck_len,
Bool  full_pck,
GF_BitStream *  bs 
)

◆ gsfdmx_pck_name()

static const char * gsfdmx_pck_name ( u32  pck_type)
static

◆ gsfdmx_process_packets()

static GF_Err gsfdmx_process_packets ( GF_Filter *  filter,
GSF_DemuxCtx ctx,
GSF_Stream gst 
)
static

◆ gsfdmx_demux()

static GF_Err gsfdmx_demux ( GF_Filter *  filter,
GSF_DemuxCtx ctx,
char *  data,
u32  data_size 
)
static

◆ gsfdmx_process()

GF_Err gsfdmx_process ( GF_Filter *  filter)

◆ gsfdmx_probe_data()

static const char * gsfdmx_probe_data ( const u8 data,
u32  data_size,
GF_FilterProbeScore score 
)
static

◆ gsfdmx_not_enough_bytes()

static void gsfdmx_not_enough_bytes ( void *  par)
static

◆ gsfdmx_initialize()

static GF_Err gsfdmx_initialize ( GF_Filter *  filter)
static

◆ gsfdmx_finalize()

static void gsfdmx_finalize ( GF_Filter *  filter)
static

◆ gsfdmx_register()

const GF_FilterRegister * gsfdmx_register ( GF_FilterSession *  session)

Variable Documentation

◆ GSFDemuxCaps

const GF_FilterCapability GSFDemuxCaps[]
static
Initial value:
=
{
CAP_STRING(GF_CAPS_INPUT, GF_PROP_PID_MIME, "application/x-gpac-sf"),
}
@ GF_CODECID_NONE
Definition constants.h:367
@ GF_STREAM_TEXT
Definition constants.h:82
@ GF_STREAM_AUDIO
Definition constants.h:66
@ GF_STREAM_FILE
Definition constants.h:104
@ GF_STREAM_VISUAL
Definition constants.h:64
#define GF_CAPS_OUTPUT
Definition filters.h:2013
#define CAP_UINT(_f, _a, _b)
Definition filters.h:1955
#define CAP_STRING(_f, _a, _b)
Definition filters.h:1977
#define GF_CAPS_OUTPUT_EXCLUDED
Definition filters.h:2017
#define GF_CAPS_INPUT
Definition filters.h:2001
@ GF_PROP_PID_CODECID
Definition filters.h:1020
@ GF_PROP_PID_STREAM_TYPE
Definition filters.h:1016
@ GF_PROP_PID_FILE_EXT
Definition filters.h:1092
@ GF_PROP_PID_MIME
Definition filters.h:1091

◆ GSFDemuxArgs

const GF_FilterArgs GSFDemuxArgs[]
static
Initial value:
=
{
{ OFFS(key), "key for decrypting packets", GF_PROP_DATA, NULL, NULL, GF_FS_ARG_HINT_ADVANCED},
{ OFFS(magic), "magic string to check in setup packet", GF_PROP_STRING, NULL, NULL, GF_FS_ARG_HINT_ADVANCED},
{ OFFS(mq), "set max packet queue length for loss detection. 0 will flush incomplete packet when a new one starts", GF_PROP_UINT, "4", NULL, GF_FS_ARG_HINT_ADVANCED},
{ OFFS(pad), "byte value used to pad lost packets", GF_PROP_UINT, "0", "0-255", GF_FS_ARG_HINT_ADVANCED},
{0}
}
#define OFFS(_n)
Definition dmx_gsf.c:1349
@ GF_FS_ARG_HINT_ADVANCED
Definition filters.h:1887
@ GF_PROP_STRING
Definition filters.h:785
@ GF_PROP_DATA
Definition filters.h:791
@ GF_PROP_UINT
Definition filters.h:761

◆ GSFDemuxRegister

GF_FilterRegister GSFDemuxRegister
Initial value:
= {
.name = "gsfdmx",
.help = "This filter provides GSF (__GPAC Serialized Format__) demultiplexing.\n"
"It de-serializes the stream states (config/reconfig/info update/remove/eos) and packets in the GSF bytestream.\n"
"This allows either reading a session saved to file, or receiving the state/data of streams from another instance of GPAC using either pipes or sockets\n"
"\n"
"The stream format can be encrypted in AES 128 CBC mode, in which case the demultiplexing filter must be given a 128 bit key."
,
.private_size = sizeof(GSF_DemuxCtx),
.max_extra_pids = (u32) -1,
.args = GSFDemuxArgs,
.initialize = gsfdmx_initialize,
.finalize = gsfdmx_finalize,
.configure_pid = gsfdmx_configure_pid,
.process = gsfdmx_process,
.process_event = gsfdmx_process_event,
.probe_data = gsfdmx_probe_data,
}
static const GF_FilterCapability GSFDemuxCaps[]
Definition dmx_gsf.c:1334
static const char * gsfdmx_probe_data(const u8 *data, u32 data_size, GF_FilterProbeScore *score)
Definition dmx_gsf.c:1266
GF_Err gsfdmx_process(GF_Filter *filter)
Definition dmx_gsf.c:1206
static Bool gsfdmx_process_event(GF_Filter *filter, const GF_FilterEvent *evt)
Definition dmx_gsf.c:167
GF_Err gsfdmx_configure_pid(GF_Filter *filter, GF_FilterPid *pid, Bool is_remove)
Definition dmx_gsf.c:145
static GF_Err gsfdmx_initialize(GF_Filter *filter)
Definition dmx_gsf.c:1292
static void gsfdmx_finalize(GF_Filter *filter)
Definition dmx_gsf.c:1310
static const GF_FilterArgs GSFDemuxArgs[]
Definition dmx_gsf.c:1350
Definition dmx_gsf.c:70
GF_FSArgumentFlags flags
Definition filters.h:1949
#define SETCAPS(__struct)
Definition filters.h:2144
@ GF_FS_REG_DYNAMIC_PIDS
Definition filters.h:2183
uint32_t u32
Definition setup.h:323