GF_Err vvcc_box_dump(GF_Box *a, FILE * trace)
{
	u32 i, count;
	char boxname[256];
	GF_VVCConfigurationBox *p = (GF_VVCConfigurationBox *) a;

	sprintf(boxname, "VVCConfigurationBox");
	gf_isom_box_dump_start(a, boxname, trace);
	gf_fprintf(trace, ">\n");

	if (! p->config) {
		if (p->size) {
			gf_fprintf(trace, "<!-- INVALID VVC ENTRY: no VVC config record -->\n");
		} else {
			gf_fprintf(trace, "<VVCDecoderConfigurationRecord nal_unit_size=\"\" configurationVersion=\"\" ");
			gf_fprintf(trace, "general_profile_idc=\"\" general_tier_flag=\"\" general_sub_profile_idc=\"\" general_constraint_info=\"\" general_level_idc=\"\" ");
			gf_fprintf(trace, "chroma_format=\"\" luma_bit_depth=\"\" chroma_bit_depth=\"\" avgFrameRate=\"\" constantFrameRate=\"\" numTemporalLayers=\"\" maxWidth=\"\" maxHeight=\"\"");

			gf_fprintf(trace, ">\n");
			gf_fprintf(trace, "<ParameterSetArray nalu_type=\"\" complete_set=\"\">\n");
			gf_fprintf(trace, "<ParameterSet size=\"\" content=\"\"/>\n");
			gf_fprintf(trace, "</ParameterSetArray>\n");
			gf_fprintf(trace, "</VVCDecoderConfigurationRecord>\n");
		}
		gf_fprintf(trace, "</VVCConfigurationBox>\n");
		return GF_OK;
	}

	gf_fprintf(trace, "<VVCDecoderConfigurationRecord nal_unit_size=\"%d\" ", p->config->nal_unit_size);
	if (p->config->ptl_present) {

		gf_fprintf(trace, "chroma_format=\"%s\" chroma_bit_depth=\"%u\" avgFrameRate=\"%u\" constantFrameRate=\"%u\" numTemporalLayers=\"%u\" maxWidth=\"%u\" maxHeight=\"%u\" ",
			gf_avc_hevc_get_chroma_format_name(p->config->chroma_format),
			p->config->bit_depth, p->config->avgFrameRate, p->config->constantFrameRate, p->config->numTemporalLayers, p->config->maxPictureWidth, p->config->maxPictureHeight);

		gf_fprintf(trace, "general_profile_idc=\"%u\" ", p->config->general_profile_idc);
		gf_fprintf(trace, "general_tier_flag=\"%u\" ", p->config->general_tier_flag);
		gf_fprintf(trace, "general_sub_profile_idc=\"%u\" ", p->config->general_sub_profile_idc);
		if (p->config->general_constraint_info) {
			gf_fprintf(trace, "general_constraint_info=\"");
			dump_data_hex(trace, p->config->general_constraint_info, p->config->num_constraint_info);
			gf_fprintf(trace, "\" ");
		}
		gf_fprintf(trace, "general_level_idc=\"%u\" ", p->config->general_level_idc);
	}
	gf_fprintf(trace, ">\n");

	count = gf_list_count(p->config->param_array);
	for (i=0; i<count; i++) {
		u32 nalucount, j;
		GF_NALUFFParamArray *ar = (GF_NALUFFParamArray*)gf_list_get(p->config->param_array, i);
		gf_fprintf(trace, "<ParameterSetArray nalu_type=\"%d\" complete_set=\"%d\">\n", ar->type, ar->array_completeness);
		nalucount = gf_list_count(ar->nalus);
		for (j=0; j<nalucount; j++) {
			GF_NALUFFParam *c = (GF_NALUFFParam *)gf_list_get(ar->nalus, j);
			gf_fprintf(trace, "<ParameterSet size=\"%d\" content=\"", c->size);
			dump_data(trace, c->data, c->size);
			gf_fprintf(trace, "\"/>\n");
		}
		gf_fprintf(trace, "</ParameterSetArray>\n");
	}

	gf_fprintf(trace, "</VVCDecoderConfigurationRecord>\n");

	gf_isom_box_dump_done(boxname, a, trace);
	return GF_OK;
}
GF_Err vvcc_box_dump(GF_Box *a, FILE * trace)
{
	u32 i, count;
	char boxname[256];
	GF_VVCConfigurationBox *p = (GF_VVCConfigurationBox *) a;

	sprintf(boxname, "VVCConfigurationBox");
	gf_isom_box_dump_start(a, boxname, trace);
	gf_fprintf(trace, ">\n");

	if (! p->config) {
		if (p->size) {
			gf_fprintf(trace, "<!-- INVALID VVC ENTRY: no VVC config record -->\n");
		} else {
			gf_fprintf(trace, "<VVCDecoderConfigurationRecord nal_unit_size=\"\" configurationVersion=\"\" ");
			gf_fprintf(trace, "general_profile_idc=\"\" general_tier_flag=\"\" general_sub_profile_idc=\"\" general_constraint_info=\"\" general_level_idc=\"\" ");
			gf_fprintf(trace, "chroma_format=\"\" luma_bit_depth=\"\" chroma_bit_depth=\"\" avgFrameRate=\"\" constantFrameRate=\"\" numTemporalLayers=\"\" maxWidth=\"\" maxHeight=\"\"");

			gf_fprintf(trace, ">\n");
			gf_fprintf(trace, "<ParameterSetArray nalu_type=\"\" complete_set=\"\">\n");
			gf_fprintf(trace, "<ParameterSet size=\"\" content=\"\"/>\n");
			gf_fprintf(trace, "</ParameterSetArray>\n");
			gf_fprintf(trace, "</VVCDecoderConfigurationRecord>\n");
		}
		gf_fprintf(trace, "</VVCConfigurationBox>\n");
		return GF_OK;
	}

	gf_fprintf(trace, "<VVCDecoderConfigurationRecord nal_unit_size=\"%d\" ", p->config->nal_unit_size);
	if (p->config->ptl_present) {

		gf_fprintf(trace, "chroma_format=\"%s\" chroma_bit_depth=\"%u\" avgFrameRate=\"%u\" constantFrameRate=\"%u\" numTemporalLayers=\"%u\" maxWidth=\"%u\" maxHeight=\"%u\" ",
			gf_avc_hevc_get_chroma_format_name(p->config->chroma_format),
			p->config->bit_depth, p->config->avgFrameRate, p->config->constantFrameRate, p->config->numTemporalLayers, p->config->maxPictureWidth, p->config->maxPictureHeight);

		gf_fprintf(trace, "general_profile_idc=\"%u\" ", p->config->general_profile_idc);
		gf_fprintf(trace, "general_tier_flag=\"%u\" ", p->config->general_tier_flag);
		gf_fprintf(trace, "general_sub_profile_idc=\"%u\" ", p->config->general_sub_profile_idc);
		if (p->config->general_constraint_info) {
			gf_fprintf(trace, "general_constraint_info=\"");
			dump_data_hex(trace, p->config->general_constraint_info, p->config->num_constraint_info);
			gf_fprintf(trace, "\" ");
		}
		gf_fprintf(trace, "general_level_idc=\"%u\" ", p->config->general_level_idc);
	}
	gf_fprintf(trace, ">\n");

	count = gf_list_count(p->config->param_array);
	for (i=0; i<count; i++) {
		u32 nalucount, j;
		GF_NALUFFParamArray *ar = (GF_NALUFFParamArray*)gf_list_get(p->config->param_array, i);
		gf_fprintf(trace, "<ParameterSetArray nalu_type=\"%d\" complete_set=\"%d\">\n", ar->type, ar->array_completeness);
		nalucount = gf_list_count(ar->nalus);
		for (j=0; j<nalucount; j++) {
			GF_NALUFFParam *c = (GF_NALUFFParam *)gf_list_get(ar->nalus, j);
			gf_fprintf(trace, "<ParameterSet size=\"%d\" content=\"", c->size);
			dump_data(trace, c->data, c->size);
			gf_fprintf(trace, "\"/>\n");
		}
		gf_fprintf(trace, "</ParameterSetArray>\n");
	}

	gf_fprintf(trace, "</VVCDecoderConfigurationRecord>\n");

	gf_isom_box_dump_done(boxname, a, trace);
	return GF_OK;
}