GF_Err video_sample_entry_box_dump(GF_Box *a, FILE * trace)
{
	Bool full_dump=GF_FALSE;
	GF_MPEGVisualSampleEntryBox *p = (GF_MPEGVisualSampleEntryBox *)a;
	const char *name;

	switch (p->type) {
	case GF_ISOM_SUBTYPE_AVC_H264:
	case GF_ISOM_SUBTYPE_AVC2_H264:
	case GF_ISOM_SUBTYPE_AVC3_H264:
	case GF_ISOM_SUBTYPE_AVC4_H264:
		name = "AVCSampleEntryBox";
		break;
	case GF_ISOM_SUBTYPE_MVC_H264:
		name = "MVCSampleEntryBox";
		break;
	case GF_ISOM_SUBTYPE_SVC_H264:
		name = "SVCSampleEntryBox";
		break;
	case GF_ISOM_SUBTYPE_HVC1:
	case GF_ISOM_SUBTYPE_HEV1:
	case GF_ISOM_SUBTYPE_HVC2:
	case GF_ISOM_SUBTYPE_HEV2:
		name = "HEVCSampleEntryBox";
		break;
	case GF_ISOM_SUBTYPE_VVC1:
	case GF_ISOM_SUBTYPE_VVI1:
		name = "VVCSampleEntryBox";
		break;
	case GF_ISOM_SUBTYPE_LHV1:
	case GF_ISOM_SUBTYPE_LHE1:
		name = "LHEVCSampleEntryBox";
		break;
	case GF_ISOM_SUBTYPE_AV01:
		name = "AV1SampleEntryBox";
		break;
	case GF_ISOM_SUBTYPE_3GP_H263:
		name = "H263SampleDescriptionBox";
		break;
	case GF_ISOM_SUBTYPE_MJP2:
		name = "MJ2KSampleDescriptionBox";
		break;
	case GF_QT_SUBTYPE_APCH:
	case GF_QT_SUBTYPE_APCO:
	case GF_QT_SUBTYPE_APCN:
	case GF_QT_SUBTYPE_APCS:
	case GF_QT_SUBTYPE_AP4X:
	case GF_QT_SUBTYPE_AP4H:
		name = "ProResSampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_RAW:
		name = "RGBSampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YUYV:
		name = "YUV422SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_UYVY:
		name = "YUV422SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YUV420:
		name = "YUV420SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YUV422_10:
		name = "YUV422_10_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YUV444:
		name = "YUV444SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YUV444_10:
		name = "YUV444_10_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_RAW_VID:
		name = "RGB_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YUVA444:
		name = "YUVA_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YUV422_16:
		name = "YUV420_16_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_I420:
		name = "I420_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_IYUV:
		name = "IUYV_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YV12:
		name = "YV12_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YVYU:
		name = "YVYU_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_RGBA:
		name = "RGBA_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_ABGR:
		name = "ABGR_SampleEntryBox";
		full_dump=GF_TRUE;
		break;

	default:
		//DO NOT TOUCH FOR NOW, this breaks all hashes
		name = "MPEGVisualSampleDescriptionBox";
		break;
	}


	gf_isom_box_dump_start(a, name, trace);

	gf_fprintf(trace, " DataReferenceIndex=\"%d\" Width=\"%d\" Height=\"%d\"", p->dataReferenceIndex, p->Width, p->Height);

	if (full_dump) {
		Float dpih, dpiv;
		gf_fprintf(trace, " Version=\"%d\" Revision=\"%d\" Vendor=\"%s\" TemporalQuality=\"%d\" SpatialQuality=\"%d\" FramesPerSample=\"%d\" ColorTableIndex=\"%d\"",
			p->version, p->revision, gf_4cc_to_str(p->vendor), p->temporal_quality, p->spatial_quality, p->frames_per_sample, p->color_table_index);

		dpih = (Float) (p->horiz_res&0xFFFF);
		dpih /= 0xFFFF;
		dpih += (p->vert_res>>16);
		dpiv = (Float) (p->vert_res&0xFFFF);
		dpiv /= 0xFFFF;
		dpiv += (p->vert_res>>16);

		gf_fprintf(trace, " XDPI=\"%g\" YDPI=\"%g\" BitDepth=\"%d\"", dpih, dpiv, p->bit_depth);
	} else {
		//dump reserved info
		gf_fprintf(trace, " XDPI=\"%d\" YDPI=\"%d\" BitDepth=\"%d\"", p->horiz_res, p->vert_res, p->bit_depth);
	}
	if (strlen((const char*)p->compressor_name) ) {
		if (isalnum(p->compressor_name[0])) {
			gf_fprintf(trace, " CompressorName=\"%s\"\n", p->compressor_name);
		} else {
			gf_fprintf(trace, " CompressorName=\"%s\"\n", p->compressor_name+1);
		}
	}

	gf_fprintf(trace, ">\n");
	gf_isom_box_dump_done(name, a, trace);
	return GF_OK;
}
GF_Err video_sample_entry_box_dump(GF_Box *a, FILE * trace)
{
	Bool full_dump=GF_FALSE;
	GF_MPEGVisualSampleEntryBox *p = (GF_MPEGVisualSampleEntryBox *)a;
	const char *name;

	switch (p->type) {
	case GF_ISOM_SUBTYPE_AVC_H264:
	case GF_ISOM_SUBTYPE_AVC2_H264:
	case GF_ISOM_SUBTYPE_AVC3_H264:
	case GF_ISOM_SUBTYPE_AVC4_H264:
		name = "AVCSampleEntryBox";
		break;
	case GF_ISOM_SUBTYPE_MVC_H264:
		name = "MVCSampleEntryBox";
		break;
	case GF_ISOM_SUBTYPE_SVC_H264:
		name = "SVCSampleEntryBox";
		break;
	case GF_ISOM_SUBTYPE_HVC1:
	case GF_ISOM_SUBTYPE_HEV1:
	case GF_ISOM_SUBTYPE_HVC2:
	case GF_ISOM_SUBTYPE_HEV2:
		name = "HEVCSampleEntryBox";
		break;
	case GF_ISOM_SUBTYPE_VVC1:
	case GF_ISOM_SUBTYPE_VVI1:
		name = "VVCSampleEntryBox";
		break;
	case GF_ISOM_SUBTYPE_LHV1:
	case GF_ISOM_SUBTYPE_LHE1:
		name = "LHEVCSampleEntryBox";
		break;
	case GF_ISOM_SUBTYPE_AV01:
		name = "AV1SampleEntryBox";
		break;
	case GF_ISOM_SUBTYPE_3GP_H263:
		name = "H263SampleDescriptionBox";
		break;
	case GF_ISOM_SUBTYPE_MJP2:
		name = "MJ2KSampleDescriptionBox";
		break;
	case GF_QT_SUBTYPE_APCH:
	case GF_QT_SUBTYPE_APCO:
	case GF_QT_SUBTYPE_APCN:
	case GF_QT_SUBTYPE_APCS:
	case GF_QT_SUBTYPE_AP4X:
	case GF_QT_SUBTYPE_AP4H:
		name = "ProResSampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_RAW:
		name = "RGBSampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YUYV:
		name = "YUV422SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_UYVY:
		name = "YUV422SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YUV420:
		name = "YUV420SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YUV422_10:
		name = "YUV422_10_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YUV444:
		name = "YUV444SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YUV444_10:
		name = "YUV444_10_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_RAW_VID:
		name = "RGB_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YUVA444:
		name = "YUVA_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YUV422_16:
		name = "YUV420_16_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_I420:
		name = "I420_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_IYUV:
		name = "IUYV_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YV12:
		name = "YV12_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_YVYU:
		name = "YVYU_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_RGBA:
		name = "RGBA_SampleEntryBox";
		full_dump=GF_TRUE;
		break;
	case GF_QT_SUBTYPE_ABGR:
		name = "ABGR_SampleEntryBox";
		full_dump=GF_TRUE;
		break;

	default:
		 
		name = "MPEGVisualSampleDescriptionBox";
		break;
	}


	gf_isom_box_dump_start(a, name, trace);

	gf_fprintf(trace, " DataReferenceIndex=\"%d\" Width=\"%d\" Height=\"%d\"", p->dataReferenceIndex, p->Width, p->Height);

	if (full_dump) {
		Float dpih, dpiv;
		gf_fprintf(trace, " Version=\"%d\" Revision=\"%d\" Vendor=\"%s\" TemporalQuality=\"%d\" SpatialQuality=\"%d\" FramesPerSample=\"%d\" ColorTableIndex=\"%d\"",
			p->version, p->revision, gf_4cc_to_str(p->vendor), p->temporal_quality, p->spatial_quality, p->frames_per_sample, p->color_table_index);

		dpih = (Float) (p->horiz_res&0xFFFF);
		dpih /= 0xFFFF;
		dpih += (p->vert_res>>16);
		dpiv = (Float) (p->vert_res&0xFFFF);
		dpiv /= 0xFFFF;
		dpiv += (p->vert_res>>16);

		gf_fprintf(trace, " XDPI=\"%g\" YDPI=\"%g\" BitDepth=\"%d\"", dpih, dpiv, p->bit_depth);
	} else {
		 
		gf_fprintf(trace, " XDPI=\"%d\" YDPI=\"%d\" BitDepth=\"%d\"", p->horiz_res, p->vert_res, p->bit_depth);
	}
	if (strlen((const char*)p->compressor_name) ) {
		if (isalnum(p->compressor_name[0])) {
			gf_fprintf(trace, " CompressorName=\"%s\"\n", p->compressor_name);
		} else {
			gf_fprintf(trace, " CompressorName=\"%s\"\n", p->compressor_name+1);
		}
	}

	gf_fprintf(trace, ">\n");
	gf_isom_box_dump_done(name, a, trace);
	return GF_OK;
}