//use this function to encode a standalone descriptor //the desc will be formatted with tag and size field GF_EXPORT GF_Err gf_odf_desc_write_bs(GF_Descriptor *desc, GF_BitStream *bs) { GF_Err e; if (!desc || !bs) return GF_BAD_PARAM; //then encode our desc... e = gf_odf_write_descriptor(bs, desc); if (e) { gf_bs_del(bs); return e; } return GF_OK; }
GF_Err gf_odf_write_descriptor_list_filter(GF_BitStream *bs, GF_List *descList, u8 only_tag) { GF_Err e; u32 count, i; GF_Descriptor *tmp; if (! descList) return GF_OK; count = gf_list_count(descList); for ( i = 0; i < count; i++ ) { tmp = (GF_Descriptor*)gf_list_get(descList, i); if (tmp && (tmp->tag==only_tag) ) { e = gf_odf_write_descriptor(bs, tmp); if (e) return e; } } return GF_OK; }
GF_Err gf_odf_write_ipmp_update(GF_BitStream *bs, GF_IPMPUpdate *ipmpUp) { GF_Err e; GF_Descriptor *tmp; u32 size, i; if (!ipmpUp) return GF_BAD_PARAM; e = gf_odf_size_ipmp_update(ipmpUp, &size); if (e) return e; e = gf_odf_write_base_descriptor(bs, ipmpUp->tag, size); if (e) return e; i = 0; while ((tmp = (GF_Descriptor *)gf_list_enum(ipmpUp->IPMPDescList, &i))) { e = gf_odf_write_descriptor(bs, tmp); if (e) return e; } //OD commands are aligned gf_bs_align(bs); return GF_OK; }
GF_Err gf_odf_write_od_update(GF_BitStream *bs, GF_ODUpdate *odUp) { GF_Err e; GF_Descriptor *tmp; u32 size, i; if (!odUp) return GF_BAD_PARAM; e = gf_odf_size_od_update(odUp, &size); if (e) return e; gf_odf_write_base_descriptor(bs, odUp->tag, size); if (e) return e; i = 0; while ((tmp = (GF_Descriptor *)gf_list_enum(odUp->objectDescriptors, &i))) { e = gf_odf_write_descriptor(bs, tmp); if (e) return e; } //OD commands are aligned gf_bs_align(bs); return GF_OK; }
GF_Err gf_odf_write_esd_update(GF_BitStream *bs, GF_ESDUpdate *esdUp) { GF_Descriptor *tmp; GF_Err e; u32 size, i; if (!esdUp) return GF_BAD_PARAM; e = gf_odf_size_esd_update(esdUp, &size); if (e) return e; e = gf_odf_write_base_descriptor(bs, esdUp->tag, size); if (e) return e; gf_bs_write_int(bs, esdUp->ODID, 10); i = 0; while ((tmp = (GF_Descriptor *)gf_list_enum(esdUp->ESDescriptors, &i))) { e = gf_odf_write_descriptor(bs, tmp); if (e) return e; } //OD commands are aligned gf_bs_align(bs); return GF_OK; }