libgpac
Documentation of the core library of GPAC
write_generic.c File Reference
#include <gpac/filters.h>
#include <gpac/constants.h>
#include <gpac/bitstream.h>
#include <gpac/xml.h>
#include <gpac/base_coding.h>
#include <gpac/internal/isomedia_dev.h>
#include <gpac/webvtt.h>
+ Include dependency graph for write_generic.c:

Data Structures

struct  GF_GenDumpCtx
 
struct  BITMAPFILEHEADER
 
struct  BITMAPINFOHEADER
 

Macros

#define BI_RGB   0L
 
#define OFFS(_n)   #_n, offsetof(GF_GenDumpCtx, _n)
 

Enumerations

enum  { DECINFO_NO =0 , DECINFO_FIRST , DECINFO_SAP , DECINFO_AUTO }
 
enum  { VTTH_SINGLE =0 , VTTH_SEG , VTTH_ALL }
 

Functions

GF_Err writegen_configure_pid (GF_Filter *filter, GF_FilterPid *pid, Bool is_remove)
 
static GF_FilterPacket * writegen_write_j2k (GF_GenDumpCtx *ctx, char *data, u32 data_size, GF_FilterPacket *in_pck)
 
static GF_FilterPacket * writegen_write_bmp (GF_GenDumpCtx *ctx, char *data, u32 data_size)
 
static void writegen_write_wav_header (GF_GenDumpCtx *ctx)
 
GF_XMLAttributettml_get_attr (GF_XMLNode *node, char *name)
 
static GF_XMLNodettml_locate_div (GF_XMLNode *body, const char *region_name, u32 div_idx)
 
static GF_XMLNodettml_get_head (GF_XMLNode *root)
 
GF_XMLNodettml_get_body (GF_XMLNode *root)
 
static Bool ttml_same_attr (GF_XMLNode *n1, GF_XMLNode *n2)
 
static void ttml_merge_head (GF_XMLNode *node_src, GF_XMLNode *node_dst)
 
static GF_Err ttml_embed_data (GF_XMLNode *node, u8 *aux_data, u32 aux_data_size, u8 *subs_data, u32 subs_data_size)
 
static GF_Err writegen_push_ttml (GF_GenDumpCtx *ctx, char *data, u32 data_size, GF_FilterPacket *in_pck)
 
static GF_Err writegen_flush_ttml (GF_GenDumpCtx *ctx)
 
static GF_Err writegen_flush_ttxt (GF_GenDumpCtx *ctx)
 
static void webvtt_timestamps_dump (GF_BitStream *bs, u64 start_ts, u64 end_ts, u32 timescale, Bool write_srt)
 
GF_Err writegen_process (GF_Filter *filter)
 
static GF_Err writegen_initialize (GF_Filter *filter)
 
void writegen_finalize (GF_Filter *filter)
 
const GF_FilterRegister * writegen_register (GF_FilterSession *session)
 
static GF_Err writeuf_initialize (GF_Filter *filter)
 
const GF_FilterRegister * writeuf_register (GF_FilterSession *session)
 
static GF_Err ttmlmerge_initialize (GF_Filter *filter)
 
const GF_FilterRegister * ttmlmerge_register (GF_FilterSession *session)
 

Variables

static GF_FilterCapability GenDumpCaps []
 
static GF_FilterArgs GenDumpArgs []
 
GF_FilterRegister GenDumpRegister
 
static const GF_FilterCapability FrameDumpCaps []
 
static GF_FilterCapability GenDumpXCaps []
 
const GF_FilterRegister WriteUFRegister
 
static GF_FilterCapability TTMLMergeCaps []
 
const GF_FilterRegister TTMLMergeRegister
 

Data Structure Documentation

◆ GF_GenDumpCtx

struct GF_GenDumpCtx
+ Collaboration diagram for GF_GenDumpCtx:
Data Fields
Bool exporter
Bool frame
Bool split
Bool merge_region
u32 sstart
u32 send
u32 vtth
u32 pfmt
u32 afmt
u32 decinfo
GF_Fraction dur
GF_FilterPid * ipid
GF_FilterPid * opid
u32 codecid
Bool is_mj2k
u32 sample_num
const char * dcfg
u32 dcfg_size
Bool cfg_sent
GF_Fraction64 duration
Bool first
GF_BitStream * bs
u32 target_pfmt
u32 target_afmt
Bool is_bmp
u32 is_y4m
u32 is_wav
u32 w
u32 h
u32 stride
u64 nb_bytes
Bool dash_mode
Bool trunc_audio
Bool webvtt
u64 first_dts_plus_one
Bool ttml_agg
GF_XMLNode * ttml_root
GF_FilterPacket * ttml_dash_pck
Bool dump_srt
Bool need_ttxt_footer
u8 * write_buf
u32 write_alloc
Bool unframe_only
Bool vc1_ilaced
Bool ttml_merger
u64 ttml_first_cts
GF_FilterPacket * ttml_first_pck

◆ BITMAPFILEHEADER

struct BITMAPFILEHEADER
Data Fields
u16 bfType
u32 bfSize
u16 bfReserved1
u16 bfReserved2
u32 bfOffBits

◆ BITMAPINFOHEADER

struct BITMAPINFOHEADER
Data Fields
u32 biSize
s32 biWidth
s32 biHeight
u16 biPlanes
u16 biBitCount
u32 biCompression
u32 biSizeImage
s32 biXPelsPerMeter
s32 biYPelsPerMeter
u32 biClrUsed
u32 biClrImportant

Macro Definition Documentation

◆ BI_RGB

#define BI_RGB   0L

◆ OFFS

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

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DECINFO_NO 
DECINFO_FIRST 
DECINFO_SAP 
DECINFO_AUTO 

◆ anonymous enum

anonymous enum
Enumerator
VTTH_SINGLE 
VTTH_SEG 
VTTH_ALL 

Function Documentation

◆ writegen_configure_pid()

GF_Err writegen_configure_pid ( GF_Filter *  filter,
GF_FilterPid *  pid,
Bool  is_remove 
)
+ Here is the call graph for this function:

◆ writegen_write_j2k()

static GF_FilterPacket* writegen_write_j2k ( GF_GenDumpCtx ctx,
char *  data,
u32  data_size,
GF_FilterPacket *  in_pck 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writegen_write_bmp()

static GF_FilterPacket* writegen_write_bmp ( GF_GenDumpCtx ctx,
char *  data,
u32  data_size 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writegen_write_wav_header()

static void writegen_write_wav_header ( GF_GenDumpCtx ctx)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ttml_get_attr()

GF_XMLAttribute* ttml_get_attr ( GF_XMLNode node,
char *  name 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ttml_locate_div()

static GF_XMLNode* ttml_locate_div ( GF_XMLNode body,
const char *  region_name,
u32  div_idx 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ttml_get_head()

static GF_XMLNode* ttml_get_head ( GF_XMLNode root)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ttml_get_body()

GF_XMLNode* ttml_get_body ( GF_XMLNode root)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ttml_same_attr()

static Bool ttml_same_attr ( GF_XMLNode n1,
GF_XMLNode n2 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ttml_merge_head()

static void ttml_merge_head ( GF_XMLNode node_src,
GF_XMLNode node_dst 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ttml_embed_data()

static GF_Err ttml_embed_data ( GF_XMLNode node,
u8 aux_data,
u32  aux_data_size,
u8 subs_data,
u32  subs_data_size 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writegen_push_ttml()

static GF_Err writegen_push_ttml ( GF_GenDumpCtx ctx,
char *  data,
u32  data_size,
GF_FilterPacket *  in_pck 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writegen_flush_ttml()

static GF_Err writegen_flush_ttml ( GF_GenDumpCtx ctx)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writegen_flush_ttxt()

static GF_Err writegen_flush_ttxt ( GF_GenDumpCtx ctx)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webvtt_timestamps_dump()

static void webvtt_timestamps_dump ( GF_BitStream *  bs,
u64  start_ts,
u64  end_ts,
u32  timescale,
Bool  write_srt 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writegen_process()

GF_Err writegen_process ( GF_Filter *  filter)
+ Here is the call graph for this function:

◆ writegen_initialize()

static GF_Err writegen_initialize ( GF_Filter *  filter)
static
+ Here is the call graph for this function:

◆ writegen_finalize()

void writegen_finalize ( GF_Filter *  filter)
+ Here is the call graph for this function:

◆ writegen_register()

const GF_FilterRegister* writegen_register ( GF_FilterSession *  session)
+ Here is the call graph for this function:

◆ writeuf_initialize()

static GF_Err writeuf_initialize ( GF_Filter *  filter)
static
+ Here is the call graph for this function:

◆ writeuf_register()

const GF_FilterRegister* writeuf_register ( GF_FilterSession *  session)

◆ ttmlmerge_initialize()

static GF_Err ttmlmerge_initialize ( GF_Filter *  filter)
static
+ Here is the call graph for this function:

◆ ttmlmerge_register()

const GF_FilterRegister* ttmlmerge_register ( GF_FilterSession *  session)

Variable Documentation

◆ GenDumpCaps

GF_FilterCapability GenDumpCaps[]
static

◆ GenDumpArgs

GF_FilterArgs GenDumpArgs[]
static
Initial value:
=
{
{ OFFS(exporter), "compatibility with old exporter, displays export results", GF_PROP_BOOL, "false", NULL, GF_FS_ARG_HINT_ADVANCED},
{ OFFS(pfmt), "pixel format for raw extract. If not set, derived from extension", GF_PROP_PIXFMT, "none", NULL, 0},
{ OFFS(afmt), "audio format for raw extract. If not set, derived from extension", GF_PROP_PCMFMT, "none", NULL, 0},
{ OFFS(decinfo), "decoder config insert mode\n"
"- no: never inserted\n"
"- first: inserted on first packet\n"
"- sap: inserted at each SAP\n"
"- auto: selects between no and first based on media type", GF_PROP_UINT, "auto", "no|first|sap|auto", GF_FS_ARG_HINT_ADVANCED},
{ OFFS(split), "force one file per frame", GF_PROP_BOOL, "false", NULL, GF_FS_ARG_HINT_ADVANCED},
{ OFFS(frame), "force single frame dump with no rewrite. In this mode, all codec types are supported", GF_PROP_BOOL, "false", NULL, 0},
{ OFFS(sstart), "start number of frame to forward. If 0, all samples are forwarded", GF_PROP_UINT, "0", NULL, 0},
{ OFFS(send), "end number of frame to forward. If less than start frame, all samples after start are forwarded", GF_PROP_UINT, "0", NULL, 0},
{ OFFS(dur), "duration of media to forward after first sample. If 0, all samples are forwarded", GF_PROP_FRACTION, "0", NULL, 0},
{ OFFS(merge_region), "merge TTML regions with same ID while reassembling TTML doc", GF_PROP_BOOL, "false", NULL, 0},
{ OFFS(vtth), "vtt header injection mode\n"
"- single: inject only at first frame of the stream\n"
"- seg: inject at each non-empty segment\n"
"- all: inject at each segment even empty ones", GF_PROP_UINT, "seg", "single|seg|all", 0},
{0}
}
@ GF_FS_ARG_HINT_ADVANCED
Definition: filters.h:2102
@ GF_PROP_BOOL
Definition: filters.h:858
@ GF_PROP_PIXFMT
Definition: filters.h:916
@ GF_PROP_UINT
Definition: filters.h:852
@ GF_PROP_PCMFMT
Definition: filters.h:918
@ GF_PROP_FRACTION
Definition: filters.h:860
#define OFFS(_n)
Definition: write_generic.c:1970

◆ GenDumpRegister

GF_FilterRegister GenDumpRegister
Initial value:
= {
.name = "writegen",
GF_FS_SET_HELP("Generic single stream to file converter, used when extracting/converting PIDs.\n"
"The writegen filter should usually not be explicitly loaded without a source ID specified, since the filter would likely match any PID connection.")
.private_size = sizeof(GF_GenDumpCtx),
.initialize = writegen_initialize,
.finalize = writegen_finalize,
.configure_pid = writegen_configure_pid,
.process = writegen_process,
.hint_class_type = GF_FS_CLASS_TOOL
}
#define GF_FS_SET_HELP(_help)
Definition: filters.h:2372
#define SETCAPS(__struct)
Definition: filters.h:2364
@ GF_FS_REG_TEMP_INIT
Definition: filters.h:2422
@ GF_FS_CLASS_TOOL
Definition: filters.h:2455
attribute Array args
Definition: jsf.idl:24
void writegen_finalize(GF_Filter *filter)
Definition: write_generic.c:1996
GF_Err writegen_process(GF_Filter *filter)
Definition: write_generic.c:1195
static GF_FilterArgs GenDumpArgs[]
Definition: write_generic.c:1971
GF_Err writegen_configure_pid(GF_Filter *filter, GF_FilterPid *pid, Bool is_remove)
Definition: write_generic.c:107
static GF_FilterCapability GenDumpCaps[]
Definition: write_generic.c:1588
static GF_Err writegen_initialize(GF_Filter *filter)
Definition: write_generic.c:2035
Definition: write_generic.c:52

◆ FrameDumpCaps

const GF_FilterCapability FrameDumpCaps[]
static
Initial value:
=
{
}
@ GF_CODECID_NONE
Definition: constants.h:383
@ GF_STREAM_UNKNOWN
Definition: constants.h:56
@ GF_STREAM_FILE
Definition: constants.h:104
#define CAP_UINT(_f, _a, _b)
Definition: filters.h:2172
#define GF_CAPS_INPUT_EXCLUDED
Definition: filters.h:2228
#define CAP_BOOL(_f, _a, _b)
Definition: filters.h:2180
@ GF_PROP_PID_CODECID
Definition: filters.h:1116
@ GF_PROP_PID_STREAM_TYPE
Definition: filters.h:1112
@ GF_PROP_PID_UNFRAMED
Definition: filters.h:1118
@ GF_TRUE
Definition: setup.h:474

◆ GenDumpXCaps

GF_FilterCapability GenDumpXCaps[]
static
Initial value:
=
{
}
#define GF_CAPS_OUTPUT
Definition: filters.h:2232
#define CAP_STRING(_f, _a, _b)
Definition: filters.h:2194
#define GF_CAPS_INPUT_OUTPUT
Definition: filters.h:2242
@ GF_CAPFLAG_OPTIONAL
Definition: filters.h:2214
@ GF_CAPFLAG_EXCLUDED
Definition: filters.h:2208
@ GF_PROP_PID_FILE_EXT
Definition: filters.h:1190

◆ WriteUFRegister

const GF_FilterRegister WriteUFRegister
Initial value:
= {
.name = "writeuf",
.private_size = sizeof(GF_GenDumpCtx),
.initialize = writeuf_initialize,
.finalize = writegen_finalize,
.configure_pid = writegen_configure_pid,
.process = writegen_process,
.hint_class_type = GF_FS_CLASS_FRAMING
}
@ GF_FS_CLASS_FRAMING
Definition: filters.h:2459
static GF_Err writeuf_initialize(GF_Filter *filter)
Definition: write_generic.c:2060
static GF_FilterCapability GenDumpXCaps[]
Definition: write_generic.c:2068

◆ TTMLMergeCaps

GF_FilterCapability TTMLMergeCaps[]
static

◆ TTMLMergeRegister

const GF_FilterRegister TTMLMergeRegister
Initial value:
= {
.name = "ttmlmerge",
.private_size = sizeof(GF_GenDumpCtx),
.initialize = ttmlmerge_initialize,
.finalize = writegen_finalize,
.configure_pid = writegen_configure_pid,
.process = writegen_process,
.hint_class_type = GF_FS_CLASS_SUBTITLE
}
@ GF_FS_CLASS_SUBTITLE
Definition: filters.h:2451
static GF_FilterCapability TTMLMergeCaps[]
Definition: write_generic.c:2108
static GF_Err ttmlmerge_initialize(GF_Filter *filter)
Definition: write_generic.c:2098