Esempio n. 1
0
/*special authoring functions*/
GF_EXPORT
GF_BIFSConfig *gf_odf_get_bifs_config(GF_DefaultDescriptor *dsi, u8 oti)
{
	Bool hasSize, cmd_stream;
	GF_BitStream *bs;
	GF_BIFSConfig *cfg;

	if (oti>=GPAC_OTI_SCENE_BIFS_EXTENDED) return NULL;

	if (!dsi || !dsi->data || !dsi->dataLength ) {
		/* Hack for T-DMB non compliant streams (OnTimeTek ?) */
		cfg = (GF_BIFSConfig *) gf_odf_desc_new(GF_ODF_BIFS_CFG_TAG);	
		cfg->pixelMetrics = 1;
		cfg->version = 1;
		return cfg;
	}
	bs = gf_bs_new(dsi->data, dsi->dataLength, GF_BITSTREAM_READ);
	
	cfg = (GF_BIFSConfig *) gf_odf_desc_new(GF_ODF_BIFS_CFG_TAG);	
	if (oti==2) {
		/*3D Mesh Coding*/
		gf_bs_read_int(bs, 1);
		/*PMF*/
		gf_bs_read_int(bs, 1);
	}
	cfg->nodeIDbits = gf_bs_read_int(bs, 5);
	cfg->routeIDbits = gf_bs_read_int(bs, 5);
	if (oti==2) cfg->protoIDbits = gf_bs_read_int(bs, 5);
	
	cmd_stream = gf_bs_read_int(bs, 1);
	if (!cmd_stream) {
		cfg->elementaryMasks = gf_list_new();
		while (1) {
			GF_ElementaryMask* em = (GF_ElementaryMask* ) gf_odf_New_ElemMask();
			em->node_id = gf_bs_read_int(bs, cfg->nodeIDbits);
			gf_list_add(cfg->elementaryMasks, em);
			/*this assumes only FDP, BDP and IFS2D (no elem mask)*/
			if (gf_bs_read_int(bs, 1) == 0) break;
		}
		gf_bs_align(bs);
		if (gf_bs_get_size(bs) != gf_bs_get_position(bs)) {
			GF_LOG(GF_LOG_WARNING, GF_LOG_CODEC, ("[ODF] Reading bifs config: shift in sizes (not supported)\n"));
		}
	} else {
		cfg->pixelMetrics = gf_bs_read_int(bs, 1);
		hasSize = gf_bs_read_int(bs, 1);
		if (hasSize) {
			cfg->pixelWidth = gf_bs_read_int(bs, 16);
			cfg->pixelHeight = gf_bs_read_int(bs, 16);
		}
		gf_bs_align(bs);
		if (gf_bs_get_size(bs) != gf_bs_get_position(bs))
			GF_LOG(GF_LOG_WARNING, GF_LOG_CODEC, ("[ODF] Reading bifs config: shift in sizes (invalid descriptor)\n"));
	}
	gf_bs_del(bs);
	return cfg;
}
Esempio n. 2
0
//
//		CONSTRUCTORS
//
GF_Descriptor *gf_odf_create_descriptor(u8 tag)
{
	GF_Descriptor *desc;

	switch (tag) {
	case GF_ODF_IOD_TAG:
		return gf_odf_new_iod();
	case GF_ODF_OD_TAG:
		return gf_odf_new_od();
	case GF_ODF_ESD_TAG:
		return gf_odf_new_esd();
	case GF_ODF_DCD_TAG:
		return gf_odf_new_dcd();
	case GF_ODF_SLC_TAG:
		//default : we create it without any predefinition...
		return gf_odf_new_slc(0);
	case GF_ODF_MUXINFO_TAG:
		return gf_odf_new_muxinfo();
	case GF_ODF_BIFS_CFG_TAG:
		return gf_odf_new_bifs_cfg();
	case GF_ODF_UI_CFG_TAG:
		return gf_odf_new_ui_cfg();
	case GF_ODF_TEXT_CFG_TAG:
		return gf_odf_new_text_cfg();
	case GF_ODF_TX3G_TAG:
		return gf_odf_new_tx3g();
	case GF_ODF_ELEM_MASK_TAG:
		return gf_odf_New_ElemMask();
	case GF_ODF_LASER_CFG_TAG:
		return gf_odf_new_laser_cfg();

	case GF_ODF_DSI_TAG:
		desc = gf_odf_new_default();
		if (!desc) return desc;
		desc->tag = GF_ODF_DSI_TAG;
		return desc;

	case GF_ODF_AUX_VIDEO_DATA:
		return gf_odf_new_auxvid();

	case GF_ODF_SEGMENT_TAG:
		return gf_odf_new_segment();
	case GF_ODF_MEDIATIME_TAG:
		return gf_odf_new_mediatime();

	//File Format Specific
	case GF_ODF_ISOM_IOD_TAG:
		return gf_odf_new_isom_iod();
	case GF_ODF_ISOM_OD_TAG:
		return gf_odf_new_isom_od();
	case GF_ODF_ESD_INC_TAG:
		return gf_odf_new_esd_inc();
	case GF_ODF_ESD_REF_TAG:
		return gf_odf_new_esd_ref();
	case GF_ODF_LANG_TAG:
		return gf_odf_new_lang();

#ifndef GPAC_MINIMAL_ODF

	case GF_ODF_CI_TAG:
		return gf_odf_new_ci();
	case GF_ODF_SCI_TAG:
		return gf_odf_new_sup_cid();
	case GF_ODF_IPI_PTR_TAG:
		return gf_odf_new_ipi_ptr();
	//special case for the file format
	case GF_ODF_ISOM_IPI_PTR_TAG:
		desc = gf_odf_new_ipi_ptr();
		if (!desc) return desc;
		desc->tag = GF_ODF_ISOM_IPI_PTR_TAG;
		return desc;

	case GF_ODF_IPMP_PTR_TAG:
		return gf_odf_new_ipmp_ptr();
	case GF_ODF_IPMP_TAG:
		return gf_odf_new_ipmp();
	case GF_ODF_QOS_TAG:
		return gf_odf_new_qos();
	case GF_ODF_REG_TAG:
		return gf_odf_new_reg();
	case GF_ODF_CC_TAG:
		return gf_odf_new_cc();
	case GF_ODF_KW_TAG:
		return gf_odf_new_kw();
	case GF_ODF_RATING_TAG:
		return gf_odf_new_rating();
	case GF_ODF_SHORT_TEXT_TAG:
		return gf_odf_new_short_text();
	case GF_ODF_TEXT_TAG:
		return gf_odf_new_exp_text();
	case GF_ODF_CC_NAME_TAG:
		return gf_odf_new_cc_name();
	case GF_ODF_CC_DATE_TAG:
		return gf_odf_new_cc_date();
	case GF_ODF_OCI_NAME_TAG:
		return gf_odf_new_oci_name();
	case GF_ODF_OCI_DATE_TAG:
		return gf_odf_new_oci_date();
	case GF_ODF_SMPTE_TAG:
		return gf_odf_new_smpte_camera();
	case GF_ODF_EXT_PL_TAG:
		return gf_odf_new_pl_ext();
	case GF_ODF_PL_IDX_TAG:
		return gf_odf_new_pl_idx();

	case GF_ODF_IPMP_TL_TAG:
		return gf_odf_new_ipmp_tool_list();
	case GF_ODF_IPMP_TOOL_TAG:
		return gf_odf_new_ipmp_tool();

	case 0:
	case 0xFF:
		return NULL;
#endif /*GPAC_MINIMAL_ODF*/
	default:
		//ISO Reserved
		if ( (tag >= GF_ODF_ISO_RES_BEGIN_TAG) &&
		        (tag <= GF_ODF_ISO_RES_END_TAG) ) {
			return NULL;
		}
		desc = gf_odf_new_default();
		if (!desc) return desc;
		desc->tag = tag;
		return desc;
	}
}