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

Data Structures

struct  GF_NHMLDumpCtx
 

Macros

#define NHML_PRINT_4CC(_code, _pname, _name)
 
#define NHML_PRINT_UINT(_code, _pname, _name)
 
#define NHML_PRINT_STRING(_code, _pname, _name)
 
#define OFFS(_n)   #_n, offsetof(GF_NHMLDumpCtx, _n)
 

Enumerations

enum  GF_NHMLChksum { NO_CHKSUM , CRC32_CHKSUM , SHA1_CHKSUM }
 

Functions

static const char * nhmldump_get_resolved_basename (GF_FilterPid *ipid, const char *fileName, char szFinalName[GF_MAX_PATH])
 
GF_Err nhmldump_config_side_stream (GF_Filter *filter, GF_NHMLDumpCtx *ctx)
 
GF_Err nhmldump_configure_pid (GF_Filter *filter, GF_FilterPid *pid, Bool is_remove)
 
static GF_Err nhmldump_send_header (GF_NHMLDumpCtx *ctx)
 
static GF_Err nhmldump_send_dims (GF_NHMLDumpCtx *ctx, char *data, u32 data_size, GF_FilterPacket *pck)
 
static void nhmldump_pck_property (GF_NHMLDumpCtx *ctx, u32 p4cc, const char *pname, const GF_PropertyValue *att)
 
static GF_Err nhmldump_send_frame (GF_NHMLDumpCtx *ctx, char *data, u32 data_size, GF_FilterPacket *pck)
 
GF_Err nhmldump_process (GF_Filter *filter)
 
static GF_Err nhmldump_initialize (GF_Filter *filter)
 
static void nhmldump_finalize (GF_Filter *filter)
 
const GF_FilterRegister * nhmlw_register (GF_FilterSession *session)
 

Variables

static const GF_FilterCapability NHMLDumpCaps []
 
static const GF_FilterArgs NHMLDumpArgs []
 
GF_FilterRegister NHMLDumpRegister
 

Data Structure Documentation

◆ GF_NHMLDumpCtx

struct GF_NHMLDumpCtx
+ Collaboration diagram for GF_NHMLDumpCtx:
Data Fields
const char * name
Bool exporter
Bool dims
Bool pckp
Bool nhmlonly
Bool payload
u32 chksum
FILE * filep
GF_FilterPid * ipid
GF_FilterPid * opid_nhml
GF_FilterPid * opid_mdia
GF_FilterPid * opid_info
u32 codecid
u32 streamtype
u32 oti
u32 chan
u32 sr
u32 bps
u32 w
u32 h
const char * dcfg
u32 dcfg_size
char * media_file
char * info_file
const char * szRootName
GF_Fraction64 duration
Bool first
s64 delay
Bool uncompress
Bool is_dims
Bool is_stpp
Bool is_scte35
GF_BitStream * bs_w
GF_BitStream * bs_r
u8 * nhml_buffer
u32 nhml_buffer_size
char * b64_buffer
u32 b64_buffer_size
u64 mdia_pos
u32 pck_num
Bool side_streams_config

Macro Definition Documentation

◆ NHML_PRINT_4CC

#define NHML_PRINT_4CC (   _code,
  _pname,
  _name 
)
Value:
if (_code) p = gf_filter_pid_get_property(ctx->ipid, _code); \
else p = gf_filter_pid_get_property_str(ctx->ipid, _pname); \
if (p) { \
sprintf(nhml, "%s=\"%s\" ", _name, gf_4cc_to_str(p->value.uint)); \
gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); \
}
const GF_PropertyValue * gf_filter_pid_get_property(GF_FilterPid *PID, u32 prop_4cc)
Definition: filter_pid.c:6188
const GF_PropertyValue * gf_filter_pid_get_property_str(GF_FilterPid *PID, const char *prop_name)
Definition: filter_pid.c:6213
const char * gf_4cc_to_str(u32 type)
Definition: error.c:80
uint32_t u32
Definition: setup.h:326

◆ NHML_PRINT_UINT

#define NHML_PRINT_UINT (   _code,
  _pname,
  _name 
)
Value:
if (_code) p = gf_filter_pid_get_property(ctx->ipid, _code); \
else p = gf_filter_pid_get_property_str(ctx->ipid, _pname); \
if (p) { \
sprintf(nhml, "%s=\"%d\" ", _name, p->value.uint); \
gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); \
}

◆ NHML_PRINT_STRING

#define NHML_PRINT_STRING (   _code,
  _pname,
  _name 
)
Value:
if (_code) p = gf_filter_pid_get_property(ctx->ipid, _code); \
else p = gf_filter_pid_get_property_str(ctx->ipid, _pname); \
if (p) { \
sprintf(nhml, "%s=\"%s\" ", _name, p->value.string); \
gf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml)); \
}

◆ OFFS

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

Enumeration Type Documentation

◆ GF_NHMLChksum

Enumerator
NO_CHKSUM 
CRC32_CHKSUM 
SHA1_CHKSUM 

Function Documentation

◆ nhmldump_get_resolved_basename()

static const char* nhmldump_get_resolved_basename ( GF_FilterPid *  ipid,
const char *  fileName,
char  szFinalName[GF_MAX_PATH] 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nhmldump_config_side_stream()

GF_Err nhmldump_config_side_stream ( GF_Filter *  filter,
GF_NHMLDumpCtx ctx 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nhmldump_configure_pid()

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

◆ nhmldump_send_header()

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

◆ nhmldump_send_dims()

static GF_Err nhmldump_send_dims ( GF_NHMLDumpCtx ctx,
char *  data,
u32  data_size,
GF_FilterPacket *  pck 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nhmldump_pck_property()

static void nhmldump_pck_property ( GF_NHMLDumpCtx ctx,
u32  p4cc,
const char *  pname,
const GF_PropertyValue *  att 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nhmldump_send_frame()

static GF_Err nhmldump_send_frame ( GF_NHMLDumpCtx ctx,
char *  data,
u32  data_size,
GF_FilterPacket *  pck 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nhmldump_process()

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

◆ nhmldump_initialize()

static GF_Err nhmldump_initialize ( GF_Filter *  filter)
static

◆ nhmldump_finalize()

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

◆ nhmlw_register()

const GF_FilterRegister* nhmlw_register ( GF_FilterSession *  session)

Variable Documentation

◆ NHMLDumpCaps

const GF_FilterCapability NHMLDumpCaps[]
static
Initial value:
=
{
CAP_STRING(GF_CAPS_OUTPUT, GF_PROP_PID_MIME, "application/x-nhml|application/dims"),
}
@ GF_CODECID_NONE
Definition: constants.h:383
@ GF_STREAM_FILE
Definition: constants.h:104
#define GF_CAPS_OUTPUT
Definition: filters.h:2232
#define CAP_UINT(_f, _a, _b)
Definition: filters.h:2172
#define CAP_STRING(_f, _a, _b)
Definition: filters.h:2194
#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_PROP_PID_FILE_EXT
Definition: filters.h:1190
@ GF_PROP_PID_MIME
Definition: filters.h:1189
@ GF_TRUE
Definition: setup.h:474

◆ NHMLDumpArgs

const GF_FilterArgs NHMLDumpArgs[]
static
Initial value:
=
{
{ OFFS(exporter), "compatibility with old exporter, displays export results", GF_PROP_BOOL, "false", NULL, GF_FS_ARG_HINT_ADVANCED},
{ OFFS(dims), "use DIMS mode", GF_PROP_BOOL, "false", NULL, GF_FS_ARG_HINT_ADVANCED},
{ OFFS(name), "set output name of media and info files produced", GF_PROP_STRING, NULL, NULL, 0},
{ OFFS(nhmlonly), "only dump NHML info, not media", GF_PROP_BOOL, "false", NULL, GF_FS_ARG_HINT_ADVANCED},
{ OFFS(pckp), "full NHML dump", GF_PROP_BOOL, "false", NULL, GF_FS_ARG_HINT_ADVANCED},
{ OFFS(payload), "dump payload (scte35 only at the moment), should be combined with ǹhmlonly`", GF_PROP_BOOL, "false", NULL, GF_FS_ARG_HINT_ADVANCED},
{ OFFS(chksum), "insert frame checksum\n"
"- none: no checksum\n"
"- crc: CRC32 checksum\n"
"- sha1: SHA1 checksum"
"", GF_PROP_UINT, "none", "none|crc|sha1", GF_FS_ARG_HINT_ADVANCED},
{ OFFS(filep), "dump directly to the given FILE pointer (used by MP4Box)", GF_PROP_POINTER, NULL, NULL, GF_FS_ARG_HINT_HIDE},
{0}
}
@ GF_FS_ARG_HINT_HIDE
Definition: filters.h:2106
@ GF_FS_ARG_HINT_ADVANCED
Definition: filters.h:2102
@ GF_PROP_BOOL
Definition: filters.h:858
@ GF_PROP_STRING
Definition: filters.h:876
@ GF_PROP_POINTER
Definition: filters.h:892
@ GF_PROP_UINT
Definition: filters.h:852
#define OFFS(_n)
Definition: write_nhml.c:1067

◆ NHMLDumpRegister

GF_FilterRegister NHMLDumpRegister
Initial value:
= {
.name = "nhmlw",
GF_FS_SET_HELP("This filter converts a single stream to an NHML output file.\n"
"NHML documentation is available at https://wiki.gpac.io/xmlformats/NHML-Format\n")
.private_size = sizeof(GF_NHMLDumpCtx),
.initialize = nhmldump_initialize,
.finalize = nhmldump_finalize,
.configure_pid = nhmldump_configure_pid,
.process = nhmldump_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_CLASS_TOOL
Definition: filters.h:2455
attribute Array args
Definition: jsf.idl:24
static const GF_FilterArgs NHMLDumpArgs[]
Definition: write_nhml.c:1068
GF_Err nhmldump_process(GF_Filter *filter)
Definition: write_nhml.c:958
GF_Err nhmldump_configure_pid(GF_Filter *filter, GF_FilterPid *pid, Bool is_remove)
Definition: write_nhml.c:210
static const GF_FilterCapability NHMLDumpCaps[]
Definition: write_nhml.c:1057
static GF_Err nhmldump_initialize(GF_Filter *filter)
Definition: write_nhml.c:1041
static void nhmldump_finalize(GF_Filter *filter)
Definition: write_nhml.c:1046
Definition: write_nhml.c:47