~ubuntu-branches/debian/experimental/gpac/experimental

« back to all changes in this revision

Viewing changes to applications/osmo4_wx/fileprops.cpp

  • Committer: Package Import Robot
  • Author(s): Alessio Treglia
  • Date: 2012-02-11 17:35:15 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120211173515-ubgyi9lbbnnxb6ax
Tags: 0.4.5+svn3462~dfsg0-1
* Merge upstream SVN snapshot svn3462:
  - DASH: SPTS don't need '-dash-ts-prog' option (+doc added)
  - support in the player for BaseURL as source as specified in
    latest draft and generated by MP4Box
  - Fixed bug in edit list rewrite when concatenating
  - Added simple osd module for perf monitoring (cpu/mem/fps)
  - Fixed some crashes when destroying objects/services before their
    creation is completed (stress mode)
  - Fixed event firing for secondary scenes and
    exported createVRMLfromString
  - Only notify fractionChanged when it actually changes
  - Commented full AAC file scan for duration
  - Made DX module store its YUV config (speeds up startup)
  - Added option to avoid unloading modules
  - use gf_esd_get_textual_description() instead of (incomplete) switches
  - Fixed UPnP detection and removed extension loading
* Drop xulrunner-dev, gpac doesn't build against it.
* Revise repackaging and debian/rules' get-orig-source target.
* Refresh patches.
* Configure with --enable-debug.
* Add -O2 to CFLAGS, use -O0 when optimizations are disabled.
* Implement DEB_BUILD_OPTIONS' noopt flag.
* Install modules in multiarch path.
* Split gpac and install modules into new gpac-modules-base package.
* Add -DBG packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *                      GPAC - Multimedia Framework C SDK
3
 
 *
4
 
 *                      Copyright (c) Jean Le Feuvre 2000-2005
5
 
 *                                      All rights reserved
6
 
 *
7
 
 *  This file is part of GPAC / Osmo4 wxWidgets GUI
8
 
 *
9
 
 *  GPAC is free software; you can redistribute it and/or modify
10
 
 *  it under the terms of the GNU Lesser General Public License as published by
11
 
 *  the Free Software Foundation; either version 2, or (at your option)
12
 
 *  any later version.
13
 
 *   
14
 
 *  GPAC is distributed in the hope that it will be useful,
15
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 
 *  GNU Lesser General Public License for more details.
18
 
 *   
19
 
 *  You should have received a copy of the GNU Lesser General Public
20
 
 *  License along with this library; see the file COPYING.  If not, write to
21
 
 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
22
 
 *
23
 
 *              
24
 
 */
25
 
 
26
 
#include "fileprops.h"
27
 
#include "wxOsmo4.h"
28
 
#include "Playlist.h"
29
 
#include <wx/filename.h>
30
 
#include <gpac/modules/codec.h>
31
 
#include <gpac/modules/service.h>
32
 
#include <gpac/constants.h>
33
 
/*ISO 639 languages*/
34
 
#include <gpac/iso639.h>
35
 
 
36
 
 
37
 
wxFileProps::wxFileProps(wxWindow *parent)
38
 
             : wxDialog(parent, -1, wxString(_T("File Properties")))
39
 
{
40
 
 
41
 
        m_pApp = (wxOsmo4Frame *)parent;
42
 
        SetSize(540, 260);
43
 
        assert(m_pApp->m_pPlayList);
44
 
 
45
 
        m_pTreeView = new wxTreeCtrl(this, ID_TREE_VIEW, wxPoint(4, 2), wxSize(200, 180), wxTR_DEFAULT_STYLE | wxSUNKEN_BORDER);
46
 
        
47
 
        new wxStaticText(this, 0, _T("Information"), wxPoint(210, 2), wxSize(60, 20));
48
 
    m_pViewSel = new wxComboBox(this, ID_VIEW_SEL, _T(""), wxPoint(280, 2), wxSize(120, 24), 0, NULL, wxCB_READONLY);
49
 
        m_pViewSel->Append(wxT("General"));
50
 
        m_pViewSel->Append(wxT("Streams"));
51
 
        m_pViewSel->Append(wxT("Playback"));
52
 
        m_pViewSel->Append(wxT("Network"));
53
 
        m_pViewSel->SetSelection(0);
54
 
 
55
 
    m_pViewInfo = new wxTextCtrl(this, -1, wxT(""), wxPoint(210, 30), wxSize(320, 200), wxTE_MULTILINE | wxTE_READONLY | wxHSCROLL | wxSUNKEN_BORDER);
56
 
 
57
 
#ifdef WIN32
58
 
        m_pViewInfo->SetBackgroundColour(wxColour(wxT("LIGHT GREY")));
59
 
#endif
60
 
 
61
 
        m_pViewWI = new wxButton(this, ID_VIEW_WI, wxT("View World Info"), wxPoint(4, 174), wxSize(200, 40));
62
 
        m_pViewSG = new wxButton(this, ID_VIEW_SG, wxT("View Scene Graph"), wxPoint(4, 220), wxSize(200, 40));
63
 
 
64
 
 
65
 
        wxString str = m_pApp->m_pPlayList->GetDisplayName();
66
 
        str += wxT(" Properties");
67
 
        SetTitle(str);
68
 
 
69
 
        m_pTimer = new wxTimer();
70
 
        m_pTimer->SetOwner(this, ID_OD_TIMER);
71
 
        m_pTimer->Start(500, 0);
72
 
        RewriteODTree();
73
 
 
74
 
}
75
 
 
76
 
wxFileProps::~wxFileProps()
77
 
{
78
 
        m_pTimer->Stop();
79
 
        delete m_pTimer;
80
 
}
81
 
 
82
 
 
83
 
BEGIN_EVENT_TABLE(wxFileProps, wxDialog)
84
 
        EVT_TREE_ITEM_ACTIVATED(ID_TREE_VIEW, wxFileProps::OnSetSelection)
85
 
        EVT_TREE_SEL_CHANGED(ID_TREE_VIEW, wxFileProps::OnSetSelection)
86
 
        EVT_TREE_ITEM_EXPANDED(ID_TREE_VIEW, wxFileProps::OnSetSelection)
87
 
        EVT_TREE_ITEM_COLLAPSED(ID_TREE_VIEW, wxFileProps::OnSetSelection)
88
 
        EVT_TIMER(ID_OD_TIMER, wxFileProps::OnTimer)
89
 
        EVT_BUTTON(ID_VIEW_SG, wxFileProps::OnViewSG)
90
 
        EVT_BUTTON(ID_VIEW_WI, wxFileProps::OnViewWorld)
91
 
        EVT_COMBOBOX(ID_VIEW_SEL, wxFileProps::OnSelectInfo)
92
 
END_EVENT_TABLE()
93
 
 
94
 
void wxFileProps::RewriteODTree()
95
 
{
96
 
        GF_ObjectManager *root_odm = gf_term_get_root_object(m_pApp->m_term);
97
 
        if (!root_odm) return;
98
 
 
99
 
        m_pTreeView->DeleteAllItems();
100
 
        ODTreeData *root = new ODTreeData(root_odm);
101
 
        m_pTreeView->AddRoot(wxT("Root OD"), -1, -1, root);
102
 
        wxTreeItemId rootId = m_pTreeView->GetRootItem();
103
 
 
104
 
        WriteInlineTree(root);
105
 
        SetInfo(root_odm);
106
 
}
107
 
 
108
 
void wxFileProps::WriteInlineTree(ODTreeData *root)
109
 
{
110
 
        /*browse all ODs*/
111
 
        u32 count = gf_term_get_object_count(m_pApp->m_term, root->m_pODMan);
112
 
 
113
 
        for (u32 i=0; i<count; i++) {
114
 
                GF_ObjectManager *odm = gf_term_get_object(m_pApp->m_term, root->m_pODMan, i);
115
 
                if (!odm) return;
116
 
                ODTreeData *odd = new ODTreeData(odm);
117
 
                m_pTreeView->AppendItem(root->GetId(), wxT("Object Descriptor"), -1, -1, odd);
118
 
 
119
 
                /*if inline propagate*/
120
 
                switch (gf_term_object_subscene_type(m_pApp->m_term, odm)) {
121
 
                case 1:
122
 
                        m_pTreeView->SetItemText(odd->GetId(), wxT("Root Scene"));
123
 
                        WriteInlineTree(odd);
124
 
                        break;
125
 
                case 2:
126
 
                        m_pTreeView->SetItemText(odd->GetId(), wxT("Inline Scene"));
127
 
                        WriteInlineTree(odd);
128
 
                        break;
129
 
                case 3:
130
 
                        m_pTreeView->SetItemText(odd->GetId(), wxT("Extern Proto Lib"));
131
 
                        break;
132
 
                default:
133
 
                        break;
134
 
                }
135
 
        }
136
 
}
137
 
 
138
 
void wxFileProps::OnSetSelection(wxTreeEvent& event)
139
 
{
140
 
        ODTreeData *odd = (ODTreeData *) m_pTreeView->GetItemData(event.GetItem());
141
 
        SetInfo(odd->m_pODMan);
142
 
}
143
 
 
144
 
void wxFileProps::SetInfo(GF_ObjectManager *odm)
145
 
{
146
 
        m_current_odm = odm;
147
 
 
148
 
        switch (m_pViewSel->GetSelection()) {
149
 
        case 3: SetNetworkInfo(); break;
150
 
        case 2: SetDecoderInfo(); break;
151
 
        case 1: SetStreamsInfo(); break;
152
 
        default: SetGeneralInfo(); break;
153
 
        }
154
 
}
155
 
 
156
 
void wxFileProps::OnTimer(wxTimerEvent& WXUNUSED(event))
157
 
{
158
 
        switch (m_pViewSel->GetSelection()) {
159
 
        case 2: SetDecoderInfo(); break;
160
 
        }
161
 
}
162
 
void wxFileProps::OnSelectInfo(wxCommandEvent & WXUNUSED(event) )
163
 
{
164
 
        SetInfo(m_current_odm);
165
 
}
166
 
 
167
 
void wxFileProps::SetGeneralInfo()
168
 
{
169
 
        wxString info;
170
 
        GF_MediaInfo odi;
171
 
        u32 h, m, s;
172
 
        u32 i, j;
173
 
 
174
 
        info = wxT("");
175
 
        m_pViewInfo->Clear();
176
 
        m_pViewInfo->AppendText(info);
177
 
 
178
 
        if (!m_current_odm || gf_term_get_object_info(m_pApp->m_term, m_current_odm, &odi) != GF_OK) return;
179
 
 
180
 
        if (odi.has_profiles) info += wxT("Initial ");
181
 
        info += wxString::Format(wxT("Object Descriptor ID %d\n"), odi.od->objectDescriptorID);
182
 
        if (odi.duration) {
183
 
                h = (u32) (odi.duration / 3600);
184
 
                m = (u32) (odi.duration / 60) - h*60;
185
 
                s = (u32) (odi.duration) - h*3600 - m*60;
186
 
                info += wxString::Format(wxT("Duration %02d:%02d:%02d\n"), h, m, s);
187
 
        } else {
188
 
                info += wxT("Unknown duration\n");
189
 
        }
190
 
 
191
 
        if (odi.owns_service) {
192
 
                info += wxT("Service Handler: ") + wxString(odi.service_handler, wxConvUTF8) + wxT("\n");
193
 
                info += wxT("Service URL: ") + wxString(odi.service_url, wxConvUTF8) + wxT("\n");
194
 
        }
195
 
        
196
 
        if (odi.od->URLString) {
197
 
                info += wxT("Remote OD - URL: ") + wxString(odi.od->URLString, wxConvUTF8) + wxT("\n");
198
 
        } 
199
 
 
200
 
        if (odi.codec_name) {
201
 
                switch (odi.od_type) {
202
 
                case GF_STREAM_VISUAL:
203
 
                        info += wxString::Format(wxT("Video Object: Width %d - Height %d\n"), odi.width, odi.height);
204
 
                        info += wxT("Media Codec ") + wxString(odi.codec_name, wxConvUTF8) + wxT("\n");
205
 
                        break;
206
 
                case GF_STREAM_AUDIO:
207
 
                        info += wxString::Format(wxT("Audio Object: Sample Rate %d - %d channels\n"), odi.sample_rate, odi.num_channels);
208
 
                        info += wxT("Media Codec ") + wxString(odi.codec_name, wxConvUTF8) + wxT("\n");
209
 
                        break;
210
 
                case GF_STREAM_PRIVATE_SCENE:
211
 
                case GF_STREAM_SCENE:
212
 
                        if (odi.width && odi.height) {
213
 
                                info += wxString::Format(wxT("Scene Description: Width %d - Height %d\n"), odi.width, odi.height);
214
 
                        } else {
215
 
                                info += wxT("Scene Description: No size specified\n");
216
 
                        }
217
 
                        info += wxT("Scene Codec ") + wxString(odi.codec_name, wxConvUTF8) + wxT("\n");
218
 
                        break;
219
 
                case GF_STREAM_TEXT:
220
 
                        if (odi.width && odi.height) {
221
 
                                info += wxString::Format(wxT("Text Object: Width %d - Height %d\n"), odi.width, odi.height);
222
 
                        } else {
223
 
                                info += wxString::Format(wxT("Text Object: No size specified\n"));
224
 
                        }
225
 
                        info += wxT("Text Codec ") + wxString(odi.codec_name, wxConvUTF8) + wxT("\n");
226
 
                        break;
227
 
                }
228
 
        }
229
 
        if (odi.protection==2) info += wxT("Encrypted Media NOT UNLOCKED"); 
230
 
        else if (odi.protection==1) info += wxT("Encrypted Media"); 
231
 
 
232
 
        if (!gf_list_count(odi.od->OCIDescriptors)) {
233
 
                m_pViewInfo->Clear();
234
 
                m_pViewInfo->AppendText(info);
235
 
                return;
236
 
        }
237
 
 
238
 
        info += wxT("\nObject Content Information:\n");
239
 
 
240
 
        /*check OCI (not everything interests us) - FIXME: support for unicode*/
241
 
        for (i=0; i<gf_list_count(odi.od->OCIDescriptors); i++) {
242
 
                GF_Descriptor *desc = (GF_Descriptor *) gf_list_get(odi.od->OCIDescriptors, i);
243
 
                switch (desc->tag) {
244
 
                case GF_ODF_SEGMENT_TAG:
245
 
                {
246
 
                        GF_Segment *sd = (GF_Segment *) desc;
247
 
                        info += wxT("\nSegment Descriptor:\nName: ") + wxString((char *) sd->SegmentName, wxConvUTF8);
248
 
                        info += wxString::Format(wxT(" - start time %g sec - duration %g sec\n"), sd->startTime, sd->Duration);
249
 
                }
250
 
                        break;
251
 
                case GF_ODF_CC_NAME_TAG:
252
 
                {
253
 
                        GF_CC_Name *ccn = (GF_CC_Name *)desc;
254
 
                        info += wxT("\nContent Creators:\n");
255
 
                        for (j=0; j<gf_list_count(ccn->ContentCreators); j++) {
256
 
                                GF_ContentCreatorInfo *ci = (GF_ContentCreatorInfo *) gf_list_get(ccn->ContentCreators, j);
257
 
                                if (!ci->isUTF8) continue;
258
 
                                info += wxT("\t") + wxString(ci->contentCreatorName, wxConvUTF8) + wxT("\n");
259
 
                        }
260
 
                }
261
 
                        break;
262
 
 
263
 
                case GF_ODF_SHORT_TEXT_TAG:
264
 
                        {
265
 
                                GF_ShortTextual *std = (GF_ShortTextual *)desc;
266
 
                                info += wxT("\n") + wxString(std->eventName, wxConvUTF8) + wxT(": ") + wxString(std->eventText, wxConvUTF8) + wxT("\n");
267
 
                        }
268
 
                        break;
269
 
                /*todo*/
270
 
                case GF_ODF_CC_DATE_TAG:
271
 
                        break;
272
 
                default:
273
 
                        break;
274
 
                }
275
 
 
276
 
        }
277
 
 
278
 
        m_pViewInfo->Clear();
279
 
        m_pViewInfo->AppendText(info);
280
 
}
281
 
 
282
 
void wxFileProps::SetStreamsInfo()
283
 
{
284
 
        u32 i, count;
285
 
        wxString info;
286
 
        GF_MediaInfo odi;
287
 
        char code[5];
288
 
 
289
 
        info = wxT("");
290
 
        m_pViewInfo->Clear();
291
 
        m_pViewInfo->AppendText(info);
292
 
 
293
 
        if (!m_current_odm || gf_term_get_object_info(m_pApp->m_term, m_current_odm, &odi) != GF_OK) return;
294
 
 
295
 
        if (odi.has_profiles) {
296
 
                info += wxString::Format(wxT("\tOD Profile@Level %d\n"), odi.OD_pl);
297
 
                info += wxString::Format(wxT("\tScene Profile@Level %d\n"), odi.scene_pl);
298
 
                info += wxString::Format(wxT("\tGraphics Profile@Level %d\n"), odi.graphics_pl);
299
 
                info += wxString::Format(wxT("\tAudio Profile@Level %d\n"), odi.audio_pl);
300
 
                info += wxString::Format(wxT("\tVisual Profile@Level %d\n"), odi.scene_pl);
301
 
                if (odi.inline_pl) info += wxT("\tInline Content use same profiles\n");
302
 
                info += wxT("\n");
303
 
        }
304
 
 
305
 
        count = gf_list_count(odi.od->ESDescriptors);
306
 
 
307
 
        for (i=0; i<count; i++) {
308
 
                GF_ESD *esd = (GF_ESD *) gf_list_get(odi.od->ESDescriptors, i);
309
 
                
310
 
                info += wxString::Format(wxT("Stream ID %d - Clock ID %d\n"), esd->ESID, esd->OCRESID);
311
 
                if (esd->dependsOnESID) {
312
 
                        info += wxString::Format(wxT("\tDepends on Stream ID %d for decoding\n"), esd->dependsOnESID);
313
 
                }
314
 
                switch (esd->decoderConfig->streamType) {
315
 
                case GF_STREAM_OD:
316
 
                        info += wxString::Format(wxT("\tOD Stream - version %d\n"), esd->decoderConfig->objectTypeIndication);
317
 
                        break;
318
 
                case GF_STREAM_OCR:
319
 
                        info += wxT("\tObject Clock Reference Stream\n");
320
 
                        break;
321
 
                case GF_STREAM_SCENE:
322
 
                        info += wxString::Format(wxT("\tScene Description Stream - version %d\n"), esd->decoderConfig->objectTypeIndication);
323
 
                        break;
324
 
                case GF_STREAM_PRIVATE_SCENE:
325
 
                        info += wxString::Format(wxT("\tGPAC Private Scene Description Stream\n"));
326
 
                        break;
327
 
                case GF_STREAM_VISUAL:
328
 
                        info += wxT("\tVisual Stream - media type: ");
329
 
                        switch (esd->decoderConfig->objectTypeIndication) {
330
 
                        case GPAC_OTI_VIDEO_MPEG4_PART2: info += wxT("MPEG-4\n"); break;
331
 
                        case GPAC_OTI_VIDEO_MPEG2_SIMPLE: info += wxT("MPEG-2 Simple Profile\n"); break;
332
 
                        case GPAC_OTI_VIDEO_MPEG2_MAIN: info += wxT("MPEG-2 Main Profile\n"); break;
333
 
                        case GPAC_OTI_VIDEO_MPEG2_SNR: info += wxT("MPEG-2 SNR Profile\n"); break;
334
 
                        case GPAC_OTI_VIDEO_MPEG2_SPATIAL: info += wxT("MPEG-2 Spatial Profile\n"); break;
335
 
                        case GPAC_OTI_VIDEO_MPEG2_HIGH: info += wxT("MPEG-2 High Profile\n"); break;
336
 
                        case GPAC_OTI_VIDEO_MPEG2_422: info += wxT("MPEG-2 422 Profile\n"); break;
337
 
                        case GPAC_OTI_VIDEO_MPEG1: info += wxT("MPEG-1\n"); break;
338
 
                        case GPAC_OTI_IMAGE_JPEG: info += wxT("JPEG\n"); break;
339
 
                        case GPAC_OTI_IMAGE_PNG: info += wxT("PNG\n"); break;
340
 
                        case GPAC_OTI_IMAGE_JPEG_2000: info += wxT("JPEG2000\n"); break;
341
 
                        case 0x80:
342
 
                                memcpy(code, esd->decoderConfig->decoderSpecificInfo->data, 4);
343
 
                                code[4] = 0;
344
 
                                info += wxT("GPAC Intern (") + wxString(code, wxConvUTF8) + wxT(")\n");
345
 
                                break;
346
 
                        default: 
347
 
                                info += wxString::Format(wxT("Private/Unknown Type (0x%x)\n"), esd->decoderConfig->objectTypeIndication); 
348
 
                                break;
349
 
                        }
350
 
                        break;
351
 
 
352
 
                case GF_STREAM_AUDIO:
353
 
                        info += wxT("\tAudio Stream - media type: ");
354
 
                        switch (esd->decoderConfig->objectTypeIndication) {
355
 
                        case GPAC_OTI_AUDIO_AAC_MPEG4: info += wxT("MPEG-4\n"); break;
356
 
                        case GPAC_OTI_AUDIO_AAC_MPEG2_MP: info += wxT("MPEG-2 AAC Main Profile\n"); break;
357
 
                        case GPAC_OTI_AUDIO_AAC_MPEG2_LCP: info += wxT("MPEG-2 AAC LowComplexity Profile\n"); break;
358
 
                        case GPAC_OTI_AUDIO_AAC_MPEG2_SSRP: info += wxT("MPEG-2 AAC Scalable Sampling Rate Profile\n"); break;
359
 
                        case GPAC_OTI_AUDIO_MPEG2_PART3: info += wxT("MPEG-2 Audio\n"); break;
360
 
                        case GPAC_OTI_AUDIO_MPEG1: info += wxT("MPEG-1 Audio\n"); break;
361
 
                        case 0xA0: info += wxT("EVRC Audio\n"); break;
362
 
                        case 0xA1: info += wxT("SMV Audio\n"); break;
363
 
                        case 0xE1: info += wxT("QCELP Audio\n"); break;
364
 
                        case 0x80:
365
 
                                memcpy(code, esd->decoderConfig->decoderSpecificInfo->data, 4);
366
 
                                code[4] = 0;
367
 
                                info += wxT("GPAC Intern (") + wxString(code, wxConvUTF8) + wxT(")\n");
368
 
                                break;
369
 
                        default: 
370
 
                                info += wxString::Format(wxT("Private/Unknown Type (0x%x)\n"), esd->decoderConfig->objectTypeIndication); 
371
 
                                break;
372
 
                        }
373
 
                        break;
374
 
                case GF_STREAM_MPEG7:
375
 
                        info += wxString::Format(wxT("\tMPEG-7 Stream - version %d\n"), esd->decoderConfig->objectTypeIndication);
376
 
                        break;
377
 
                case GF_STREAM_IPMP:
378
 
                        info += wxString::Format(wxT("\tIPMP Stream - version %d\n"), esd->decoderConfig->objectTypeIndication);
379
 
                        break;
380
 
                case GF_STREAM_OCI:
381
 
                        info += wxString::Format(wxT("\tOCI Stream - version %d\n"), esd->decoderConfig->objectTypeIndication);
382
 
                        break;
383
 
                case GF_STREAM_MPEGJ:
384
 
                        info += wxString::Format(wxT("\tMPEGJ Stream - version %d\n"), esd->decoderConfig->objectTypeIndication);
385
 
                        break;
386
 
                case GF_STREAM_INTERACT:
387
 
                        info += wxString::Format(wxT("\tUser Interaction Stream - version %d\n"), esd->decoderConfig->objectTypeIndication);
388
 
                        break;
389
 
                default:
390
 
                        info += wxT("Private/Unknown\n");
391
 
                        break;
392
 
                }
393
 
 
394
 
                info += wxString::Format(wxT("\tBuffer Size %d\n\tAverage Bitrate %d bps\n\tMaximum Bitrate %d bps\n"), esd->decoderConfig->bufferSizeDB, esd->decoderConfig->avgBitrate, esd->decoderConfig->maxBitrate);
395
 
                if (esd->slConfig->predefined==SLPredef_SkipSL) {
396
 
                        info += wxString::Format(wxT("\tNot using MPEG-4 Synchronization Layer\n"));
397
 
                } else {
398
 
                        info += wxString::Format(wxT("\tStream Clock Resolution %d\n"), esd->slConfig->timestampResolution);
399
 
                }
400
 
                if (esd->URLString) 
401
 
                        info += wxT("\tStream Location: ") + wxString(esd->URLString, wxConvUTF8) + wxT("\n");
402
 
 
403
 
                /*check language*/
404
 
                if (esd->langDesc) {
405
 
                        u32 i=0;
406
 
                        char lan[4], *szLang;
407
 
                        lan[0] = esd->langDesc->langCode>>16;
408
 
                        lan[1] = (esd->langDesc->langCode>>8)&0xFF;
409
 
                        lan[2] = (esd->langDesc->langCode)&0xFF;
410
 
                        lan[3] = 0;
411
 
 
412
 
                        if ((lan[0]=='u') && (lan[1]=='n') && (lan[2]=='d')) szLang = (char*) "Undetermined";
413
 
                        else {
414
 
                                szLang = lan;
415
 
                                while (GF_ISO639_Lang[i]) {
416
 
                                        if (GF_ISO639_Lang[i+2][0] && strstr(GF_ISO639_Lang[i+1], lan)) {
417
 
                                                szLang = (char*) GF_ISO639_Lang[i];
418
 
                                                break;
419
 
                                        }
420
 
                                        i+=3;
421
 
                                }
422
 
                        }
423
 
                        info += wxString::Format(wxT("\tStream Language: %s\n"), szLang);
424
 
                }
425
 
 
426
 
        }
427
 
        m_pViewInfo->Clear();
428
 
        m_pViewInfo->AppendText(info);
429
 
}
430
 
 
431
 
 
432
 
void wxFileProps::SetDecoderInfo()
433
 
{
434
 
        GF_MediaInfo odi;
435
 
        wxString info;
436
 
        u32 h, m, s;
437
 
 
438
 
        if (!m_current_odm || gf_term_get_object_info(m_pApp->m_term, m_current_odm, &odi)) {
439
 
          m_pViewInfo->Clear();
440
 
          m_pViewInfo->AppendText(info);
441
 
          return;
442
 
        }
443
 
 
444
 
        info = wxT("Status: ");
445
 
        switch (odi.status) {
446
 
        case 0:
447
 
        case 1:
448
 
        case 2:
449
 
                h = (u32) (odi.current_time / 3600);
450
 
                m = (u32) (odi.current_time / 60) - h*60;
451
 
                s = (u32) (odi.current_time) - h*3600 - m*60;
452
 
                if (odi.status==0) info += wxT("Stopped");
453
 
                else if (odi.status==1) info += wxT("Playing");
454
 
                else info += wxT("Paused");
455
 
                info += wxString::Format(wxT("\nObject Time: %02d:%02d:%02d\n"), h, m, s);
456
 
                break;
457
 
        case 3:
458
 
                info += wxT("Not Setup\n");
459
 
                m_pViewInfo->Clear();
460
 
                m_pViewInfo->AppendText(info);
461
 
                return;
462
 
        default:
463
 
                info += wxT("Setup Failed\n");
464
 
                m_pViewInfo->Clear();
465
 
                m_pViewInfo->AppendText(info);
466
 
                return;
467
 
        }
468
 
        /*get clock drift*/
469
 
        info += wxString::Format(wxT("Clock drift: %d ms\n"), odi.clock_drift);
470
 
        /*get buffering*/
471
 
        if (odi.buffer>=0) info += wxString::Format(wxT("Buffering Time: %d ms\n"), odi.buffer);
472
 
        else if (odi.buffer==-1) info += wxT("Not buffering\n");
473
 
        else info += wxT("Not Playing\n");
474
 
 
475
 
        /*get DB occupation*/
476
 
        if (odi.buffer>=0) info += wxString::Format(wxT("Decoding Buffer: %d Access Units\n"), odi.db_unit_count);
477
 
        /*get CB occupation*/
478
 
        if (odi.cb_max_count) 
479
 
                info += wxString::Format(wxT("Composition Memory: %d/%d Units\n"), odi.cb_unit_count, odi.cb_max_count);
480
 
 
481
 
        Float avg_dec_time = 0;
482
 
        if (odi.nb_dec_frames) {
483
 
                avg_dec_time = (Float) odi.total_dec_time; 
484
 
                avg_dec_time /= odi.nb_dec_frames; 
485
 
        }
486
 
        info += wxString::Format(wxT("Average Bitrate %d kbps (%d max)\nAverage Decoding Time %.2f ms (%d max)\nTotal decoded frames %d - %d dropped\n"),
487
 
                                                                (u32) odi.avg_bitrate/1024, odi.max_bitrate/1024, avg_dec_time, odi.max_dec_time, odi.nb_dec_frames, odi.nb_droped);
488
 
 
489
 
        m_pViewInfo->Clear();
490
 
        m_pViewInfo->AppendText(info);
491
 
}
492
 
 
493
 
void wxFileProps::SetNetworkInfo()
494
 
{
495
 
        wxString info;
496
 
        u32 id;
497
 
        NetStatCommand com;
498
 
        GF_MediaInfo odi;
499
 
        u32 d_enum;
500
 
        GF_Err e;
501
 
 
502
 
        info = wxT("");
503
 
        m_pViewInfo->Clear();
504
 
        m_pViewInfo->AppendText(wxT(""));
505
 
 
506
 
        if (!m_current_odm || gf_term_get_object_info(m_pApp->m_term, m_current_odm, &odi) != GF_OK) return;
507
 
 
508
 
        if (odi.owns_service) {
509
 
                const char *url, *path;
510
 
                u32 done, total, bps;
511
 
                info = wxT("Current Downloads in service:\n");
512
 
                d_enum = 0;
513
 
                while (gf_term_get_download_info(m_pApp->m_term, m_current_odm, &d_enum, &url, &path, &done, &total, &bps)) {
514
 
                        info += wxString(url, wxConvUTF8);
515
 
                        if (total) {
516
 
                                info += wxString::Format(wxT(": %d / %d bytes (%.2f %%) - %.2f kBps\n"), done, total, (100.0*done)/total, ((Double)bps)/1024);
517
 
                        } else {
518
 
                                info += wxString::Format(wxT(": %.2f kBps\n"), ((Double)bps)/1024);
519
 
                        }
520
 
                }
521
 
                if (!d_enum) info = wxT("No Downloads in service\n");
522
 
                info += wxT("\n");
523
 
        }
524
 
 
525
 
        d_enum = 0;
526
 
        while (gf_term_get_channel_net_info(m_pApp->m_term, m_current_odm, &d_enum, &id, &com, &e)) {
527
 
                if (e) continue;
528
 
                if (!com.bw_down && !com.bw_up) continue;
529
 
 
530
 
                info += wxString::Format(wxT("Stream ID %d statistics:\n"), id);
531
 
                if (com.multiplex_port) {
532
 
                        info += wxString::Format(wxT("\tMultiplex Port %d - multiplex ID %d\n"), com.multiplex_port, com.port);
533
 
                } else {
534
 
                        info += wxString::Format(wxT("\tPort %d\n"), com.port);
535
 
                }
536
 
                info += wxString::Format(wxT("\tPacket Loss Percentage: %.4f\n"), com.pck_loss_percentage);
537
 
                info += wxString::Format(wxT("\tDown Bandwidth: %.3f bps\n"), ((Float)com.bw_down)/1024);
538
 
                if (com.bw_up) info += wxString::Format(wxT("\tUp Bandwidth: %d bps\n"), com.bw_up);
539
 
                if (com.ctrl_port) {
540
 
                        if (com.multiplex_port) {
541
 
                                info += wxString::Format(wxT("\tControl Multiplex Port: %d - Control Multiplex ID %d\n"), com.multiplex_port, com.ctrl_port);
542
 
                        } else {
543
 
                                info += wxString::Format(wxT("\tControl Port: %d\n"), com.ctrl_port);
544
 
                        }
545
 
                        info += wxString::Format(wxT("\tControl Down Bandwidth: %d bps\n"), com.ctrl_bw_down);
546
 
                        info += wxString::Format(wxT("\tControl Up Bandwidth: %d bps\n"), com.ctrl_bw_up);
547
 
                }
548
 
                info += wxT("\n");
549
 
        }
550
 
        m_pViewInfo->Clear();
551
 
        m_pViewInfo->AppendText(info);
552
 
}
553
 
 
554
 
 
555
 
void wxFileProps::OnViewWorld(wxCommandEvent &WXUNUSED(event)) 
556
 
{
557
 
        wxString wit;
558
 
        const char *str;
559
 
        GF_List *descs;
560
 
        descs = gf_list_new();
561
 
        str = gf_term_get_world_info(m_pApp->m_term, m_current_odm, descs);
562
 
 
563
 
        if (!str) {
564
 
                wxMessageDialog(this, wxT("No World Info available"), wxT("Sorry!"), wxOK).ShowModal();
565
 
                return;
566
 
        }
567
 
 
568
 
        wit = wxT("");
569
 
        for (u32 i=0; gf_list_count(descs); i++) {
570
 
                const char *d = (const char *) gf_list_get(descs, i);
571
 
                wit += wxString(d, wxConvUTF8);
572
 
                wit += wxT("\n");
573
 
        }
574
 
        wxMessageDialog(this, wit, wxString(str, wxConvUTF8), wxOK).ShowModal();
575
 
        gf_list_del(descs);
576
 
}
577
 
 
578
 
void wxFileProps::OnViewSG(wxCommandEvent &WXUNUSED(event)) 
579
 
{
580
 
        const char *sOpt;
581
 
        Bool dump_xmt;
582
 
        wxFileName out_file;
583
 
        char szOutFile[GF_MAX_PATH];
584
 
        wxString fname;
585
 
 
586
 
        sOpt = gf_cfg_get_key(m_pApp->m_user.config, "General", "CacheDirectory");
587
 
        out_file.AssignDir(wxString(sOpt, wxConvUTF8) );
588
 
 
589
 
        sOpt = gf_cfg_get_key(m_pApp->m_user.config, "General", "ViewXMT");
590
 
        out_file.SetFullName(wxT("scene_dump"));
591
 
        if (sOpt && !stricmp(sOpt, "yes")) {
592
 
                dump_xmt = 1;
593
 
        } else {
594
 
                dump_xmt = 0;
595
 
        }
596
 
        strcpy(szOutFile, out_file.GetFullName().mb_str(wxConvUTF8));
597
 
 
598
 
        GF_Err e = gf_term_dump_scene(m_pApp->m_term, szOutFile, NULL, dump_xmt, 0, m_current_odm);
599
 
        if (e) {
600
 
                wxMessageDialog dlg(this, wxString(gf_error_to_string(e), wxConvUTF8), wxT("Error while dumping"), wxOK);
601
 
                dlg.ShowModal();
602
 
        } else {
603
 
                wxString cmd = get_pref_browser(m_pApp->m_user.config);
604
 
                cmd += wxT(" ");
605
 
                cmd += wxString(szOutFile, wxConvUTF8);
606
 
                wxExecute(cmd);
607
 
        }
608
 
}