GF_Err tenc_box_dump(GF_Box *a, FILE * trace)
{
	GF_TrackEncryptionBox *ptr = (GF_TrackEncryptionBox*) a;
	if (!a) return GF_BAD_PARAM;

	gf_isom_box_dump_start(a, "TrackEncryptionBox", trace);

	gf_fprintf(trace, "isEncrypted=\"%d\"", ptr->isProtected);

	if (ptr->key_info[3])
		gf_fprintf(trace, " IV_size=\"%d\" KID=\"", ptr->key_info[3]);
	else {
		gf_fprintf(trace, " constant_IV_size=\"%d\" constant_IV=\"", ptr->key_info[20]);
		dump_data_hex(trace, (char *) ptr->key_info+21, ptr->key_info[20]);
		gf_fprintf(trace, "\"  KID=\"");
	}
	dump_data_hex(trace, (char *) ptr->key_info+4, 16);
	if (ptr->version)
		gf_fprintf(trace, "\" crypt_byte_block=\"%d\" skip_byte_block=\"%d", ptr->crypt_byte_block, ptr->skip_byte_block);
	gf_fprintf(trace, "\">\n");

	if (!ptr->size) {
		gf_fprintf(trace, " IV_size=\"\" KID=\"\" constant_IV_size=\"\" constant_IV=\"\" crypt_byte_block=\"\" skip_byte_block=\"\">\n");
		gf_fprintf(trace, "<TENCKey IV_size=\"\" KID=\"\" const_IV_size=\"\" constIV=\"\"/>\n");
	}
	gf_isom_box_dump_done("TrackEncryptionBox", a, trace);
	return GF_OK;
}
GF_Err tenc_box_dump(GF_Box *a, FILE * trace)
{
	GF_TrackEncryptionBox *ptr = (GF_TrackEncryptionBox*) a;
	if (!a) return GF_BAD_PARAM;

	gf_isom_box_dump_start(a, "TrackEncryptionBox", trace);

	gf_fprintf(trace, "isEncrypted=\"%d\"", ptr->isProtected);

	if (ptr->key_info[3])
		gf_fprintf(trace, " IV_size=\"%d\" KID=\"", ptr->key_info[3]);
	else {
		gf_fprintf(trace, " constant_IV_size=\"%d\" constant_IV=\"", ptr->key_info[20]);
		dump_data_hex(trace, (char *) ptr->key_info+21, ptr->key_info[20]);
		gf_fprintf(trace, "\"  KID=\"");
	}
	dump_data_hex(trace, (char *) ptr->key_info+4, 16);
	if (ptr->version)
		gf_fprintf(trace, "\" crypt_byte_block=\"%d\" skip_byte_block=\"%d", ptr->crypt_byte_block, ptr->skip_byte_block);
	gf_fprintf(trace, "\">\n");

	if (!ptr->size) {
		gf_fprintf(trace, " IV_size=\"\" KID=\"\" constant_IV_size=\"\" constant_IV=\"\" crypt_byte_block=\"\" skip_byte_block=\"\">\n");
		gf_fprintf(trace, "<TENCKey IV_size=\"\" KID=\"\" const_IV_size=\"\" constIV=\"\"/>\n");
	}
	gf_isom_box_dump_done("TrackEncryptionBox", a, trace);
	return GF_OK;
}