in applications/mp4box/filedump.c [1723:2456]
void DumpTrackInfo(GF_ISOFile *file, u32 trackID, Bool full_dump)
{
Float scale;
Bool is_od_track = 0;
u32 trackNum, i, j, max_rate, rate, ts, mtype, msub_type, timescale, sr, nb_ch, count, alt_group, nb_groups, nb_edits;
u64 time_slice, dur, size;
u8 bps;
GF_ESD *esd;
char szDur[50];
char *lang;
trackNum = gf_isom_get_track_by_id(file, trackID);
if (!trackNum) {
fprintf(stderr, "No track with ID %d found\n", trackID);
return;
}
timescale = gf_isom_get_media_timescale(file, trackNum);
fprintf(stderr, "Track # %d Info - TrackID %d - TimeScale %d - Media Duration %s\n", trackNum, trackID, timescale, format_duration(gf_isom_get_media_duration(file, trackNum), timescale, szDur));
nb_edits = gf_isom_get_edit_segment_count(file, trackNum);
if (nb_edits)
fprintf(stderr, "Track has %d edit lists: track duration is %s\n", nb_edits, format_duration(gf_isom_get_track_duration(file, trackNum), gf_isom_get_timescale(file), szDur));
if (gf_isom_is_track_in_root_od(file, trackNum) ) fprintf(stderr, "Track is present in Root OD\n");
if (!gf_isom_is_track_enabled(file, trackNum)) fprintf(stderr, "Track is disabled\n");
gf_isom_get_media_language(file, trackNum, &lang);
fprintf(stderr, "Media Info: Language \"%s (%s)\" - ", GetLanguage(lang), lang );
gf_free(lang);
mtype = gf_isom_get_media_type(file, trackNum);
fprintf(stderr, "Type \"%s:", gf_4cc_to_str(mtype));
msub_type = gf_isom_get_mpeg4_subtype(file, trackNum, 1);
if (!msub_type) msub_type = gf_isom_get_media_subtype(file, trackNum, 1);
fprintf(stderr, "%s\" - %d samples\n", gf_4cc_to_str(msub_type), gf_isom_get_sample_count(file, trackNum));
count = gf_isom_get_track_kind_count(file, trackNum);
for (i = 0; i < count; i++) {
char *kind_scheme, *kind_value;
gf_isom_get_track_kind(file, trackNum, i, &kind_scheme, &kind_value);
fprintf(stderr, "Kind: %s - %s\n", kind_scheme, kind_value);
}
if (gf_isom_is_track_fragmented(file, trackID) ) {
u32 frag_samples;
u64 frag_duration;
gf_isom_get_fragmented_samples_info(file, trackID, &frag_samples, &frag_duration);
fprintf(stderr, "Fragmented track: %d samples - Media Duration %s\n", frag_samples, format_duration(frag_duration, timescale, szDur));
}
if (!gf_isom_is_self_contained(file, trackNum, 1)) {
const char *url, *urn;
gf_isom_get_data_reference(file, trackNum, 1, &url, &urn);
fprintf(stderr, "Media Data Location: %s\n", url ? url : urn);
}
if (full_dump) {
const char *handler_name;
gf_isom_get_handler_name(file, trackNum, &handler_name);
fprintf(stderr, "Handler name: %s\n", handler_name);
}
print_udta(file, trackNum);
if (mtype==GF_ISOM_MEDIA_VISUAL) {
s32 tx, ty;
u32 w, h;
gf_isom_get_track_layout_info(file, trackNum, &w, &h, &tx, &ty, NULL);
fprintf(stderr, "Visual Track layout: x=%d y=%d width=%d height=%d\n", tx, ty, w, h);
}
gf_isom_get_audio_info(file, trackNum, 1, &sr, &nb_ch, &bps);
gf_isom_set_nalu_extract_mode(file, trackNum, GF_ISOM_NALU_EXTRACT_INSPECT);
msub_type = gf_isom_get_media_subtype(file, trackNum, 1);
if ((msub_type==GF_ISOM_SUBTYPE_MPEG4)
|| (msub_type==GF_ISOM_SUBTYPE_MPEG4_CRYP)
|| (msub_type==GF_ISOM_SUBTYPE_AVC_H264)
|| (msub_type==GF_ISOM_SUBTYPE_AVC2_H264)
|| (msub_type==GF_ISOM_SUBTYPE_AVC3_H264)
|| (msub_type==GF_ISOM_SUBTYPE_AVC4_H264)
|| (msub_type==GF_ISOM_SUBTYPE_SVC_H264)
|| (msub_type==GF_ISOM_SUBTYPE_LSR1)
|| (msub_type==GF_ISOM_SUBTYPE_HVC1)
|| (msub_type==GF_ISOM_SUBTYPE_HEV1)
|| (msub_type==GF_ISOM_SUBTYPE_SHV1)
|| (msub_type==GF_ISOM_SUBTYPE_SHC1)
|| (msub_type==GF_ISOM_SUBTYPE_HVT1)
) {
esd = gf_isom_get_esd(file, trackNum, 1);
if (!esd) {
fprintf(stderr, "WARNING: Broken MPEG-4 Track\n");
} else {
const char *st = gf_odf_stream_type_name(esd->decoderConfig->streamType);
if (st) {
fprintf(stderr, "MPEG-4 Config%s%s Stream - ObjectTypeIndication 0x%02x\n",
full_dump ? "\n\t" : ": ", st, esd->decoderConfig->objectTypeIndication);
} else {
fprintf(stderr, "MPEG-4 Config%sStream Type 0x%02x - ObjectTypeIndication 0x%02x\n",
full_dump ? "\n\t" : ": ", esd->decoderConfig->streamType, esd->decoderConfig->objectTypeIndication);
}
if (esd->decoderConfig->streamType==GF_STREAM_OD)
is_od_track=1;
if (esd->decoderConfig->streamType==GF_STREAM_VISUAL) {
u32 w, h;
u16 rvc_predef;
w = h = 0;
if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_VIDEO_MPEG4_PART2) {
#ifndef GPAC_DISABLE_AV_PARSERS
if (!esd->decoderConfig->decoderSpecificInfo) {
#else
gf_isom_get_visual_info(file, trackNum, 1, &w, &h);
fprintf(stderr, "MPEG-4 Visual Size %d x %d\n", w, h);
#endif
fprintf(stderr, "\tNon-compliant MPEG-4 Visual track: video_object_layer infos not found in sample description\n");
#ifndef GPAC_DISABLE_AV_PARSERS
} else {
GF_M4VDecSpecInfo dsi;
gf_m4v_get_config(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, &dsi);
if (full_dump) fprintf(stderr, "\t");
w = dsi.width;
h = dsi.height;
fprintf(stderr, "MPEG-4 Visual Size %d x %d - %s\n", w, h, gf_m4v_get_profile_name(dsi.VideoPL));
if (dsi.par_den && dsi.par_num) {
u32 tw, th;
gf_isom_get_track_layout_info(file, trackNum, &tw, &th, NULL, NULL, NULL);
fprintf(stderr, "Pixel Aspect Ratio %d:%d - Indicated track size %d x %d\n", dsi.par_num, dsi.par_den, tw, th);
}
}
#endif
} else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_VIDEO_AVC) {
#ifndef GPAC_DISABLE_AV_PARSERS
GF_AVCConfig *avccfg, *svccfg;
GF_AVCConfigSlot *slc;
s32 par_n, par_d;
#endif
gf_isom_get_visual_info(file, trackNum, 1, &w, &h);
if (full_dump) fprintf(stderr, "\t");
fprintf(stderr, "AVC/H264 Video - Visual Size %d x %d\n", w, h);
#ifndef GPAC_DISABLE_AV_PARSERS
avccfg = gf_isom_avc_config_get(file, trackNum, 1);
svccfg = gf_isom_svc_config_get(file, trackNum, 1);
if (!avccfg && !svccfg) {
fprintf(stderr, "\n\n\tNon-compliant AVC track: SPS/PPS not found in sample description\n");
} else if (avccfg) {
fprintf(stderr, "\tAVC Info: %d SPS - %d PPS", gf_list_count(avccfg->sequenceParameterSets) , gf_list_count(avccfg->pictureParameterSets) );
fprintf(stderr, " - Profile %s @ Level %g\n", gf_avc_get_profile_name(avccfg->AVCProfileIndication), ((Double)avccfg->AVCLevelIndication)/10.0 );
fprintf(stderr, "\tNAL Unit length bits: %d\n", 8*avccfg->nal_unit_size);
for (i=0; i<gf_list_count(avccfg->sequenceParameterSets); i++) {
slc = gf_list_get(avccfg->sequenceParameterSets, i);
gf_avc_get_sps_info(slc->data, slc->size, NULL, NULL, NULL, &par_n, &par_d);
if ((par_n>0) && (par_d>0)) {
u32 tw, th;
gf_isom_get_track_layout_info(file, trackNum, &tw, &th, NULL, NULL, NULL);
fprintf(stderr, "\tPixel Aspect Ratio %d:%d - Indicated track size %d x %d\n", par_n, par_d, tw, th);
}
if (!full_dump) break;
}
if (avccfg->chroma_bit_depth) {
fprintf(stderr, "\tChroma format %d - Luma bit depth %d - chroma bit depth %d\n", avccfg->chroma_format, avccfg->luma_bit_depth, avccfg->chroma_bit_depth);
}
print_config_hash(avccfg->sequenceParameterSets, "SPS");
print_config_hash(avccfg->pictureParameterSets, "PPS");
gf_odf_avc_cfg_del(avccfg);
}
if (svccfg) {
fprintf(stderr, "\n\tSVC Info: %d SPS - %d PPS - Profile %s @ Level %g\n", gf_list_count(svccfg->sequenceParameterSets) , gf_list_count(svccfg->pictureParameterSets), gf_avc_get_profile_name(svccfg->AVCProfileIndication), ((Double)svccfg->AVCLevelIndication)/10.0 );
fprintf(stderr, "\tSVC NAL Unit length bits: %d\n", 8*svccfg->nal_unit_size);
for (i=0; i<gf_list_count(svccfg->sequenceParameterSets); i++) {
slc = gf_list_get(svccfg->sequenceParameterSets, i);
if (slc) {
u32 s_w, s_h, sps_id;
gf_avc_get_sps_info(slc->data, slc->size, &sps_id, &s_w, &s_h, &par_n, &par_d);
fprintf(stderr, "\t\tSSPS ID %d - Visual Size %d x %d\n", sps_id, s_w, s_h);
if ((par_n>0) && (par_d>0)) {
u32 tw, th;
gf_isom_get_track_layout_info(file, trackNum, &tw, &th, NULL, NULL, NULL);
fprintf(stderr, "\tPixel Aspect Ratio %d:%d - Indicated track size %d x %d\n", par_n, par_d, tw, th);
}
}
}
print_config_hash(svccfg->sequenceParameterSets, "SPS");
print_config_hash(svccfg->pictureParameterSets, "PPS");
print_config_hash(svccfg->sequenceParameterSetExtensions, "SPSEx");
gf_odf_avc_cfg_del(svccfg);
}
#endif /*GPAC_DISABLE_AV_PARSERS*/
} else if ((esd->decoderConfig->objectTypeIndication==GPAC_OTI_VIDEO_HEVC)
|| (esd->decoderConfig->objectTypeIndication==GPAC_OTI_VIDEO_SHVC)
) {
#if !defined(GPAC_DISABLE_AV_PARSERS) && !defined(GPAC_DISABLE_HEVC)
HEVCState hevc_state;
GF_HEVCConfig *hevccfg, *shvccfg;
memset(&hevc_state, 0, sizeof(HEVCState));
hevc_state.sps_active_idx = -1;
#endif
gf_isom_get_visual_info(file, trackNum, 1, &w, &h);
if (full_dump) fprintf(stderr, "\t");
fprintf(stderr, "HEVC Video - Visual Size %d x %d\n", w, h);
#if !defined(GPAC_DISABLE_AV_PARSERS) && !defined(GPAC_DISABLE_HEVC)
hevccfg = gf_isom_hevc_config_get(file, trackNum, 1);
shvccfg = gf_isom_shvc_config_get(file, trackNum, 1);
if (msub_type==GF_ISOM_SUBTYPE_HVT1) {
const char *data;
u32 size;
u32 is_default, x,y,w,h, id, independent;
Bool full_frame;
if (gf_isom_get_tile_info(file, trackNum, 1, &is_default, &id, &independent, &full_frame, &x, &y, &w, &h)) {
fprintf(stderr, "\tHEVC Tile - ID %d independent %d (x,y,w,h)=%d,%d,%d,%d \n", id, independent, x, y, w, h);
} else if (gf_isom_get_sample_group_info(file, trackNum, 1, GF_4CC('t','r','i','f'), &is_default, &data, &size)) {
fprintf(stderr, "\tHEVC Tile track containing a tile set\n");
} else {
fprintf(stderr, "\tHEVC Tile track without tiling info\n");
}
} else if (!hevccfg && !shvccfg) {
fprintf(stderr, "\n\n\tNon-compliant HEVC track: No hvcC or shcC found in sample description\n");
}
if (hevccfg) {
dump_hevc_track_info(file, trackNum, hevccfg, &hevc_state);
gf_odf_hevc_cfg_del(hevccfg);
fprintf(stderr, "\n");
}
if (shvccfg) {
dump_hevc_track_info(file, trackNum, shvccfg, &hevc_state);
gf_odf_hevc_cfg_del(shvccfg);
}
#endif /*GPAC_DISABLE_AV_PARSERS && defined(GPAC_DISABLE_HEVC)*/
}
/*OGG media*/
else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_MEDIA_OGG) {
char *szName;
gf_isom_get_visual_info(file, trackNum, 1, &w, &h);
if (full_dump) fprintf(stderr, "\t");
if (!strnicmp(&esd->decoderConfig->decoderSpecificInfo->data[3], "theora", 6)) szName = "Theora";
else szName = "Unknown";
fprintf(stderr, "Ogg/%s video / GPAC Mux - Visual Size %d x %d\n", szName, w, h);
}
else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_IMAGE_JPEG) {
gf_isom_get_visual_info(file, trackNum, 1, &w, &h);
fprintf(stderr, "JPEG Stream - Visual Size %d x %d\n", w, h);
}
else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_IMAGE_PNG) {
gf_isom_get_visual_info(file, trackNum, 1, &w, &h);
fprintf(stderr, "PNG Stream - Visual Size %d x %d\n", w, h);
}
else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_IMAGE_JPEG_2000) {
gf_isom_get_visual_info(file, trackNum, 1, &w, &h);
fprintf(stderr, "JPEG2000 Stream - Visual Size %d x %d\n", w, h);
}
if (!w || !h) {
gf_isom_get_visual_info(file, trackNum, 1, &w, &h);
if (full_dump) fprintf(stderr, "\t");
fprintf(stderr, "Visual Size %d x %d\n", w, h);
}
if (gf_isom_get_rvc_config(file, trackNum, 1, &rvc_predef, NULL, NULL, NULL)==GF_OK) {
fprintf(stderr, "Has RVC signaled - Predefined configuration %d\n", rvc_predef);
}
} else if (esd->decoderConfig->streamType==GF_STREAM_AUDIO) {
#ifndef GPAC_DISABLE_AV_PARSERS
GF_M4ADecSpecInfo a_cfg;
GF_Err e;
u32 oti;
#endif
u32 is_mp2 = 0;
switch (esd->decoderConfig->objectTypeIndication) {
case GPAC_OTI_AUDIO_AAC_MPEG2_MP:
case GPAC_OTI_AUDIO_AAC_MPEG2_LCP:
case GPAC_OTI_AUDIO_AAC_MPEG2_SSRP:
is_mp2 = 1;
case GPAC_OTI_AUDIO_AAC_MPEG4:
#ifndef GPAC_DISABLE_AV_PARSERS
if (!esd->decoderConfig->decoderSpecificInfo)
e = GF_NON_COMPLIANT_BITSTREAM;
else
e = gf_m4a_get_config(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, &a_cfg);
if (full_dump) fprintf(stderr, "\t");
if (e) fprintf(stderr, "Corrupted AAC Config\n");
else {
fprintf(stderr, "%s - %d Channel(s) - SampleRate %d", gf_m4a_object_type_name(a_cfg.base_object_type), a_cfg.nb_chan, a_cfg.base_sr);
if (is_mp2) fprintf(stderr, " (MPEG-2 Signaling)");
if (a_cfg.has_sbr) fprintf(stderr, " - SBR: SampleRate %d Type %s", a_cfg.sbr_sr, gf_m4a_object_type_name(a_cfg.sbr_object_type));
if (a_cfg.has_ps) fprintf(stderr, " - PS");
fprintf(stderr, "\n");
}
#else
fprintf(stderr, "MPEG-2/4 Audio - %d Channels - SampleRate %d\n", nb_ch, sr);
#endif
break;
case GPAC_OTI_AUDIO_MPEG2_PART3:
case GPAC_OTI_AUDIO_MPEG1:
if (msub_type == GF_ISOM_SUBTYPE_MPEG4_CRYP) {
fprintf(stderr, "MPEG-1/2 Audio - %d Channels - SampleRate %d\n", nb_ch, sr);
} else {
#ifndef GPAC_DISABLE_AV_PARSERS
GF_ISOSample *samp = gf_isom_get_sample(file, trackNum, 1, &oti);
if (samp) {
oti = GF_4CC((u8)samp->data[0], (u8)samp->data[1], (u8)samp->data[2], (u8)samp->data[3]);
if (full_dump) fprintf(stderr, "\t");
fprintf(stderr, "%s Audio - %d Channel(s) - SampleRate %d - Layer %d\n",
gf_mp3_version_name(oti),
gf_mp3_num_channels(oti),
gf_mp3_sampling_rate(oti),
gf_mp3_layer(oti)
);
gf_isom_sample_del(&samp);
} else {
fprintf(stderr, "\n\tError fetching sample: %s\n", gf_error_to_string(gf_isom_last_error(file)) );
}
#else
fprintf(stderr, "MPEG-1/2 Audio - %d Channels - SampleRate %d\n", nb_ch, sr);
#endif
}
break;
/*OGG media*/
case GPAC_OTI_MEDIA_OGG:
{
char *szName;
if (full_dump) fprintf(stderr, "\t");
if (!strnicmp(&esd->decoderConfig->decoderSpecificInfo->data[3], "vorbis", 6)) szName = "Vorbis";
else if (!strnicmp(&esd->decoderConfig->decoderSpecificInfo->data[2], "Speex", 5)) szName = "Speex";
else if (!strnicmp(&esd->decoderConfig->decoderSpecificInfo->data[2], "Flac", 4)) szName = "Flac";
else szName = "Unknown";
fprintf(stderr, "Ogg/%s audio / GPAC Mux - Sample Rate %d - %d channel(s)\n", szName, sr, nb_ch);
}
break;
case GPAC_OTI_AUDIO_EVRC_VOICE:
fprintf(stderr, "EVRC Audio - Sample Rate 8000 - 1 channel\n");
break;
case GPAC_OTI_AUDIO_SMV_VOICE:
fprintf(stderr, "SMV Audio - Sample Rate 8000 - 1 channel\n");
break;
case GPAC_OTI_AUDIO_13K_VOICE:
fprintf(stderr, "QCELP Audio - Sample Rate 8000 - 1 channel\n");
break;
/*packetVideo hack for EVRC...*/
case 0xD1:
if (esd->decoderConfig->decoderSpecificInfo && (esd->decoderConfig->decoderSpecificInfo->dataLength==8)
&& !strnicmp(esd->decoderConfig->decoderSpecificInfo->data, "pvmm", 4)) {
if (full_dump) fprintf(stderr, "\t");
fprintf(stderr, "EVRC Audio (PacketVideo Mux) - Sample Rate 8000 - 1 channel\n");
}
break;
}
}
else if (esd->decoderConfig->streamType==GF_STREAM_SCENE) {
if (esd->decoderConfig->objectTypeIndication<=4) {
GF_BIFSConfig *b_cfg = gf_odf_get_bifs_config(esd->decoderConfig->decoderSpecificInfo, esd->decoderConfig->objectTypeIndication);
fprintf(stderr, "BIFS Scene description - %s stream\n", b_cfg->elementaryMasks ? "Animation" : "Command");
if (full_dump && !b_cfg->elementaryMasks) {
fprintf(stderr, "\tWidth %d Height %d Pixel Metrics %s\n", b_cfg->pixelWidth, b_cfg->pixelHeight, b_cfg->pixelMetrics ? "yes" : "no");
}
gf_odf_desc_del((GF_Descriptor *)b_cfg);
} else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_SCENE_AFX) {
u8 tag = esd->decoderConfig->decoderSpecificInfo ? esd->decoderConfig->decoderSpecificInfo->data[0] : 0xFF;
const char *afxtype = gf_afx_get_type_description(tag);
fprintf(stderr, "AFX Stream - type %s (%d)\n", afxtype, tag);
} else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_FONT) {
fprintf(stderr, "Font Data stream\n");
} else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_SCENE_LASER) {
GF_LASERConfig l_cfg;
gf_odf_get_laser_config(esd->decoderConfig->decoderSpecificInfo, &l_cfg);
fprintf(stderr, "LASER Stream - %s\n", l_cfg.newSceneIndicator ? "Full Scene" : "Scene Segment");
} else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_TEXT_MPEG4) {
fprintf(stderr, "MPEG-4 Streaming Text stream\n");
} else if (esd->decoderConfig->objectTypeIndication==GPAC_OTI_SCENE_SYNTHESIZED_TEXTURE) {
fprintf(stderr, "Synthetized Texture stream stream\n");
} else {
fprintf(stderr, "Unknown Systems stream OTI %d\n", esd->decoderConfig->objectTypeIndication);
}
}
/*sync is only valid if we open all tracks to take care of default MP4 sync..*/
if (!full_dump) {
if (!esd->OCRESID || (esd->OCRESID == esd->ESID))
fprintf(stderr, "Self-synchronized\n");
else
fprintf(stderr, "Synchronized on stream %d\n", esd->OCRESID);
} else {
fprintf(stderr, "\tDecoding Buffer size %d - Bitrate: avg %d - max %d kbps\n", esd->decoderConfig->bufferSizeDB, esd->decoderConfig->avgBitrate/1000, esd->decoderConfig->maxBitrate/1000);
if (esd->dependsOnESID)
fprintf(stderr, "\tDepends on stream %d for decoding\n", esd->dependsOnESID);
else
fprintf(stderr, "\tNo stream dependencies for decoding\n");
fprintf(stderr, "\tStreamPriority %d\n", esd->streamPriority);
if (esd->URLString) fprintf(stderr, "\tRemote Data Source %s\n", esd->URLString);
}
gf_odf_desc_del((GF_Descriptor *) esd);
/*ISMACryp*/
if (msub_type == GF_ISOM_SUBTYPE_MPEG4_CRYP) {
const char *scheme_URI, *KMS_URI;
u32 scheme_type, version;
u32 IV_size;
Bool use_sel_enc;
if (gf_isom_is_ismacryp_media(file, trackNum, 1)) {
gf_isom_get_ismacryp_info(file, trackNum, 1, NULL, &scheme_type, &version, &scheme_URI, &KMS_URI, &use_sel_enc, &IV_size, NULL);
fprintf(stderr, "\n*Encrypted stream - ISMA scheme %s (version %d)\n", gf_4cc_to_str(scheme_type), version);
if (scheme_URI) fprintf(stderr, "scheme location: %s\n", scheme_URI);
if (KMS_URI) {
if (!strnicmp(KMS_URI, "(key)", 5)) fprintf(stderr, "KMS location: key in file\n");
else fprintf(stderr, "KMS location: %s\n", KMS_URI);
}
fprintf(stderr, "Selective Encryption: %s\n", use_sel_enc ? "Yes" : "No");
if (IV_size) fprintf(stderr, "Initialization Vector size: %d bits\n", IV_size*8);
} else if (gf_isom_is_omadrm_media(file, trackNum, 1)) {
const char *textHdrs;
u32 enc_type, hdr_len;
u64 orig_len;
fprintf(stderr, "\n*Encrypted stream - OMA DRM\n");
gf_isom_get_omadrm_info(file, trackNum, 1, NULL, NULL, NULL, &scheme_URI, &KMS_URI, &textHdrs, &hdr_len, &orig_len, &enc_type, &use_sel_enc, &IV_size, NULL);
fprintf(stderr, "Rights Issuer: %s\n", KMS_URI);
fprintf(stderr, "Content ID: %s\n", scheme_URI);
if (textHdrs) {
u32 i, offset;
const char *start = textHdrs;
fprintf(stderr, "OMA Textual Headers:\n");
i=offset=0;
while (i<hdr_len) {
if (start[i]==0) {
fprintf(stderr, "\t%s\n", start+offset);
offset=i+1;
}
i++;
}
fprintf(stderr, "\t%s\n", start+offset);
}
if (orig_len) fprintf(stderr, "Original media size "LLD"\n", LLD_CAST orig_len);
fprintf(stderr, "Encryption algorithm %s\n", (enc_type==1) ? "AEA 128 CBC" : (enc_type ? "AEA 128 CTR" : "None"));
fprintf(stderr, "Selective Encryption: %s\n", use_sel_enc ? "Yes" : "No");
if (IV_size) fprintf(stderr, "Initialization Vector size: %d bits\n", IV_size*8);
} else if(gf_isom_is_cenc_media(file, trackNum, 1)) {
gf_isom_get_cenc_info(file, trackNum, 1, NULL, &scheme_type, &version, &IV_size);
fprintf(stderr, "\n*Encrypted stream - CENC scheme %s (version: major=%u, minor=%u)\n", gf_4cc_to_str(scheme_type), (version&0xFFFF0000)>>16, version&0xFFFF);
if (IV_size) fprintf(stderr, "Initialization Vector size: %d bits\n", IV_size*8);
} else if(gf_isom_is_adobe_protection_media(file, trackNum, 1)) {
gf_isom_get_adobe_protection_info(file, trackNum, 1, NULL, &scheme_type, &version);
fprintf(stderr, "\n*Encrypted stream - Adobe protection scheme %s (version %d)\n", gf_4cc_to_str(scheme_type), version);
} else {
fprintf(stderr, "\n*Encrypted stream - unknown scheme %s\n", gf_4cc_to_str(gf_isom_is_media_encrypted(file, trackNum, 1) ));
}
}
}
} else if (msub_type == GF_ISOM_SUBTYPE_3GP_H263) {
u32 w, h;
gf_isom_get_visual_info(file, trackNum, 1, &w, &h);
fprintf(stderr, "\t3GPP H263 stream - Resolution %d x %d\n", w, h);
} else if (msub_type == GF_4CC('m','j','p','2')) {
u32 w, h;
gf_isom_get_visual_info(file, trackNum, 1, &w, &h);
fprintf(stderr, "\tMotionJPEG2000 stream - Resolution %d x %d\n", w, h);
} else if ((msub_type == GF_ISOM_SUBTYPE_3GP_AMR) || (msub_type == GF_ISOM_SUBTYPE_3GP_AMR_WB)) {
fprintf(stderr, "\t3GPP AMR%s stream - Sample Rate %d - %d channel(s) %d bps\n", (msub_type == GF_ISOM_SUBTYPE_3GP_AMR_WB) ? " Wide Band" : "", sr, nb_ch, (u32) bps);
} else if (msub_type == GF_ISOM_SUBTYPE_3GP_EVRC) {
fprintf(stderr, "\t3GPP EVRC stream - Sample Rate %d - %d channel(s) %d bps\n", sr, nb_ch, (u32) bps);
} else if (msub_type == GF_ISOM_SUBTYPE_3GP_QCELP) {
fprintf(stderr, "\t3GPP QCELP stream - Sample Rate %d - %d channel(s) %d bps\n", sr, nb_ch, (u32) bps);
} else if (msub_type == GF_ISOM_SUBTYPE_MP3) {
fprintf(stderr, "\tMPEG 1/2 Audio stream - Sample Rate %d - %d channel(s) %d bps\n", sr, nb_ch, (u32) bps);
} else if (msub_type == GF_ISOM_SUBTYPE_AC3) {
u32 br = 0;
Bool lfe = 0;
Bool is_ec3 = 0;
#ifndef GPAC_DISABLE_AV_PARSERS
GF_AC3Config *ac3 = gf_isom_ac3_config_get(file, trackNum, 1);
if (ac3) {
int i;
nb_ch = gf_ac3_get_channels(ac3->streams[0].acmod);
for (i=0; i<ac3->streams[0].nb_dep_sub; ++i) {
assert(ac3->streams[0].nb_dep_sub == 1);
nb_ch += gf_ac3_get_channels(ac3->streams[0].chan_loc);
}
lfe = ac3->streams[0].lfon;
br = ac3->is_ec3 ? ac3->brcode : gf_ac3_get_bitrate(ac3->brcode);
is_ec3 = ac3->is_ec3;
gf_free(ac3);
}
#endif
fprintf(stderr, "\t%s stream - Sample Rate %d - %d%s channel(s) - bitrate %d\n", is_ec3 ? "EC-3" : "AC-3", sr, nb_ch, lfe ? ".1" : "", br);
} else if (msub_type == GF_ISOM_SUBTYPE_3GP_SMV) {
fprintf(stderr, "\t3GPP SMV stream - Sample Rate %d - %d channel(s) %d bits per samples\n", sr, nb_ch, (u32) bps);
} else if (msub_type == GF_ISOM_SUBTYPE_3GP_DIMS) {
u32 w, h;
GF_DIMSDescription dims;
gf_isom_get_visual_info(file, trackNum, 1, &w, &h);
gf_isom_get_dims_description(file, trackNum, 1, &dims);
fprintf(stderr, "\t3GPP DIMS stream - size %d x %d - Profile %d - Level %d\n", w, h, dims.profile, dims.level);
fprintf(stderr, "\tpathComponents: %d - useFullRequestHost: %s\n", dims.pathComponents, dims.fullRequestHost ? "yes" : "no");
fprintf(stderr, "\tstream type: %s - redundant: %s\n", dims.streamType ? "primary" : "secondary", (dims.containsRedundant==1) ? "main" : ((dims.containsRedundant==2) ? "redundant" : "main+redundant") );
if (dims.textEncoding[0]) fprintf(stderr, "\ttext encoding %s\n", dims.textEncoding);
if (dims.contentEncoding[0]) fprintf(stderr, "\tcontent encoding %s\n", dims.contentEncoding);
if (dims.content_script_types) fprintf(stderr, "\tscript languages %s\n", dims.content_script_types);
} else if (mtype==GF_ISOM_MEDIA_HINT) {
u32 refTrack;
s32 i, refCount = gf_isom_get_reference_count(file, trackNum, GF_ISOM_REF_HINT);
if (refCount) {
fprintf(stderr, "Streaming Hint Track for track%s ", (refCount>1) ? "s" :"");
for (i=0; i<refCount; i++) {
gf_isom_get_reference(file, trackNum, GF_ISOM_REF_HINT, i+1, &refTrack);
if (i) fprintf(stderr, " - ");
fprintf(stderr, "ID %d", gf_isom_get_track_id(file, refTrack));
}
fprintf(stderr, "\n");
} else {
fprintf(stderr, "Streaming Hint Track (no refs)\n");
}
#ifndef GPAC_DISABLE_ISOM_HINTING
refCount = gf_isom_get_payt_count(file, trackNum);
for (i=0; i<refCount; i++) {
const char *name = gf_isom_get_payt_info(file, trackNum, i+1, &refTrack);
fprintf(stderr, "\tPayload ID %d: type %s\n", refTrack, name);
}
#endif
} else if (mtype==GF_ISOM_MEDIA_FLASH) {
fprintf(stderr, "Macromedia Flash Movie\n");
} else if ((mtype==GF_ISOM_MEDIA_TEXT) || (mtype==GF_ISOM_MEDIA_SUBT) || (mtype==GF_ISOM_MEDIA_MPEG_SUBT)) {
u32 w, h;
s16 l;
s32 tx, ty;
const char *content_encoding = NULL;
const char *mime = NULL;
const char *config = NULL;
const char *_namespace = NULL;
const char *schema_loc = NULL;
const char *auxiliary_mimes = NULL;
gf_isom_get_track_layout_info(file, trackNum, &w, &h, &tx, &ty, &l);
if (msub_type == GF_ISOM_SUBTYPE_SBTT) {
gf_isom_stxt_get_description(file, trackNum, 1, &mime, &content_encoding, &config);
fprintf(stderr, "Textual Subtitle Stream ");
fprintf(stderr, "- mime %s", mime);
if (content_encoding != NULL) {
fprintf(stderr, " - encoding %s", content_encoding);
}
if (config != NULL) {
fprintf(stderr, " - %d bytes config", (u32) strlen(config));
}
} else if (msub_type == GF_ISOM_SUBTYPE_STXT) {
gf_isom_stxt_get_description(file, trackNum, 1, &mime, &content_encoding, &config);
fprintf(stderr, "Simple Timed Text Stream ");
fprintf(stderr, "- mime %s", mime);
if (content_encoding != NULL) {
fprintf(stderr, " - encoding %s", content_encoding);
}
if (config != NULL) {
fprintf(stderr, " - %d bytes config", (u32) strlen(config));
}
} else if (msub_type == GF_ISOM_SUBTYPE_STPP) {
gf_isom_xml_subtitle_get_description(file, trackNum, 1, &_namespace, &schema_loc, &auxiliary_mimes);
fprintf(stderr, "XML Subtitle Stream ");
fprintf(stderr, "- namespace %s", _namespace);
if (schema_loc != NULL) {
fprintf(stderr, " - schema-location %s", schema_loc);
}
if (auxiliary_mimes != NULL) {
fprintf(stderr, " - auxiliary-mime-types %s", auxiliary_mimes);
}
} else {
fprintf(stderr, "Unknown Text Stream");
}
fprintf(stderr, "\n Size %d x %d - Translation X=%d Y=%d - Layer %d\n", w, h, tx, ty, l);
} else if (mtype == GF_ISOM_MEDIA_META) {
const char *content_encoding = NULL;
if (msub_type == GF_ISOM_SUBTYPE_METT) {
const char *mime = NULL;
const char *config = NULL;
gf_isom_stxt_get_description(file, trackNum, 1, &mime, &content_encoding, &config);
fprintf(stderr, "Textual Metadata Stream - mime %s", mime);
if (content_encoding != NULL) {
fprintf(stderr, " - encoding %s", content_encoding);
}
if (config != NULL) {
fprintf(stderr, " - %d bytes config", (u32) strlen(config));
}
fprintf(stderr, "\n");
} else if (msub_type == GF_ISOM_SUBTYPE_METX) {
const char *_namespace = NULL;
const char *schema_loc = NULL;
gf_isom_get_xml_metadata_description(file, trackNum, 1, &_namespace, &schema_loc, &content_encoding);
fprintf(stderr, "XML Metadata Stream - namespace %s", _namespace);
if (content_encoding != NULL) {
fprintf(stderr, " - encoding %s", content_encoding);
}
if (schema_loc != NULL) {
fprintf(stderr, " - schema-location %s", schema_loc);
}
fprintf(stderr, "\n");
} else {
fprintf(stderr, "Unknown Metadata Stream\n");
}
} else {
GF_GenericSampleDescription *udesc = gf_isom_get_generic_sample_description(file, trackNum, 1);
if (udesc) {
if (mtype==GF_ISOM_MEDIA_VISUAL) {
fprintf(stderr, "Visual Track - Compressor \"%s\" - Resolution %d x %d\n", udesc->compressor_name, udesc->width, udesc->height);
} else if (mtype==GF_ISOM_MEDIA_AUDIO) {
fprintf(stderr, "Audio Track - Sample Rate %d - %d channel(s)\n", udesc->samplerate, udesc->nb_channels);
} else {
fprintf(stderr, "Unknown media type\n");
}
if (udesc->vendor_code)
fprintf(stderr, "\tVendor code \"%s\" - Version %d - revision %d\n", gf_4cc_to_str(udesc->vendor_code), udesc->version, udesc->revision);
if (udesc->extension_buf) {
fprintf(stderr, "\tCodec configuration data size: %d bytes\n", udesc->extension_buf_size);
gf_free(udesc->extension_buf);
}
gf_free(udesc);
} else {
fprintf(stderr, "Unknown track type\n");
}
}
{
char szCodec[100];
gf_media_get_rfc_6381_codec_name(file, trackNum, szCodec, GF_FALSE, GF_FALSE);
fprintf(stderr, "\tRFC6381 Codec Parameters: %s\n", szCodec);
}
DumpMetaItem(file, 0, trackNum, "Track Meta");
gf_isom_get_track_switch_group_count(file, trackNum, &alt_group, &nb_groups);
if (alt_group) {
fprintf(stderr, "Alternate Group ID %d\n", alt_group);
for (i=0; i<nb_groups; i++) {
u32 nb_crit, switchGroupID;
const u32 *criterias = gf_isom_get_track_switch_parameter(file, trackNum, i+1, &switchGroupID, &nb_crit);
if (!nb_crit) {
fprintf(stderr, "\tNo criteria in %s group\n", switchGroupID ? "switch" : "alternate");
} else {
if (switchGroupID) {
fprintf(stderr, "\tSwitchGroup ID %d criterias: ", switchGroupID);
} else {
fprintf(stderr, "\tAlternate Group criterias: ");
}
for (j=0; j<nb_crit; j++) {
if (j) fprintf(stderr, " ");
fprintf(stderr, "%s", gf_4cc_to_str(criterias[j]) );
}
fprintf(stderr, "\n");
}
}
}
switch (gf_isom_has_sync_points(file, trackNum)) {
case 0:
fprintf(stderr, "\tAll samples are sync\n");
break;
case 1:
fprintf(stderr, "\tAverage GOP length: %d samples\n", (u32 ) (gf_isom_get_sample_count(file, trackNum) / gf_isom_get_sync_point_count(file, trackNum) ) );
break;
case 2:
fprintf(stderr, "\tNo sync sample found\n");
break;
}
if (!full_dump) {
fprintf(stderr, "\n");
return;
}
dur = size = 0;
max_rate = rate = 0;
time_slice = 0;
ts = gf_isom_get_media_timescale(file, trackNum);
for (j=0; j<gf_isom_get_sample_count(file, trackNum); j++) {
GF_ISOSample *samp;
if (is_od_track) {
samp = gf_isom_get_sample(file, trackNum, j+1, NULL);
} else {
samp = gf_isom_get_sample_info(file, trackNum, j+1, NULL, NULL);
}
dur = samp->DTS+samp->CTS_Offset;
size += samp->dataLength;
rate += samp->dataLength;
if (samp->DTS - time_slice>ts) {
if (max_rate < rate) max_rate = rate;
rate = 0;
time_slice = samp->DTS;
}
gf_isom_sample_del(&samp);
}
fprintf(stderr, "\nComputed info from media:\n");
scale = 1000;
scale /= ts;
dur = (u64) (scale * (s64)dur);
fprintf(stderr, "\tTotal size "LLU" bytes - Total samples duration "LLU" ms\n", size, dur);
if (!dur) {
fprintf(stderr, "\n");
return;
}
/*rate in byte, dur is in ms*/
rate = (u32) ((size * 8 * 1000) / dur);
max_rate *= 8;
if (rate >= 1500) {
rate /= 1000;
max_rate /= 1000;
fprintf(stderr, "\tAverage rate %d kbps - Max Rate %d kbps\n", rate, max_rate);
} else {
fprintf(stderr, "\tAverage rate %d bps - Max Rate %d bps\n", rate, max_rate);
}
{
u32 dmin, dmax, davg, smin, smax, savg;
gf_isom_get_chunks_infos(file, trackNum, &dmin, &davg, &dmax, &smin, &savg, &smax);
fprintf(stderr, "\tChunk durations: min %d ms - max %d ms - average %d ms\n", (1000*dmin)/ts, (1000*dmax)/ts, (1000*davg)/ts);
fprintf(stderr, "\tChunk sizes (bytes): min %d - max %d - average %d\n", smin, smax, savg);
}
fprintf(stderr, "\n");
count = gf_isom_get_chapter_count(file, trackNum);
if (count) {
char szDur[20];
const char *name;
u64 time;
fprintf(stderr, "\nChapters:\n");
for (j=0; j<count; j++) {
gf_isom_get_chapter(file, trackNum, j+1, &time, &name);
fprintf(stderr, "\tChapter #%d - %s - \"%s\"\n", j+1, format_duration(time, 1000, szDur), name);
}
}
}