📄 fileprops.cpp
字号:
gf_list_del(descs);}void CFileProps::OnViewsg() { char szOutFile[GF_MAX_PATH]; WinGPAC *gpac = GetApp(); strcpy(szOutFile, gpac->szAppPath); strcat(szOutFile, "scene_dump"); GF_Err e = gf_term_dump_scene(gpac->m_term, (char *) szOutFile, gpac->m_ViewXMTA, 0, current_odm); if (e) { MessageBox(gf_error_to_string(e), "Error while dumping"); } else { ShellExecute(NULL, "open", szOutFile, NULL, NULL, SW_SHOWNORMAL); }}void CFileProps::SetDecoderInfo(){ ODInfo odi; char buf[1000], info[2000]; u32 h, m, s; WinGPAC *gpac = GetApp(); sprintf(info, ""); m_ODInfo.SetWindowText(""); if (!current_odm || gf_term_get_object_info(gpac->m_term, current_odm, &odi)) return; if (!odi.od) return; strcat(info, "Status: "); switch (odi.status) { case 0: case 1: case 2: h = (u32) (odi.current_time / 3600); m = (u32) (odi.current_time / 60) - h*60; s = (u32) (odi.current_time) - h*3600 - m*60; sprintf(buf, "%s\r\nObject Time: %02d:%02d:%02d\r\n", (odi.status==0) ? "Stopped" : (odi.status==1) ? "Playing" : "Paused", h, m, s); strcat(info, buf); break; case 3: strcat(info, "Not Setup"); m_ODInfo.SetWindowText(info); return; default: strcat(info, "Setup Failed"); m_ODInfo.SetWindowText(info); return; } /*get clock drift*/ sprintf(buf, "Clock drift: %d ms\r\n", odi.clock_drift); strcat(info, buf); /*get buffering*/ if (odi.buffer>=0) { sprintf(buf, "Buffering Time: %d ms\r\n", odi.buffer); strcat(info, buf); } else if (odi.buffer==-1) { strcat(info, "Not buffering\r\n"); } else { strcat(info, "Not Playing\r\n"); } /*get DB occupation*/ if (odi.buffer>=0) { sprintf(buf, "Decoding Buffer: %d Access Units\r\n", odi.db_unit_count); strcat(info, buf); } /*get CB occupation*/ if (odi.cb_max_count) { sprintf(buf, "Composition Memory: %d/%d Units\r\n", odi.cb_unit_count, odi.cb_max_count); strcat(info, buf); } Float avg_dec_time = 0; if (odi.nb_dec_frames) { avg_dec_time = (Float) odi.total_dec_time; avg_dec_time /= odi.nb_dec_frames; } sprintf(buf, "Bitrate over last second: %d kbps\r\nMax bitrate over one second: %d kbps\r\nAverage Decoding Time %.2f ms (%d max)\r\nTotal decoded frames %d - %d dropped\r\n", (u32) odi.avg_bitrate/1024, odi.max_bitrate/1024, avg_dec_time, odi.max_dec_time, odi.nb_dec_frames, odi.nb_droped); strcat(info, buf); m_ODInfo.SetWindowText(info);}void CFileProps::SetStreamsInfo(){ u32 i, count; char info[10000]; char buf[1000], code[5]; ODInfo odi; GF_ObjectManager *odm; Bool is_media; WinGPAC *gpac = GetApp(); odm = current_odm; strcpy(info, ""); m_ODInfo.SetWindowText(""); if (!odm || gf_term_get_object_info(gpac->m_term, odm, &odi) != GF_OK) return; if (!odi.od) return; if (odi.has_profiles) { strcat(info, "MPEG-4 Profiles and Levels:\r\n"); sprintf(buf, "\tOD Profile@Level %d\r\n", odi.OD_pl); strcat(info, buf); sprintf(buf, "\tScene Profile@Level %d\r\n", odi.scene_pl); strcat(info, buf); sprintf(buf, "\tGraphics Profile@Level %d\r\n", odi.graphics_pl); strcat(info, buf); sprintf(buf, "\tAudio Profile@Level %d\r\n", odi.audio_pl); strcat(info, buf); sprintf(buf, "\tVisual Profile@Level %d\r\n", odi.visual_pl); strcat(info, buf); sprintf(buf, "\tInline Content Profiled %s\r\n", odi.inline_pl ? "yes" : "no"); strcat(info, buf); strcat(info, "\r\n"); } is_media = 0; count = gf_list_count(odi.od->ESDescriptors); for (i=0; i<count; i++) { GF_ESD *esd = (GF_ESD *) gf_list_get(odi.od->ESDescriptors, i); sprintf(buf, "\t** Stream ID %d - Clock ID %d **\r\n", esd->ESID, esd->OCRESID); strcat(info, buf); if (esd->dependsOnESID) { sprintf(buf, "Depends on Stream ID %d for decoding\r\n", esd->dependsOnESID); strcat(info, buf); } switch (esd->decoderConfig->streamType) { case GF_STREAM_OD: sprintf(buf, "OD Stream - version %d\r\n", esd->decoderConfig->objectTypeIndication); strcat(info, buf); break; case GF_STREAM_OCR: sprintf(buf, "OCR Stream\r\n"); strcat(info, buf); break; case GF_STREAM_SCENE: sprintf(buf, "Scene Description Stream - version %d\r\n", esd->decoderConfig->objectTypeIndication); strcat(info, buf); break; case GF_STREAM_PRIVATE_SCENE: sprintf(buf, "GPAC Private Scene Description Stream\r\n"); strcat(info, buf); break; case GF_STREAM_VISUAL: is_media = 1; strcat(info, "Visual Stream - media type: "); switch (esd->decoderConfig->objectTypeIndication) { case 0x20: strcat(info, "MPEG-4\r\n"); break; case 0x60: strcat(info, "MPEG-2 Simple Profile\r\n"); break; case 0x61: strcat(info, "MPEG-2 Main Profile\r\n"); break; case 0x62: strcat(info, "MPEG-2 SNR Profile\r\n"); break; case 0x63: strcat(info, "MPEG-2 Spatial Profile\r\n"); break; case 0x64: strcat(info, "MPEG-2 High Profile\r\n"); break; case 0x65: strcat(info, "MPEG-2 422 Profile\r\n"); break; case 0x6A: strcat(info, "MPEG-1\r\n"); break; case 0x6C: strcat(info, "JPEG\r\n"); break; case 0x6D: strcat(info, "PNG\r\n"); break; case 0x80: memcpy(code, esd->decoderConfig->decoderSpecificInfo->data, 4); code[4] = 0; sprintf(buf, "GPAC Intern (%s)\r\n", code); strcat(info, buf); break; default: sprintf(buf, "Private/Unknown (0x%x)\r\n", esd->decoderConfig->objectTypeIndication); strcat(info, buf); break; } break; case GF_STREAM_AUDIO: is_media = 1; strcat(info, "Audio Stream - media type: "); switch (esd->decoderConfig->objectTypeIndication) { case 0x40: strcat(info, "MPEG-4\r\n"); break; case 0x66: strcat(info, "MPEG-2 AAC Main Profile\r\n"); break; case 0x67: strcat(info, "MPEG-2 AAC LowComplexity Profile\r\n"); break; case 0x68: strcat(info, "MPEG-2 AAC Scalable Sampling Rate Profile\r\n"); break; case 0x69: strcat(info, "MPEG-2 Audio\r\n"); break; case 0x6B: strcat(info, "MPEG-1 Audio\r\n"); break; case 0xA0: strcat(info, "EVRC Audio\r\n"); break; case 0xA1: strcat(info, "SMV Audio\r\n"); break; case 0xE1: strcat(info, "QCELP Audio\r\n"); break; case 0x80: memcpy(code, esd->decoderConfig->decoderSpecificInfo->data, 4); code[4] = 0; sprintf(buf, "GPAC Intern (%s)\r\n", code); strcat(info, buf); break; default: sprintf(buf, "Private/Unknown (0x%x)\r\n", esd->decoderConfig->objectTypeIndication); strcat(info, buf); break; } break; case GF_STREAM_MPEG7: sprintf(buf, "MPEG-7 Stream - version %d\r\n", esd->decoderConfig->objectTypeIndication); strcat(info, buf); break; case GF_STREAM_IPMP: sprintf(buf, "IPMP Stream - version %d\r\n", esd->decoderConfig->objectTypeIndication); strcat(info, buf); break; case GF_STREAM_OCI: sprintf(buf, "OCI Stream - version %d\r\n", esd->decoderConfig->objectTypeIndication); strcat(info, buf); break; case GF_STREAM_MPEGJ: sprintf(buf, "MPEGJ Stream - version %d\r\n", esd->decoderConfig->objectTypeIndication); strcat(info, buf); break; case GF_STREAM_INTERACT: sprintf(buf, "User Interaction Stream - version %d\r\n", esd->decoderConfig->objectTypeIndication); strcat(info, buf); break; case GF_STREAM_TEXT: sprintf(buf, "3GPP/MPEG-4 Timed Text - version %d\r\n", esd->decoderConfig->objectTypeIndication); strcat(info, buf); break; default: sprintf(buf, "Private/Unknown (StreamType 0x%x OTI 0x%x)\r\n", esd->decoderConfig->streamType, esd->decoderConfig->objectTypeIndication); strcat(info, buf); break; } sprintf(buf, "Buffer Size %d\r\nAverage Bitrate %d bps\r\nMaximum Bitrate %d bps\r\n", esd->decoderConfig->bufferSizeDB, esd->decoderConfig->avgBitrate, esd->decoderConfig->maxBitrate); strcat(info, buf); if (esd->slConfig->predefined==SLPredef_SkipSL) { sprintf(buf, "Not using MPEG-4 Synchronization Layer\r\n"); } else { sprintf(buf, "Stream Clock Resolution %d\r\n", esd->slConfig->timestampResolution); } strcat(info, buf); if (esd->URLString) { sprintf(buf, "Stream Location: %s\r\n", esd->URLString); strcat(info, buf); } /*check language*/ if (esd->langDesc) { u32 i=0; char lan[4], *szLang; lan[0] = esd->langDesc->langCode>>16; lan[1] = (esd->langDesc->langCode>>8)&0xFF; lan[2] = (esd->langDesc->langCode)&0xFF; lan[3] = 0; if ((lan[0]=='u') && (lan[1]=='n') && (lan[2]=='d')) szLang = "Undetermined"; else { szLang = lan; while (GF_ISO639_Lang[i]) { if (GF_ISO639_Lang[i+2][0] && strstr(GF_ISO639_Lang[i+1], lan)) { szLang = (char*) GF_ISO639_Lang[i]; break; } i+=3; } } sprintf(buf, "Stream Language: %s\r\n", szLang); strcat(info, buf); } strcat(info, "\r\n"); } m_ODInfo.SetWindowText(info);}void CFileProps::SetNetworkInfo(){ char info[10000]; char buf[10000]; u32 id; NetStatCommand com; ODInfo odi; u32 d_enum, nb_streams; GF_Err e; GF_ObjectManager *odm; WinGPAC *gpac = GetApp(); odm = current_odm; strcpy(info, ""); m_ODInfo.SetWindowText(""); if (!odm || gf_term_get_object_info(gpac->m_term, odm, &odi) != GF_OK) return; if (!odi.od) return; if (odi.owns_service) { const char *url, *path; u32 done, total, bps; strcpy(info, "Current Downloads in service:\r\n"); d_enum = 0; while (gf_term_get_download_info(gpac->m_term, odm, &d_enum, &url, &path, &done, &total, &bps)) { if (total && done) { sprintf(buf, "%s %s: %d / %d bytes (%.2f %%) - %.2f kBps\r\n", url, path, done, total, (100.0f*done)/total, ((Float)bps)/1024); } else { sprintf(buf, "%s %s: %.2f kbps\r\n", url, path, ((Float)bps*8)/1024); } strcat(info, buf); } if (!d_enum) strcpy(info, "No Downloads in service\r\n"); strcat(info, "\r\n"); } d_enum = 0; nb_streams = 0; while (gf_term_get_channel_net_info(gpac->m_term, odm, &d_enum, &id, &com, &e)) { if (e) continue; if (!com.bw_down && !com.bw_up) continue; nb_streams ++; sprintf(buf, "Stream ID %d statistics:\r\n", id); strcat(info, buf); if (com.multiplex_port) { sprintf(buf, "\tMultiplex Port %d - multiplex ID %d\r\n", com.multiplex_port, com.port); } else { sprintf(buf, "\tPort %d\r\n", com.port); } strcat(info, buf); sprintf(buf, "\tPacket Loss Percentage: %.4f\r\n", com.pck_loss_percentage); strcat(info, buf); sprintf(buf, "\tDown Bandwidth: %.3f kbps\r\n", ((Float)com.bw_down) / 1024); strcat(info, buf); if (com.bw_up) { sprintf(buf, "\tUp Bandwidth: %d bps\r\n", com.bw_up); strcat(info, buf); } if (com.ctrl_port) { if (com.multiplex_port) { sprintf(buf, "\tControl Multiplex Port: %d - Control Multiplex ID %d\r\n", com.multiplex_port, com.ctrl_port); } else { sprintf(buf, "\tControl Port: %d\r\n", com.ctrl_port); } strcat(info, buf); sprintf(buf, "\tControl Down Bandwidth: %d bps\r\n", com.ctrl_bw_down); strcat(info, buf); sprintf(buf, "\tControl Up Bandwidth: %d bps\r\n", com.ctrl_bw_up); strcat(info, buf); } strcat(info, "\r\n"); } if (!nb_streams) strcat(info, "No network streams in this object\r\n"); m_ODInfo.SetWindowText(info);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -