From: Alessio Treglia Date: Mon, 13 Feb 2012 15:31:11 +0000 (+0100) Subject: Imported Upstream version 0.4.5+svn3915~dfsg0 X-Git-Tag: archive/raspbian/1.0.1+dfsg1-4+rpi1~1^2~15^2~22 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=901ab6d7c9fbca7920f0125cafe78dd8d78f2b60;p=gpac.git Imported Upstream version 0.4.5+svn3915~dfsg0 --- diff --git a/Makefile b/Makefile index 1d56214..d7635e5 100644 --- a/Makefile +++ b/Makefile @@ -55,9 +55,13 @@ tar: install: $(INSTALL) -d "$(DESTDIR)$(prefix)" + $(INSTALL) -d "$(DESTDIR)$(prefix)/$(libdir)" $(INSTALL) -d "$(DESTDIR)$(prefix)/bin" $(INSTALL) $(INSTFLAGS) -m 755 bin/gcc/MP4Box "$(DESTDIR)$(prefix)/bin" $(INSTALL) $(INSTFLAGS) -m 755 bin/gcc/MP4Client "$(DESTDIR)$(prefix)/bin" + if [ -d $(DESTDIR)$(prefix)/$(libdir)/pkgconfig ] ; then \ + $(INSTALL) $(INSTFLAGS) -m 644 gpac.pc "$(DESTDIR)$(prefix)/$(libdir)/pkgconfig" ; \ + fi $(INSTALL) -d "$(DESTDIR)$(moddir)" $(INSTALL) bin/gcc/*.$(DYN_LIB_SUFFIX) "$(DESTDIR)$(moddir)" rm -f $(DESTDIR)$(moddir)/libgpac.$(DYN_LIB_SUFFIX) @@ -88,6 +92,7 @@ uninstall: $(MAKE) -C applications uninstall rm -rf $(DESTDIR)$(moddir) rm -rf $(DESTDIR)$(prefix)/$(libdir)/libgpac* + rm -rf $(DESTDIR)$(prefix)/$(libdir)/pkgconfig/gpac.pc rm -rf $(DESTDIR)$(prefix)/bin/MP4Box rm -rf $(DESTDIR)$(prefix)/bin/MP4Client rm -rf $(DESTDIR)$(mandir)/man1/mp4box.1 diff --git a/applications/mp4box/main.c b/applications/mp4box/main.c index 332aaaf..a516aa9 100644 --- a/applications/mp4box/main.c +++ b/applications/mp4box/main.c @@ -1948,7 +1948,7 @@ int mp4boxMain(int argc, char **argv) else if (!stricmp(arg, "-split-chunk") || !stricmp(arg, "-splitx") || !stricmp(arg, "-splitz")) { CHECK_NEXT_ARG if (!strstr(argv[i+1], ":")) { - fprintf(stdout, "Chunk extraction usage: \"-splitx start->end\" expressed in seconds\n"); + fprintf(stdout, "Chunk extraction usage: \"-splitx start:end\" expressed in seconds\n"); return 1; } sscanf(argv[i+1], "%lf:%lf", &split_start, &split_duration); diff --git a/applications/mp4box_android/.classpath b/applications/mp4box_android/.classpath deleted file mode 100644 index 609aa00..0000000 --- a/applications/mp4box_android/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/applications/mp4box_android/.project b/applications/mp4box_android/.project deleted file mode 100644 index d7f5daa..0000000 --- a/applications/mp4box_android/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - mp4box - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - diff --git a/applications/mp4box_android/AndroidManifest.xml b/applications/mp4box_android/AndroidManifest.xml deleted file mode 100644 index ba98ed9..0000000 --- a/applications/mp4box_android/AndroidManifest.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/applications/mp4box_android/default.properties b/applications/mp4box_android/default.properties deleted file mode 100644 index e2e8061..0000000 --- a/applications/mp4box_android/default.properties +++ /dev/null @@ -1,11 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "build.properties", and override values to adapt the script to your -# project structure. - -# Project target. -target=android-8 diff --git a/applications/mp4box_android/gen/org/enst/mp4box/R.java b/applications/mp4box_android/gen/org/enst/mp4box/R.java deleted file mode 100644 index 399c89c..0000000 --- a/applications/mp4box_android/gen/org/enst/mp4box/R.java +++ /dev/null @@ -1,30 +0,0 @@ -/* AUTO-GENERATED FILE. DO NOT MODIFY. - * - * This class was automatically generated by the - * aapt tool from the resource data it found. It - * should not be modified by hand. - */ - -package com.enst.mp4box; - -public final class R { - public static final class attr { - } - public static final class drawable { - public static final int icon=0x7f020000; - } - public static final class id { - public static final int CommandLineEdit=0x7f050001; - public static final int OkButton=0x7f050002; - public static final int textView1=0x7f050000; - } - public static final class layout { - public static final int main=0x7f030000; - } - public static final class string { - public static final int CommandLineTitle=0x7f040002; - public static final int OkButton=0x7f040003; - public static final int app_name=0x7f040001; - public static final int hello=0x7f040000; - } -} diff --git a/applications/mp4box_android/proguard.cfg b/applications/mp4box_android/proguard.cfg deleted file mode 100644 index 12dd039..0000000 --- a/applications/mp4box_android/proguard.cfg +++ /dev/null @@ -1,36 +0,0 @@ --optimizationpasses 5 --dontusemixedcaseclassnames --dontskipnonpubliclibraryclasses --dontpreverify --verbose --optimizations !code/simplification/arithmetic,!field/*,!class/merging/* - --keep public class * extends android.app.Activity --keep public class * extends android.app.Application --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep public class * extends android.content.ContentProvider --keep public class * extends android.app.backup.BackupAgentHelper --keep public class * extends android.preference.Preference --keep public class com.android.vending.licensing.ILicensingService - --keepclasseswithmembernames class * { - native ; -} - --keepclasseswithmembernames class * { - public (android.content.Context, android.util.AttributeSet); -} - --keepclasseswithmembernames class * { - public (android.content.Context, android.util.AttributeSet, int); -} - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keep class * implements android.os.Parcelable { - public static final android.os.Parcelable$Creator *; -} diff --git a/applications/mp4box_android/res/drawable-hdpi/icon.png b/applications/mp4box_android/res/drawable-hdpi/icon.png deleted file mode 100644 index 8074c4c..0000000 Binary files a/applications/mp4box_android/res/drawable-hdpi/icon.png and /dev/null differ diff --git a/applications/mp4box_android/res/drawable-ldpi/icon.png b/applications/mp4box_android/res/drawable-ldpi/icon.png deleted file mode 100644 index 1095584..0000000 Binary files a/applications/mp4box_android/res/drawable-ldpi/icon.png and /dev/null differ diff --git a/applications/mp4box_android/res/drawable-mdpi/icon.png b/applications/mp4box_android/res/drawable-mdpi/icon.png deleted file mode 100644 index a07c69f..0000000 Binary files a/applications/mp4box_android/res/drawable-mdpi/icon.png and /dev/null differ diff --git a/applications/mp4box_android/res/layout/main.xml b/applications/mp4box_android/res/layout/main.xml deleted file mode 100644 index 097c3b9..0000000 --- a/applications/mp4box_android/res/layout/main.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/applications/mp4box_android/res/values/strings.xml b/applications/mp4box_android/res/values/strings.xml deleted file mode 100644 index dece8e7..0000000 --- a/applications/mp4box_android/res/values/strings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - Hello World, mp4box! - mp4box - Command Line : - Ok - diff --git a/applications/mp4box_android/src/com/enst/mp4box/mp4box.java b/applications/mp4box_android/src/com/enst/mp4box/mp4box.java deleted file mode 100644 index 4a3f1e7..0000000 --- a/applications/mp4box_android/src/com/enst/mp4box/mp4box.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.enst.mp4box; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import com.enst.mp4box.R; - -import android.app.Activity; -import android.os.Bundle; -import android.widget.Button; -import android.widget.EditText; -import android.util.Log; -import android.view.View; - - - -public class mp4box extends Activity { - private mp4terminal myTerminal; - - /** Called when the activity is first created. */ - @Override - - - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - myTerminal = new mp4terminal(); - errors = loadAllLibraries(); - System.out.println( "hello world java" ); - final Button button = (Button) findViewById(R.id.OkButton); - - button.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - EditText oCommandLine = (EditText) findViewById(R.id.CommandLineEdit ); - CharSequence sCommandLine = oCommandLine.getText(); - myTerminal.run( sCommandLine.toString() ); - //showKeyboard( true ); - } - }); - - } - - - - - private static Map errors = null; - - synchronized static Map loadAllLibraries() - { - if( errors != null) - return errors; - StringBuilder sb = new StringBuilder(); - final String[] toLoad = { "GLESv1_CM", "dl", "log",//$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ - "jpeg", "javaenv", //$NON-NLS-1$ //$NON-NLS-2$ - "mad", "editline", "ft2", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "js_osmo", "openjpeg", "png", "z", //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ - "ffmpeg", "faad", "gpac", //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ - "stdc++", "mp4box" }; // //$NON-NLS-1$ //$NON-NLS-2$ - HashMap exceptions = new HashMap(); - for (String s : toLoad) { - try { - String msg = "Loading library " + s + "...";//$NON-NLS-1$//$NON-NLS-2$ - sb.append(msg); - //Log.i(LOG_LIB, msg); - System.loadLibrary(s); - } catch (UnsatisfiedLinkError e) { - sb.append("Failed to load " + s + ", error=" + e.getLocalizedMessage() + " :: " //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ - + e.getClass().getSimpleName() + "\n"); //$NON-NLS-1$ - exceptions.put(s, e); - //Log.e(LOG_LIB, "Failed to load library : " + s + " due to link error " + e.getLocalizedMessage(), e); //$NON-NLS-1$ //$NON-NLS-2$ - } catch (SecurityException e) { - exceptions.put(s, e); - //Log.e(LOG_LIB, "Failed to load library : " + s + " due to security error " + e.getLocalizedMessage(), e); //$NON-NLS-1$ //$NON-NLS-2$ - } catch (Throwable e) { - exceptions.put(s, e); - //Log.e(LOG_LIB, "Failed to load library : " + s + " due to Runtime error " + e.getLocalizedMessage(), e); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /*if (!exceptions.isEmpty()) { - try { - PrintStream out = new PrintStream(config.getGpacConfigDirectory() + "debug_libs.txt", "UTF-8"); //$NON-NLS-1$//$NON-NLS-2$ - out.println("$Revision: 2972 $"); //$NON-NLS-1$ - out.println(new Date()); - out.println("\n*** Configuration\n"); //$NON-NLS-1$ - out.println(config.getConfigAsText()); - sb.append("*** Libs listing: "); //$NON-NLS-1$ - sb.append(config.getGpacLibsDirectory()); - sb.append('\n'); - listing(sb, new File(config.getGpacLibsDirectory()), 2); - sb.append("*** Modules listing: "); //$NON-NLS-1$ - sb.append(config.getGpacModulesDirectory()); - sb.append('\n'); - listing(sb, new File(config.getGpacModulesDirectory()), 2); - sb.append("*** Fonts listing: \n"); //$NON-NLS-1$ - sb.append(config.getGpacFontDirectory()); - sb.append('\n'); - listing(sb, new File(config.getGpacFontDirectory()), 2); - sb.append("*** Exceptions:\n"); //$NON-NLS-1$ - for (Map.Entry ex : exceptions.entrySet()) { - sb.append(ex.getKey()).append(": ") //$NON-NLS-1$ - .append(ex.getValue().getLocalizedMessage()) - .append('(') - .append(ex.getValue().getClass()) - .append(")\n"); //$NON-NLS-1$ - } - out.println(sb.toString()); - out.flush(); - out.close(); - } catch (Exception e) { - Log.e(LOG_LIB, "Failed to output debug info to debug file", e); //$NON-NLS-1$ - } - }*/ - errors = Collections.unmodifiableMap(exceptions); - return errors; -} - /*public void showKeyboard(boolean showKeyboard) { - if (keyboardIsVisible == showKeyboard == true) - return; - InputMethodManager mgr = ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)); - this.keyboardIsVisible = showKeyboard; - if (showKeyboard) - mgr.showSoftInput(findViewById(R.id.CommandLineEdit ), 0); - else - mgr.hideSoftInputFromInputMethod(findViewById(R.id.CommandLineEdit ).getWindowToken(), 0); - - }*/ -} \ No newline at end of file diff --git a/applications/mp4box_android/src/com/enst/mp4box/mp4terminal.java b/applications/mp4box_android/src/com/enst/mp4box/mp4terminal.java deleted file mode 100644 index 7b77bb6..0000000 --- a/applications/mp4box_android/src/com/enst/mp4box/mp4terminal.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.enst.mp4box; - - -public class mp4terminal { - - public native void run( String sCommandLine); -} diff --git a/applications/osmo4_ios/Resources/icon.png b/applications/osmo4_ios/Resources/icon.png deleted file mode 100644 index 13f1dee..0000000 Binary files a/applications/osmo4_ios/Resources/icon.png and /dev/null differ diff --git a/applications/osmo4_ios/Resources/osmo.icns b/applications/osmo4_ios/Resources/osmo.icns deleted file mode 100644 index da7226f..0000000 Binary files a/applications/osmo4_ios/Resources/osmo.icns and /dev/null differ diff --git a/applications/osmo4_ios/extract.c b/applications/osmo4_ios/extract.c deleted file mode 100644 index 8d100c8..0000000 --- a/applications/osmo4_ios/extract.c +++ /dev/null @@ -1,702 +0,0 @@ -/* - * GPAC - Multimedia Framework C SDK - * - * Copyright (c) Jean Le Feuvre 2000-2005 - * Copyright (c) 2005-200X ENST - * All rights reserved - * - * This file is part of GPAC / command-line client - * - * GPAC is gf_free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * GPAC is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "libgpac_symbols.h" - -#ifdef WIN32 -#include -#else -typedef struct tagBITMAPFILEHEADER -{ - u16 bfType; - u32 bfSize; - u16 bfReserved1; - u16 bfReserved2; - u32 bfOffBits; -} BITMAPFILEHEADER; - -typedef struct tagBITMAPINFOHEADER{ - u32 biSize; - s32 biWidth; - s32 biHeight; - u16 biPlanes; - u16 biBitCount; - u32 biCompression; - u32 biSizeImage; - s32 biXPelsPerMeter; - s32 biYPelsPerMeter; - u32 biClrUsed; - u32 biClrImportant; -} BITMAPINFOHEADER; - -#define BI_RGB 0L - -#endif - - -#include -#include -#include - -extern Bool is_connected; -extern GF_Terminal *term; -extern u32 Duration; -extern GF_Err last_error; - -static GFINLINE u8 colmask(s32 a, s32 n) -{ - s32 mask = (1 << n) - 1; - return (u8) (a & (0xff & ~mask)) | ((-((a >> n) & 1)) & mask); -} - -static u32 put_pixel(FILE *fout, u32 type, u32 pf, char *ptr) -{ - u16 col; - switch (pf) { - case GF_PIXEL_RGB_32: - case GF_PIXEL_ARGB: - fputc(ptr[0], fout); - fputc(ptr[1], fout); - fputc(ptr[2], fout); - return 4; - - case GF_PIXEL_BGR_32: - case GF_PIXEL_RGBA: - //probably due to tinygl bug - verify -#ifndef GPAC_USE_TINYGL - fputc(ptr[3], fout); - fputc(ptr[2], fout); - fputc(ptr[1], fout); -#else - fputc(ptr[2], fout); - fputc(ptr[1], fout); - fputc(ptr[0], fout); -#endif - return 4; - - case GF_PIXEL_RGB_24: - fputc(ptr[2], fout); - fputc(ptr[1], fout); - fputc(ptr[0], fout); - return 3; - - case GF_PIXEL_BGR_24: - fputc(ptr[2], fout); - fputc(ptr[1], fout); - fputc(ptr[0], fout); - return 3; - case GF_PIXEL_RGB_565: - col = * (u16 *)ptr; - fputc(colmask(col << 3, 3), fout); - fputc(colmask(col >> (5 - 2), 2), fout); - fputc(colmask(col >> (11 - 3), 3), fout); - return 2; - - case GF_PIXEL_RGB_555: - col = * (u16 *)ptr; - fputc(colmask(col << 3, 3), fout); - fputc(colmask(col >> (5 - 3), 3), fout); - fputc(colmask(col >> (10 - 3), 3), fout); - return 2; - /* this is used to write the byte depthbuffer in greyscale when dumping depth*/ - case GF_PIXEL_GREYSCALE: - /* bmp always needs 3 pixels */ - fputc(ptr[0], fout); - fputc(ptr[0], fout); - fputc(ptr[0], fout); - /* if printing the characters corresponding to the float depth buffer: */ - /* - { - u32 i=0; - while (ptr[i]!='\0') { - fputc(ptr[i], fout); - i++; - } - fputc('\b', fout); - } - */ - return 1; - - - case 0: - fputc(ptr[0], fout); - return 1; - } - return 0; -} - -void write_bmp(GF_VideoSurface *fb, char *rad_name, u32 img_num) -{ - char str[GF_MAX_PATH]; - BITMAPFILEHEADER fh; - BITMAPINFOHEADER fi; - FILE *fout; - u32 j, i; - char *ptr, *prev; - - prev = strrchr(rad_name, '.'); - //if (prev) prev[0] = '\0'; - - if (fb->pixel_format==GF_PIXEL_GREYSCALE) sprintf(str, "%s_%d_depth.bmp", rad_name, img_num); - else sprintf(str, "%s_%d.bmp", rad_name, img_num); - - fout = gf_f64_open(str, "wb"); - if (!fout) return; - - memset(&fh, 0, sizeof(fh)); - fh.bfType = 19778; - fh.bfOffBits = 14 + 40; - - memset(&fi, 0, sizeof(char)*40); - fi.biSize = sizeof(char)*40; - fi.biWidth = fb->width; - fi.biHeight = fb->height; - fi.biPlanes = 1; - if (fb->pixel_format==GF_PIXEL_GREYSCALE) fi.biBitCount = 24; - else fi.biBitCount = 24; - fi.biCompression = BI_RGB; - fi.biSizeImage = fb->pitch_y * fb->height; - - /*NOT ALIGNED!!*/ - gf_fwrite(&fh.bfType, 2, 1, fout); - gf_fwrite(&fh.bfSize, 4, 1, fout); - gf_fwrite(&fh.bfReserved1, 2, 1, fout); - gf_fwrite(&fh.bfReserved2, 2, 1, fout); - gf_fwrite(&fh.bfOffBits, 4, 1, fout); - - gf_fwrite(&fi, 1, 40, fout); -//#ifndef GPAC_USE_TINYGL - for (j=fb->height; j>0; j--) { - ptr = fb->video_buffer + (j-1)*fb->pitch_y; - for (i=0;iwidth; i++) { - u32 res = put_pixel(fout, 0, fb->pixel_format, ptr); - assert(res); - ptr += res; - } - } -//#else -#if 0 - for (j=0; jheight; j++) { - ptr = fb->video_buffer + j*fb->pitch; - for (i=0;iwidth; i++) { - u32 res = put_pixel(fout, 0, fb->pixel_format, ptr); - assert(res); - ptr += res; - } - } -#endif - - fclose(fout); -} - -/*writes onto a file the content of the framebuffer in *fb interpreted as the byte depthbuffer */ -/*it's also possible to write a float depthbuffer by passing the floats to strings and writing chars in putpixel - see comments*/ -void write_depthfile(GF_VideoSurface *fb, char *rad_name, u32 img_num) -{ - FILE *fout; - u32 i, j; - char val; - unsigned char *depth; - - depth = (unsigned char *) fb->video_buffer; - - fout = gf_f64_open("dump_depth", "wb"); - if (!fout) return; - for (j=0; jheight; j++) { - for (i=0;iwidth; i++) { - -#ifdef GPAC_USE_TINYGL - val = fputc(depth[2*i+j*fb->width*sizeof(unsigned short)], fout); - val = fputc(depth[2*i+j*fb->width*sizeof(unsigned short) + 1], fout); -#else - val = fputc(depth[i+j*fb->width], fout); -#endif - } - } - fclose(fout); -} - -void write_texture_file(GF_VideoSurface *fb, char *rad_name, u32 img_num, u32 dump_mode) -{ - - FILE *fout; - u32 i, j; - char val; - unsigned char *buf; - - buf = (unsigned char *) fb->video_buffer; - - if (dump_mode==6) fout = gf_f64_open("dump_rgbds", "wb"); - else if (dump_mode==9) fout = gf_f64_open("dump_rgbd", "wb"); - else return; - - if (!fout) return; - for (j=0; jheight; j++) { - for (i=0;iwidth*4; i++) { - val = fputc(buf[i+j*fb->pitch_y], fout); - } - } - fclose(fout); -} - - -void write_raw(GF_VideoSurface *fb, char *rad_name, u32 img_num) -{ - u32 j, i; - char *ptr, *prev; - char str[GF_MAX_PATH]; - FILE *fout; - prev = strrchr(rad_name, '.'); - if (prev) prev[0] = '\0'; - if (img_num<10) { - sprintf(str, "%s_00%d.raw", rad_name, img_num); - } else if (img_num<100) { - sprintf(str, "%s_0%d.raw", rad_name, img_num); - } else { - sprintf(str, "%s_%d.raw", rad_name, img_num); - } - - fout = gf_f64_open(str, "wb"); - if (!fout) return; - - - for (j=0;jheight; j++) { - ptr = fb->video_buffer + j*fb->pitch_y; - for (i=0;iwidth; i++) { - u32 res = put_pixel(fout, 0, fb->pixel_format, ptr); - assert(res); - ptr += res; - } - } - fclose(fout); -} - - -/* creates a .bmp format greyscale image of the byte depthbuffer and a binary with only the content of the depthbuffer */ -void dump_depth (GF_Terminal *term, char *rad_name, u32 dump_type, u32 frameNum, char *conv_buf, void *avi_out) -{ - GF_Err e; - u32 i, k; - GF_VideoSurface fb; - - /*lock it*/ - e = gf_sc_get_screen_buffer(term->compositor, &fb, 1); - if (e) fprintf(stdout, "Error grabbing depth buffer: %s\n", gf_error_to_string(e)); - else fprintf(stdout, "OK\n"); - /*export frame*/ - switch (dump_type) { - case 1: - case 8: - /*reverse frame*/ - for (k=0; k> 8/*(11 - 3)*/, 3); - dst[1] = colmask(src_16 >> 3/*(5 - 2)*/, 2); - dst[0] = colmask(src_16 << 3, 3); - src+=2; - break; - case GF_PIXEL_RGB_555: - src_16 = * (u16 *)src; - dst[2] = colmask(src_16 >> 7/*(10 - 3)*/, 3); - dst[1] = colmask(src_16 >> 2/*(5 - 3)*/, 3); - dst[0] = colmask(src_16 << 3, 3); - src+=2; - break; - /*for depth .avi*/ - case GF_PIXEL_GREYSCALE: - dst[0] = src[0]; - dst[1] = src[0]; - dst[2] = src[0]; - src+=1; - break; - } - dst += 3; - } - } -#ifndef GPAC_DISABLE_AVILIB - if (AVI_write_frame(avi_out, conv_buf, fb.height*fb.width*3, 1) <0) - printf("Error writing frame\n"); -#endif - break; - case 2: - write_bmp(&fb, rad_name, frameNum); - break; - case 3: - write_raw(&fb, rad_name, frameNum); - break; - case 4: - write_depthfile(&fb, rad_name, frameNum); - break; - case 7: - write_bmp(&fb, rad_name, frameNum); - break; - - } - /*unlock it*/ - /*in -depth -avi mode, do not release it yet*/ - if (dump_type!=8) gf_sc_release_screen_buffer(term->compositor, &fb); -} - -void dump_frame(GF_Terminal *term, char *rad_name, u32 dump_type, u32 frameNum, char *conv_buf, void *avi_out) -{ - GF_Err e = GF_OK; - u32 i, k, out_size; - GF_VideoSurface fb; - - /*lock it*/ - if (dump_type==5 || dump_type==6) e = gf_sc_get_screen_buffer(term->compositor, &fb, 2); - else if (dump_type== 9 || dump_type==10) e = gf_sc_get_screen_buffer(term->compositor, &fb, 3); - else e = gf_sc_get_screen_buffer(term->compositor, &fb, 0); - if (e) fprintf(stdout, "Error grabbing frame buffer: %s\n", gf_error_to_string(e)); - - if (dump_type!=5 && dump_type!= 10) { - out_size = fb.height*fb.width*3; - } else { - out_size = fb.height*fb.width*4; - } - /*export frame*/ - switch (dump_type) { - case 1: - case 5: - case 10: - case 8: - /*reverse frame*/ - for (k=0; k> 8/*(11 - 3)*/, 3); - dst[1] = colmask(src_16 >> 3/*(5 - 2)*/, 2); - dst[0] = colmask(src_16 << 3, 3); - src+=2; - dst+=3; - } - break; - case GF_PIXEL_RGB_555: - for (i=0;i> 7/*(10 - 3)*/, 3); - dst[1] = colmask(src_16 >> 2/*(5 - 3)*/, 3); - dst[0] = colmask(src_16 << 3, 3); - src+=2; - dst +=3; - } - break; - } - } -#ifndef GPAC_DISABLE_AVILIB - if (dump_type!=5 && dump_type!= 10) { - if (AVI_write_frame(avi_out, conv_buf, out_size, 1) <0) - printf("Error writing frame\n"); - } else { - if (AVI_write_frame(avi_out, conv_buf, out_size, 1) <0) - printf("Error writing frame\n"); - } -#endif - break; - case 2: - write_bmp(&fb, rad_name, frameNum); - break; - case 6: - case 9: - write_texture_file(&fb, rad_name, frameNum, dump_type); - break; - - case 3: - write_raw(&fb, rad_name, frameNum); - break; - } - /*unlock it*/ - gf_sc_release_screen_buffer(term->compositor, &fb); -} - -Bool dump_file(char *url, u32 dump_mode, Double fps, u32 width, u32 height, Float scale, u32 *times, u32 nb_times) -{ - GF_Err e; - u32 i = 0; - GF_VideoSurface fb; - char szPath[GF_MAX_PATH]; - char *prev=NULL; - - prev = strstr(url, "://"); - if (prev) { - prev = strrchr(url, '/'); - if (prev) prev++; - } - - if (!prev) prev = url; - strcpy(szPath, prev); - prev = strrchr(szPath, '.'); - if (prev) prev[0] = 0; - - fprintf(stdout, "Opening URL %s\n", url); - /*connect in pause mode*/ - gf_term_connect_from_time(term, url, 0, 1); - - while (!term->compositor->scene - || term->compositor->msg_type - || (gf_term_get_option(term, GF_OPT_PLAY_STATE) == GF_STATE_STEP_PAUSE) - ) { - if (last_error) return 1; - gf_term_process_flush(term); - gf_sleep(10); - } - - if (width && height) { - gf_term_set_size(term, width, height); - gf_term_process_flush(term); - } -#ifndef GPAC_USE_TINYGL - printf("not tinygl\n"); - e = gf_sc_get_screen_buffer(term->compositor, &fb, 0); -#else - printf("tinygl\n"); - e = gf_sc_get_screen_buffer(term->compositor, &fb, 1); -#endif - if (e != GF_OK) { - fprintf(stdout, "Error grabbing screen buffer: %s\n", gf_error_to_string(e)); - return 0; - } - width = fb.width; - height = fb.height; - gf_sc_release_screen_buffer(term->compositor, &fb); - - if (scale != 1) { - width = (u32)(width * scale); - height = (u32)(height * scale); - gf_term_set_size(term, width, height); - gf_term_process_flush(term); - } - - /*we work in RGB24, and we must make sure the pitch is %4*/ - if ((width*3)%4) { - fprintf(stdout, "Adjusting width (%d) to have a stride multiple of 4\n", width); - while ((width*3)%4) width--; - - gf_term_set_size(term, width, height); - gf_term_process_flush(term); - - gf_sc_get_screen_buffer(term->compositor, &fb, 0); - width = fb.width; - height = fb.height; - gf_sc_release_screen_buffer(term->compositor, &fb); - } - - if (dump_mode==1 || dump_mode==5 || dump_mode==8 || dump_mode==10) { -#ifdef GPAC_DISABLE_AVILIB - fprintf(stdout, "AVILib is disabled in this build of GPAC\n"); - return 0; -#else - u32 time, prev_time, nb_frames, dump_dur; - char *conv_buf; - avi_t *avi_out = NULL; - avi_t *depth_avi_out = NULL; - char szPath_depth[GF_MAX_PATH]; - char comp[5]; - strcpy(szPath_depth, szPath); - strcat(szPath, ".avi"); - avi_out = AVI_open_output_file(szPath); - if (!avi_out) { - fprintf(stdout, "Error creating AVI file %s\n", szPath); - return 1; - } - if (dump_mode==8) { - strcat(szPath_depth, "_depth.avi"); - depth_avi_out = AVI_open_output_file(szPath_depth); - if (!depth_avi_out) { - fprintf(stdout, "Error creating AVI file %s\n", szPath); - return 1; - } - } - - if (!fps) fps = 25.0; - time = prev_time = 0; - nb_frames = 0; - - if (nb_times==2) { - prev_time = times[0]; - dump_dur = times[1] - times[0]; - } else { - dump_dur = times[0] ? times[0] : Duration; - } - if (!dump_dur) { - fprintf(stdout, "Warning: file has no duration, defaulting to 1 sec\n"); - dump_dur = 1000; - } - - comp[0] = comp[1] = comp[2] = comp[3] = comp[4] = 0; - AVI_set_video(avi_out, width, height, fps, comp); - if (dump_mode==8) AVI_set_video(depth_avi_out, width, height, fps, comp); - if (dump_mode != 5 && dump_mode!=10) conv_buf = gf_malloc(sizeof(char) * width * height * 3); - else conv_buf = gf_malloc(sizeof(char) * width * height * 4); - /*step to first frame*/ - if (prev_time) gf_term_step_clocks(term, prev_time); - - while (time < dump_dur) { - while ((gf_term_get_option(term, GF_OPT_PLAY_STATE) == GF_STATE_STEP_PAUSE)) { - gf_term_process_flush(term); - } - fprintf(stdout, "Dumping %02d/100\r", (u32) ((100.0*prev_time)/dump_dur) ); - - if (dump_mode==8) { - /*we'll dump both buffers at once*/ - gf_mx_p(term->compositor->mx); - dump_depth(term, szPath_depth, dump_mode, i+1, conv_buf, depth_avi_out); - dump_frame(term, szPath, dump_mode, i+1, conv_buf, avi_out); - gf_mx_v(term->compositor->mx); - - } - else dump_frame(term, szPath, dump_mode, i+1, conv_buf, avi_out); - - nb_frames++; - time = (u32) (nb_frames*1000/fps); - gf_term_step_clocks(term, time - prev_time); - prev_time = time; - } - AVI_close(avi_out); - if (dump_mode==8) AVI_close(depth_avi_out); - gf_free(conv_buf); - fprintf(stdout, "AVI Extraction 100/100\n"); -#endif /*GPAC_DISABLE_AVILIB*/ - } else { - if (times[0]) gf_term_step_clocks(term, times[0]); - - for (i=0; i -#include - -#else -#include /*for GetModuleFileName*/ -#include /*for _mkdir*/ -#include /*for getting user-dir*/ -#ifndef SHGFP_TYPE_CURRENT -#define SHGFP_TYPE_CURRENT 0 /*needed for MinGW*/ -#endif - -#ifdef _MSC_VER -/*get rid of console*/ -#if 0 -#pragma comment(linker,"/SUBSYSTEM:WINDOWS") -#pragma comment(linker,"/ENTRY:main") -#else -#pragma comment(linker,"/SUBSYSTEM:CONSOLE") -#endif - -#endif // _MSC_VER - -#endif //WIN32 - - -/*local prototypes*/ -void PrintWorldInfo(GF_Terminal *term); -void ViewOD(GF_Terminal *term, u32 OD_ID, u32 number); -void PrintODList(GF_Terminal *term, GF_ObjectManager *root_odm, u32 num, u32 indent, char *root_name); - -void ViewODs(GF_Terminal *term, Bool show_timing); -void PrintGPACConfig(); - -static Bool restart = 0; -#if defined(__DARWIN__) || defined(__APPLE__) -static Bool not_threaded = 1; -#else -static Bool not_threaded = 0; -#endif -static Bool no_audio = 0; -static Bool no_regulation = 0; -static Bool bench_mode = 0; -Bool is_connected = 0; -Bool startup_file = 0; -GF_User user; -GF_Terminal *term; -u64 Duration; -GF_Err last_error = GF_OK; - -static Fixed bench_speed = FLT2FIX(20); - -static Bool request_next_playlist_item = 0; - -static GF_Config *cfg_file; -static Bool display_rti = 0; -static Bool Run; -static Bool CanSeek = 0; -static u32 Volume=100; -static char the_url[GF_MAX_PATH]; -static char pl_path[GF_MAX_PATH]; -static Bool no_mime_check = 1; -static Bool be_quiet = 0; -static u32 log_time_start = 0; - -static u32 forced_width=0; -static u32 forced_height=0; - -/*windowless options*/ -u32 align_mode = 0; -u32 init_w = 0; -u32 init_h = 0; -u32 last_x, last_y; -Bool right_down = 0; - -void dump_frame(GF_Terminal *term, char *rad_path, u32 dump_type, u32 frameNum); -Bool dump_file(char *the_url, u32 dump_mode, Double fps, u32 width, u32 height, Float scale, u32 *times, u32 nb_times); - -void PrintUsage() -{ - fprintf(stdout, "Usage Osmo4iOS [options] [filename]\n" - "\t-c fileName: user-defined configuration file\n" - "\t-rti fileName: logs run-time info (FPS, CPU, Mem usage) to file\n" - "\t-rtix fileName: same as -rti but driven by GPAC logs\n" - "\t-quiet: removes script message, buffering and downloading status\n" - "\t-opt option: Overrides an option in the configuration file. String format is section:key=value\n" - "\t-log-file file: sets output log file.\n" - "\t-log-level lev: sets log level. Possible values are:\n" - "\t \"error\" : logs only error messages\n" - "\t \"warning\" : logs error+warning messages\n" - "\t \"info\" : logs error+warning+info messages\n" - "\t \"debug\" : logs all messages\n" - "\n" - "\t-log-tools lt: sets tool(s) to log. List of \':\'-separated values:\n" - "\t \"core\" : libgpac core\n" - "\t \"coding\" : bitstream formats (audio, video, scene)\n" - "\t \"container\" : container formats (ISO File, MPEG-2 TS, AVI, ...)\n" - "\t \"network\" : network data exept RTP trafic\n" - "\t \"rtp\" : rtp trafic\n" - "\t \"author\" : authoring tools (hint, import, export)\n" - "\t \"sync\" : terminal sync layer\n" - "\t \"codec\" : terminal codec messages\n" - "\t \"parser\" : scene parsers (svg, xmt, bt) and other\n" - "\t \"media\" : terminal media object management\n" - "\t \"scene\" : scene graph and scene manager\n" - "\t \"script\" : scripting engine messages\n" - "\t \"interact\" : interaction engine (events, scripts, etc)\n" - "\t \"compose\" : composition engine (2D, 3D, etc)\n" - "\t \"service\" : network service management\n" - "\t \"mmio\" : Audio/Video HW I/O management\n" - "\t \"none\" : no tool logged\n" - "\t \"all\" : all tools logged\n" - "\n" - "\t-size WxH: specifies visual size (default: scene size)\n" - "\t-scale s: scales the visual size (default: 1)\n" -#if defined(__DARWIN__) || defined(__APPLE__) - "\t-thread: enables thread usage for terminal and compositor \n" -#else - "\t-no-thread: disables thread usage (except for audio)\n" -#endif - "\t-no-audio: disables audio \n" - "\t-no-wnd: uses windowless mode (Win32 only)\n" - "\t-align vh: specifies v and h alignment for windowless mode\n" - " possible v values: t(op), m(iddle), b(ottom)\n" - " possible h values: l(eft), m(iddle), r(ight)\n" - " default alignment is top-left\n" - " default alignment is top-left\n" - "\t-pause: pauses at first frame\n" - "\n" - "Dumper Options:\n" - "\t-bmp [times]: dumps given frames to bmp\n" - "\t-raw [times]: dumps given frames to bmp\n" - "\t-avi [times]: dumps given file to raw avi\n" - "\t-rgbds: dumps the RGBDS pixel format texture\n" - " with -avi [times]: dumps an rgbds-format .avi\n" - "\t-rgbd: dumps the RGBD pixel format texture\n" - " with -avi [times]: dumps an rgbd-format .avi\n" - "\t-depth: dumps depthmap (z-buffer) frames\n" - " with -avi [times]: dumps depthmap in grayscale .avi\n" - " with -bmp: dumps depthmap in grayscale .bmp\n" - "\t-fps FPS: specifies frame rate for AVI dumping (default: 25.0)\n" - "\t-2d: uses 2D compositor\n" - "\t-3d: uses 3D compositor\n" - "\t-fill: uses fill aspect ratio for dumping (default: none)\n" - "\t-show: show window while dumping (default: no)\n" - "MP4Client - GPAC command line player and dumper - version %s\n" - "GPAC Written by Jean Le Feuvre (c) 2001-2005 - ENST (c) 2005-200X\n", - - GPAC_FULL_VERSION - ); -} - -void PrintHelp() -{ - fprintf(stdout, "MP4Client command keys:\n" - "\to: connect to the specified URL\n" - "\tO: connect to the specified URL in playlist mode\n" - "\tN: switch to the next URL in the playlist (works with return key as well)\n" - "\tr: restart current presentation\n" - "\tp: play/pause the presentation\n" - "\ts: step one frame ahead\n" - "\tz: seek into presentation\n" - "\tt: print current timing\n" - "\n" - "\tw: view world info\n" - "\tv: view Object Descriptor list\n" - "\ti: view Object Descriptor info (by ID)\n" - "\tj: view Object Descriptor info (by number)\n" - "\tb: view media objects timing and buffering info\n" - "\tm: view media objects buffering and memory info\n" - "\td: dumps scene graph\n" - "\n" - "\tC: Enable Streaming Cache\n" - "\tS: Stops Streaming Cache and save to file\n" - "\tA: Aborts Streaming Cache\n" - "\n" - "\tk: turns stress mode on/off\n" - "\tn: changes navigation mode\n" - "\tx: reset to last active viewpoint\n" - "\n" - "\t2: restart using 2D compositor\n" - "\t3: restart using 3D compositor\n" - "\n" - "\t4: forces 4/3 Aspect Ratio\n" - "\t5: forces 16/9 Aspect Ratio\n" - "\t6: forces no Aspect Ratio (always fill screen)\n" - "\t7: forces original Aspect Ratio (default)\n" - "\n" - "\tL: changes to new log level. CF MP4Client usage for possible values\n" - "\tT: select new tools to log. CF MP4Client usage for possible values\n" - "\n" - "\tl: list available modules\n" - "\tc: prints some GPAC configuration info\n" - "\tR: toggles run-time info display on/off\n" - "\tq: exit the application\n" - "\th: print this message\n" - "\n" - "MP4Client - GPAC command line player - version %s\n" - "GPAC Written by Jean Le Feuvre (c) 2001-2005 - ENST (c) 2005-200X\n", - - GPAC_FULL_VERSION - ); -} - - -static void PrintTime(u64 time) -{ - u32 ms, h, m, s; - h = (u32) (time / 1000 / 3600); - m = (u32) (time / 1000 / 60 - h*60); - s = (u32) (time / 1000 - h*3600 - m*60); - ms = (u32) (time - (h*3600 + m*60 + s) * 1000); - fprintf(stdout, "%02d:%02d:%02d.%02d", h, m, s, ms); -} - - -static u32 rti_update_time_ms = 200; -static FILE *rti_logs = NULL; -static u64 memory_at_gpac_startup = 0; - -static void UpdateRTInfo(const char *legend) -{ - GF_SystemRTInfo rti; - - /*refresh every second*/ - if (!display_rti && !rti_logs) return; - if (!gf_sys_get_rti(rti_update_time_ms, &rti, 0) && !legend) - return; - - if (display_rti) { - if (!rti.process_memory) rti.process_memory = (u32) (memory_at_gpac_startup-rti.physical_memory_avail); - if (!rti.gpac_memory) rti.gpac_memory = (u32) (memory_at_gpac_startup-rti.physical_memory_avail); - - if (display_rti==2) { - fprintf(stdout, "FPS %02.2f - CPU %02d (%02d) - Mem %d kB\r", - gf_term_get_framerate(term, 0), rti.total_cpu_usage, rti.process_cpu_usage, (u32) (rti.gpac_memory / 1024) ); - } else { - char szMsg[1024]; - GF_Event evt; - - sprintf(szMsg, "FPS %02.2f - CPU %02d (%02d) - Mem %d kB", - gf_term_get_framerate(term, 0), rti.total_cpu_usage, rti.process_cpu_usage, (u32) (rti.gpac_memory / 1024) ); - evt.type = GF_EVENT_SET_CAPTION; - evt.caption.caption = szMsg; - gf_term_user_event(term, &evt); - } - } - if (rti_logs) { - fprintf(rti_logs, "% 8d\t% 8d\t% 8d\t% 4d\t% 8d\t%s", - gf_sys_clock(), - gf_term_get_time_in_ms(term), - rti.total_cpu_usage, - (u32) gf_term_get_framerate(term, 0), - (u32) (rti.gpac_memory / 1024), - legend ? legend : "" - ); - if (!legend) fprintf(rti_logs, "\n"); - } -} - -static void ResetCaption() -{ - GF_Event event; - if (display_rti) return; - event.type = GF_EVENT_SET_CAPTION; - if (is_connected) { - char szName[1024]; - NetInfoCommand com; - - event.caption.caption = NULL; - /*get any service info*/ - if (!startup_file && gf_term_get_service_info(term, gf_term_get_root_object(term), &com) == GF_OK) { - strcpy(szName, ""); - if (com.track_info) { - char szBuf[10]; - sprintf(szBuf, "%02d ", (u32) (com.track_info>>16) ); - strcat(szName, szBuf); - } - if (com.artist) { strcat(szName, com.artist); strcat(szName, " "); } - if (com.name) { strcat(szName, com.name); strcat(szName, " "); } - if (com.album) { strcat(szName, "("); strcat(szName, com.album); strcat(szName, ")"); } - - if (strlen(szName)) event.caption.caption = szName; - } - if (!event.caption.caption) { - char *str = strrchr(the_url, '\\'); - if (!str) str = strrchr(the_url, '/'); - event.caption.caption = str ? str+1 : the_url; - } - } else { - event.caption.caption = "GPAC MP4Client " GPAC_FULL_VERSION; - } - gf_term_user_event(term, &event); -} - -#ifdef WIN32 -u32 get_sys_col(int idx) -{ - u32 res; - DWORD val = GetSysColor(idx); - res = (val)&0xFF; res<<=8; - res |= (val>>8)&0xFF; res<<=8; - res |= (val>>16)&0xFF; - return res; -} -#endif - -void switch_bench() -{ - if (is_connected) { - bench_mode = !bench_mode; - display_rti = !display_rti; - ResetCaption(); - gf_term_set_speed(term, bench_mode ? bench_speed : FIX_ONE); - } -} - -Bool GPAC_EventProc(void *ptr, GF_Event *evt) -{ - if (!term) return 0; - - switch (evt->type) { - case GF_EVENT_DURATION: - Duration = 1000; - Duration = (u64) (((s64) Duration) * evt->duration.duration); - CanSeek = evt->duration.can_seek; - break; - case GF_EVENT_MESSAGE: - { - const char *servName; - if (!evt->message.service || !strcmp(evt->message.service, the_url)) { - servName = "main service"; - } else if (!strnicmp(evt->message.service, "data:", 5)) { - servName = ""; - } else { - servName = evt->message.service; - } - if (!evt->message.message) return 0; - if (evt->message.error) { - if (!is_connected) last_error = evt->message.error; - fprintf(stderr, "%s (%s): %s\n", evt->message.message, servName, gf_error_to_string(evt->message.error)); - } else if (!be_quiet) - fprintf(stderr, "(%s) %s\r", servName, evt->message.message); - } - break; - case GF_EVENT_PROGRESS: - { - char *szTitle = ""; - if (evt->progress.progress_type==0) szTitle = "Buffer "; - else if (evt->progress.progress_type==1) szTitle = "Download "; - else if (evt->progress.progress_type==2) szTitle = "Import "; - gf_set_progress(szTitle, evt->progress.done, evt->progress.total); - } - break; - - - case GF_EVENT_DBLCLICK: - gf_term_set_option(term, GF_OPT_FULLSCREEN, !gf_term_get_option(term, GF_OPT_FULLSCREEN)); - return 0; - - case GF_EVENT_MOUSEDOWN: - if (evt->mouse.button==GF_MOUSE_RIGHT) { - right_down = 1; - last_x = evt->mouse.x; - last_y = evt->mouse.y; - } - return 0; - case GF_EVENT_MOUSEUP: - if (evt->mouse.button==GF_MOUSE_RIGHT) { - right_down = 0; - last_x = evt->mouse.x; - last_y = evt->mouse.y; - } - return 0; - case GF_EVENT_MOUSEMOVE: - if (right_down && (user.init_flags & GF_TERM_WINDOWLESS) ) { - GF_Event move; - move.move.x = evt->mouse.x - last_x; - move.move.y = last_y-evt->mouse.y; - move.type = GF_EVENT_MOVE; - move.move.relative = 1; - gf_term_user_event(term, &move); - } - return 0; - - case GF_EVENT_KEYUP: - switch (evt->key.key_code) { - case GF_KEY_SPACE: - if (evt->key.flags & GF_KEY_MOD_CTRL) switch_bench(); - break; - } - break; - case GF_EVENT_KEYDOWN: - gf_term_process_shortcut(term, evt); - switch (evt->key.key_code) { - case GF_KEY_SPACE: - if (evt->key.flags & GF_KEY_MOD_CTRL) { - /*ignore key repeat*/ - if (!bench_mode) switch_bench(); - } - break; - case GF_KEY_PAGEDOWN: - case GF_KEY_MEDIANEXTTRACK: - request_next_playlist_item = 1; - break; - case GF_KEY_MEDIAPREVIOUSTRACK: - break; - case GF_KEY_ESCAPE: - gf_term_set_option(term, GF_OPT_FULLSCREEN, !gf_term_get_option(term, GF_OPT_FULLSCREEN)); - break; - case GF_KEY_F: - if (evt->key.flags & GF_KEY_MOD_CTRL) fprintf(stderr, "Rendering rate: %f FPS\n", gf_term_get_framerate(term, 0)); - break; - case GF_KEY_T: - if (evt->key.flags & GF_KEY_MOD_CTRL) fprintf(stderr, "Scene Time: %f \n", gf_term_get_time_in_ms(term)/1000.0); - break; - case GF_KEY_D: - if (evt->key.flags & GF_KEY_MOD_CTRL) gf_term_set_option(term, GF_OPT_DRAW_MODE, (gf_term_get_option(term, GF_OPT_DRAW_MODE)==GF_DRAW_MODE_DEFER) ? GF_DRAW_MODE_IMMEDIATE : GF_DRAW_MODE_DEFER ); - break; - case GF_KEY_4: - if (evt->key.flags & GF_KEY_MOD_CTRL) - gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_4_3); - break; - case GF_KEY_5: - if (evt->key.flags & GF_KEY_MOD_CTRL) - gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_16_9); - break; - case GF_KEY_6: - if (evt->key.flags & GF_KEY_MOD_CTRL) - gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_FILL_SCREEN); - break; - case GF_KEY_7: - if (evt->key.flags & GF_KEY_MOD_CTRL) - gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_KEEP); - break; - case GF_KEY_P: - if (evt->key.flags & GF_KEY_MOD_CTRL && is_connected) { - Bool is_pause = gf_term_get_option(term, GF_OPT_PLAY_STATE); - fprintf(stderr, "[Status: %s]\n", is_pause ? "Playing" : "Paused"); - gf_term_set_option(term, GF_OPT_PLAY_STATE, (gf_term_get_option(term, GF_OPT_PLAY_STATE)==GF_STATE_PAUSED) ? GF_STATE_PLAYING : GF_STATE_PAUSED); - } - break; - case GF_KEY_S: - if ((evt->key.flags & GF_KEY_MOD_CTRL) && is_connected) { - gf_term_set_option(term, GF_OPT_PLAY_STATE, GF_STATE_STEP_PAUSE); - fprintf(stderr, "Step time: "); - PrintTime(gf_term_get_time_in_ms(term)); - fprintf(stderr, "\n"); - } - break; - case GF_KEY_B: - if ((evt->key.flags & GF_KEY_MOD_CTRL) && is_connected) - ViewODs(term, 1); - break; - case GF_KEY_M: - if ((evt->key.flags & GF_KEY_MOD_CTRL) && is_connected) - ViewODs(term, 0); - break; - case GF_KEY_H: - if ((evt->key.flags & GF_KEY_MOD_CTRL) && is_connected) - gf_term_switch_quality(term, 1); - break; - case GF_KEY_L: - if ((evt->key.flags & GF_KEY_MOD_CTRL) && is_connected) - gf_term_switch_quality(term, 0); - break; - } - break; - - case GF_EVENT_CONNECT: - if (evt->connect.is_connected) { - is_connected = 1; - fprintf(stderr, "Service Connected\n"); - } else if (is_connected) { - fprintf(stderr, "Service %s\n", is_connected ? "Disconnected" : "Connection Failed"); - is_connected = 0; - Duration = 0; - } - if (init_w && init_h) { - gf_term_set_size(term, init_w, init_h); - } - ResetCaption(); - break; - case GF_EVENT_EOS: - restart = 1; - break; - case GF_EVENT_SIZE: - if (user.init_flags & GF_TERM_WINDOWLESS) { - GF_Event move; - move.type = GF_EVENT_MOVE; - move.move.align_x = align_mode & 0xFF; - move.move.align_y = (align_mode>>8) & 0xFF; - move.move.relative = 2; - gf_term_user_event(term, &move); - } - break; - case GF_EVENT_SCENE_SIZE: - if (forced_width && forced_height) { - GF_Event size; - size.type = GF_EVENT_SIZE; - size.size.width = forced_width; - size.size.height = forced_height; - gf_term_user_event(term, &size); - } - break; - - case GF_EVENT_METADATA: - ResetCaption(); - break; - - case GF_EVENT_QUIT: - Run = 0; - break; - case GF_EVENT_DISCONNECT: - gf_term_disconnect(term); - break; - case GF_EVENT_MIGRATE: - { - } - break; - case GF_EVENT_NAVIGATE_INFO: - if (evt->navigate.to_url) fprintf(stderr, "Go to URL: \"%s\"\r", evt->navigate.to_url); - break; - case GF_EVENT_NAVIGATE: - if (gf_term_is_supported_url(term, evt->navigate.to_url, 1, no_mime_check)) { - strcpy(the_url, evt->navigate.to_url); - fprintf(stderr, "Navigating to URL %s\n", the_url); - gf_term_navigate_to(term, evt->navigate.to_url); - return 1; - } else { - fprintf(stderr, "Navigation destination not supported\nGo to URL: %s\n", evt->navigate.to_url); - } - break; - case GF_EVENT_SET_CAPTION: - gf_term_user_event(term, evt); - break; - case GF_EVENT_AUTHORIZATION: - if (!strlen(evt->auth.user)) { - fprintf(stderr, "Authorization required for site %s\n", evt->auth.site_url); - fprintf(stderr, "login: "); - scanf("%s", evt->auth.user); - } else { - fprintf(stderr, "Authorization required for %s@%s\n", evt->auth.user, evt->auth.site_url); - } - fprintf(stderr, "password: "); - gf_prompt_set_echo_off(1); - scanf("%s", evt->auth.password); - gf_prompt_set_echo_off(0); - return 1; - case GF_EVENT_SYS_COLORS: -#ifdef WIN32 - evt->sys_cols.sys_colors[0] = get_sys_col(COLOR_ACTIVEBORDER); - evt->sys_cols.sys_colors[1] = get_sys_col(COLOR_ACTIVECAPTION); - evt->sys_cols.sys_colors[2] = get_sys_col(COLOR_APPWORKSPACE); - evt->sys_cols.sys_colors[3] = get_sys_col(COLOR_BACKGROUND); - evt->sys_cols.sys_colors[4] = get_sys_col(COLOR_BTNFACE); - evt->sys_cols.sys_colors[5] = get_sys_col(COLOR_BTNHIGHLIGHT); - evt->sys_cols.sys_colors[6] = get_sys_col(COLOR_BTNSHADOW); - evt->sys_cols.sys_colors[7] = get_sys_col(COLOR_BTNTEXT); - evt->sys_cols.sys_colors[8] = get_sys_col(COLOR_CAPTIONTEXT); - evt->sys_cols.sys_colors[9] = get_sys_col(COLOR_GRAYTEXT); - evt->sys_cols.sys_colors[10] = get_sys_col(COLOR_HIGHLIGHT); - evt->sys_cols.sys_colors[11] = get_sys_col(COLOR_HIGHLIGHTTEXT); - evt->sys_cols.sys_colors[12] = get_sys_col(COLOR_INACTIVEBORDER); - evt->sys_cols.sys_colors[13] = get_sys_col(COLOR_INACTIVECAPTION); - evt->sys_cols.sys_colors[14] = get_sys_col(COLOR_INACTIVECAPTIONTEXT); - evt->sys_cols.sys_colors[15] = get_sys_col(COLOR_INFOBK); - evt->sys_cols.sys_colors[16] = get_sys_col(COLOR_INFOTEXT); - evt->sys_cols.sys_colors[17] = get_sys_col(COLOR_MENU); - evt->sys_cols.sys_colors[18] = get_sys_col(COLOR_MENUTEXT); - evt->sys_cols.sys_colors[19] = get_sys_col(COLOR_SCROLLBAR); - evt->sys_cols.sys_colors[20] = get_sys_col(COLOR_3DDKSHADOW); - evt->sys_cols.sys_colors[21] = get_sys_col(COLOR_3DFACE); - evt->sys_cols.sys_colors[22] = get_sys_col(COLOR_3DHIGHLIGHT); - evt->sys_cols.sys_colors[23] = get_sys_col(COLOR_3DLIGHT); - evt->sys_cols.sys_colors[24] = get_sys_col(COLOR_3DSHADOW); - evt->sys_cols.sys_colors[25] = get_sys_col(COLOR_WINDOW); - evt->sys_cols.sys_colors[26] = get_sys_col(COLOR_WINDOWFRAME); - evt->sys_cols.sys_colors[27] = get_sys_col(COLOR_WINDOWTEXT); - return 1; -#else - memset(evt->sys_cols.sys_colors, 0, sizeof(u32)*28); - return 1; -#endif - break; - } - return 0; -} - - -void list_modules(GF_ModuleManager *modules) -{ - u32 i; - fprintf(stderr, "\rAvailable modules:\n"); - for (i=0; isimulation_time)) { - Run = 0; - } - continue; - } - c = gf_prompt_get_char(); - -force_input: - switch (c) { - case 'q': - Run = 0; - break; - case 'X': - exit(0); - break; - case 'Q': - break; - case 'o': - startup_file = 0; - gf_term_disconnect(term); - fprintf(stdout, "Enter the absolute URL\n"); - scanf("%s", the_url); - if (rti_file) init_rti_logs(rti_file, the_url, use_rtix); - gf_term_connect(term, the_url); - break; - case 'O': - gf_term_disconnect(term); - fprintf(stdout, "Enter the absolute URL to the playlist\n"); - scanf("%s", the_url); - playlist = gf_f64_open(the_url, "rt"); - if (playlist) { - fscanf(playlist, "%s", the_url); - fprintf(stdout, "Opening URL %s\n", the_url); - gf_term_connect(term, the_url); - } - break; - case '\n': - case 'N': - if (playlist) { - gf_term_disconnect(term); - - if (fscanf(playlist, "%s", the_url) == EOF) { - fprintf(stdout, "No more items - exiting\n"); - Run = 0; - } else { - fprintf(stdout, "Opening URL %s\n", the_url); - gf_term_connect_with_path(term, the_url, pl_path); - } - } - break; - case 'P': - if (playlist) { - u32 count; - gf_term_disconnect(term); - scanf("%d", &count); - while (count) { - fscanf(playlist, "%s", the_url); - count--; - } - fprintf(stdout, "Opening URL %s\n", the_url); - gf_term_connect(term, the_url); - } - break; - case 'r': - if (is_connected) { - gf_term_disconnect(term); - gf_term_connect(term, startup_file ? gf_cfg_get_key(cfg_file, "General", "StartupFile") : the_url); - } - break; - - case 'D': - if (is_connected) gf_term_disconnect(term); - break; - - case 'p': - if (is_connected) { - Bool is_pause = gf_term_get_option(term, GF_OPT_PLAY_STATE); - fprintf(stdout, "[Status: %s]\n", is_pause ? "Playing" : "Paused"); - gf_term_set_option(term, GF_OPT_PLAY_STATE, is_pause ? GF_STATE_PLAYING : GF_STATE_PAUSED); - } - break; - case 's': - if (is_connected) { - gf_term_set_option(term, GF_OPT_PLAY_STATE, GF_STATE_STEP_PAUSE); - fprintf(stdout, "Step time: "); - PrintTime(gf_term_get_time_in_ms(term)); - fprintf(stdout, "\n"); - } - break; - - case 'z': - if (!CanSeek || (Duration<=2000)) { - fprintf(stdout, "scene not seekable\n"); - } else { - Double res; - s32 seekTo; - fprintf(stdout, "Duration: "); - PrintTime(Duration); - res = gf_term_get_time_in_ms(term); - res *= 100; res /= (s64)Duration; - fprintf(stdout, " (current %.2f %%)\nEnter Seek percentage:\n", res); - if (scanf("%d", &seekTo) == 1) { - if (seekTo > 100) seekTo = 100; - res = (Double)(s64)Duration; res /= 100; res *= seekTo; - gf_term_play_from_time(term, (u64) (s64) res, 0); - } - } - break; - - case 't': - { - if (is_connected) { - fprintf(stdout, "Current Time: "); - PrintTime(gf_term_get_time_in_ms(term)); - fprintf(stdout, " - Duration: "); - PrintTime(Duration); - fprintf(stdout, "\n"); - } - } - break; - case 'w': - if (is_connected) PrintWorldInfo(term); - break; - case 'v': - if (is_connected) PrintODList(term, NULL, 0, 0, "Root"); - break; - case 'i': - if (is_connected) { - u32 ID; - fprintf(stdout, "Enter OD ID (0 for main OD): "); - fflush(stdout); - scanf("%d", &ID); - ViewOD(term, ID, (u32)-1); - } - break; - case 'j': - if (is_connected) { - u32 num; - fprintf(stdout, "Enter OD number (0 for main OD): "); - fflush(stdout); - scanf("%d", &num); - ViewOD(term, (u32)-1, num); - } - break; - case 'b': - if (is_connected) ViewODs(term, 1); - break; - - case 'm': - if (is_connected) ViewODs(term, 0); - break; - - case 'l': - list_modules(user.modules); - break; - - case 'n': - if (is_connected) set_navigation(); - break; - case 'x': - if (is_connected) gf_term_set_option(term, GF_OPT_NAVIGATION_TYPE, 0); - break; - - case 'd': - if (is_connected) { - GF_ObjectManager *odm = NULL; - char radname[GF_MAX_PATH], *sExt; - GF_Err e; - u32 i, count, odid; - Bool xml_dump, std_out; - fprintf(stdout, "Enter Inline OD ID if any or 0"); - fflush(stdout); - radname[0] = 0; - scanf("%d", &odid); - if (odid) { - GF_ObjectManager *root_odm = gf_term_get_root_object(term); - if (!root_odm) break; - count = gf_term_get_object_count(term, root_odm); - for (i=0; iobjectDescriptorID==odid) break; - } - odm = NULL; - } - } - fprintf(stdout, "Enter file radical name (+\'.x\' for XML dumping) - \"std\" for stdout: "); - fflush(stdout); - scanf("%s", radname); - sExt = strrchr(radname, '.'); - xml_dump = 0; - if (sExt) { - if (!stricmp(sExt, ".x")) xml_dump = 1; - sExt[0] = 0; - } - std_out = strnicmp(radname, "std", 3) ? 0 : 1; - e = gf_term_dump_scene(term, std_out ? NULL : radname, NULL, xml_dump, 0, odm); - fprintf(stdout, "Dump done (%s)\n", gf_error_to_string(e)); - } - break; - - case 'c': - PrintGPACConfig(); - break; - case '3': - { - Bool use_3d = !gf_term_get_option(term, GF_OPT_USE_OPENGL); - if (gf_term_set_option(term, GF_OPT_USE_OPENGL, use_3d)==GF_OK) { - fprintf(stdout, "Using %s for 2D drawing\n", use_3d ? "OpenGL" : "2D rasterizer"); - } - } - break; - case 'k': - { - Bool opt = gf_term_get_option(term, GF_OPT_STRESS_MODE); - opt = !opt; - fprintf(stdout, "Turning stress mode %s\n", opt ? "on" : "off"); - gf_term_set_option(term, GF_OPT_STRESS_MODE, opt); - } - break; - case '4': gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_4_3); break; - case '5': gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_16_9); break; - case '6': gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_FILL_SCREEN); break; - case '7': gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_KEEP); break; - - case 'C': - switch (gf_term_get_option(term, GF_OPT_MEDIA_CACHE)) { - case GF_MEDIA_CACHE_DISABLED: gf_term_set_option(term, GF_OPT_MEDIA_CACHE, GF_MEDIA_CACHE_ENABLED); break; - case GF_MEDIA_CACHE_ENABLED: gf_term_set_option(term, GF_OPT_MEDIA_CACHE, GF_MEDIA_CACHE_DISABLED); break; - case GF_MEDIA_CACHE_RUNNING: fprintf(stdout, "Streaming Cache is running - please stop it first\n"); continue; - } - switch (gf_term_get_option(term, GF_OPT_MEDIA_CACHE)) { - case GF_MEDIA_CACHE_ENABLED: fprintf(stdout, "Streaming Cache Enabled\n"); break; - case GF_MEDIA_CACHE_DISABLED: fprintf(stdout, "Streaming Cache Disabled\n"); break; - case GF_MEDIA_CACHE_RUNNING: fprintf(stdout, "Streaming Cache Running\n"); break; - } - break; - case 'S': - case 'A': - if (gf_term_get_option(term, GF_OPT_MEDIA_CACHE)==GF_MEDIA_CACHE_RUNNING) { - gf_term_set_option(term, GF_OPT_MEDIA_CACHE, (c=='S') ? GF_MEDIA_CACHE_DISABLED : GF_MEDIA_CACHE_DISCARD); - fprintf(stdout, "Streaming Cache stopped\n"); - } else { - fprintf(stdout, "Streaming Cache not running\n"); - } - break; - case 'R': - display_rti = !display_rti; - ResetCaption(); - break; - case 'F': - if (display_rti) display_rti = 0; - else display_rti = 2; - ResetCaption(); - break; - - case 'u': - { - GF_Err e; - char szCom[8192]; - fprintf(stdout, "Enter command to send:\n"); - fflush(stdin); - szCom[0] = 0; - scanf("%[^\t\n]", szCom); - e = gf_term_scene_update(term, NULL, szCom); - if (e) fprintf(stdout, "Processing command failed: %s\n", gf_error_to_string(e)); - } - break; - - case 'L': - { - char szLog[1024]; - fprintf(stdout, "Enter new log level:\n"); - scanf("%s", szLog); - gf_log_modify_tools_levels( szLog ); - } - break; - case 'g': - { - GF_SystemRTInfo rti; - gf_sys_get_rti(rti_update_time_ms, &rti, 0); - fprintf(stdout, "GPAC allocated memory "LLD"\n", rti.gpac_memory); - } - break; - case 'M': - { - u32 size; - fprintf(stdout, "Enter new video cache memory in kBytes (current %d):\n", gf_term_get_option(term, GF_OPT_VIDEO_CACHE_SIZE)); - scanf("%d", &size); - gf_term_set_option(term, GF_OPT_VIDEO_CACHE_SIZE, size); - } - break; - - case 'E': - gf_term_set_option(term, GF_OPT_RELOAD_CONFIG, 1); - break; - - case 'B': - switch_bench(); - break; - - /*extract to PNG*/ - case 'Z': - { - GF_VideoSurface fb; - GF_Err e; - e = gf_term_get_screen_buffer(term, &fb); - if (e) { - fprintf(stdout, "Error dumping screen buffer %s\n", gf_error_to_string(e) ); - } else { - u32 dst_size = fb.width*fb.height*3; - char *dst=malloc(sizeof(char)*dst_size); - - e = gf_img_png_enc(fb.video_buffer, fb.width, fb.height, fb.pitch_y, fb.pixel_format, dst, &dst_size); - if (e) { - fprintf(stdout, "Error encoding PNG %s\n", gf_error_to_string(e) ); - } else { - FILE *png = gf_f64_open("dump.png", "wb"); - if (!png) { - fprintf(stdout, "Error writing file dump.png\n"); - } else { - gf_fwrite(dst, dst_size, 1, png); - fclose(png); - fprintf(stdout, "Writing file dump.png\n"); - } - } - if (dst) free(dst); - gf_term_release_screen_buffer(term, &fb); - } - } - break; - - case 'h': - PrintHelp(); - break; - default: - break; - } - } - - gf_term_disconnect(term); - if (rti_file) UpdateRTInfo("Disconnected\n"); - - fprintf(stdout, "Deleting terminal... "); - if (playlist) fclose(playlist); - gf_term_del(term); - fprintf(stdout, "OK\n"); - - fprintf(stdout, "GPAC cleanup ...\n"); - gf_modules_del(user.modules); - gf_cfg_del(cfg_file); - -#ifdef GPAC_MEMORY_TRACKING - if (enable_mem_tracker) { - gf_memory_print(); - fprintf(stdout, "print any key\n"); - while (!gf_prompt_has_input()) { - gf_sleep(100); - } - } -#endif - - gf_sys_close(); - if (rti_logs) fclose(rti_logs); - if (logfile) fclose(logfile); - fprintf(stdout, "Bye\n"); - return 0; -} - -void PrintWorldInfo(GF_Terminal *term) -{ - u32 i; - const char *title; - GF_List *descs; - descs = gf_list_new(); - title = gf_term_get_world_info(term, NULL, descs); - if (!title && !gf_list_count(descs)) { - fprintf(stdout, "No World Info available\n"); - } else { - fprintf(stdout, "\t%s\n", title ? title : "No title available"); - for (i=0; iobjectDescriptorID); - } - - szIndent[indent]=' '; - szIndent[indent+1]=0; - indent++; - - count = gf_term_get_object_count(term, root_odm); - for (i=0; iobjectDescriptorID); - } - fprintf(stdout, " - %s\n", (odi.od_type==GF_STREAM_VISUAL) ? "Video" : (odi.od_type==GF_STREAM_AUDIO) ? "Audio" : "Systems"); - break; - } - } - } -} - -void ViewOD(GF_Terminal *term, u32 OD_ID, u32 number) -{ - GF_MediaInfo odi; - u32 i, j, count, d_enum,id; - GF_Err e; - char code[5]; - NetStatCommand com; - GF_ObjectManager *odm, *root_odm = gf_term_get_root_object(term); - if (!root_odm) return; - - odm = NULL; - if ((!OD_ID && (number == (u32)(-1))) || - ((OD_ID == (u32)(-1)) && !number)) { - odm = root_odm; - if ((gf_term_get_object_info(term, odm, &odi) != GF_OK)) odm=NULL; - } else { - count = gf_term_get_object_count(term, root_odm); - for (i=0; iobjectDescriptorID == OD_ID)) break; - else if (i == (u32)(number-1)) break; - } - odm = NULL; - } - } - if (!odm) { - if (number == (u32)-1) fprintf(stdout, "cannot find OD with ID %d\n", OD_ID); - else fprintf(stdout, "cannot find OD with number %d\n", number); - return; - } - if (!odi.od) { - if (number == (u32)-1) fprintf(stdout, "Object %d not attached yet\n", OD_ID); - else fprintf(stdout, "Object #%d not attached yet\n", number); - return; - } - - if (!odi.od) { - fprintf(stdout, "Service not attached\n"); - return; - } - - if (odi.od->tag==GF_ODF_IOD_TAG) { - fprintf(stdout, "InitialObjectDescriptor %d\n", odi.od->objectDescriptorID); - fprintf(stdout, "Profiles and Levels: Scene %x - Graphics %x - Visual %x - Audio %x - OD %x\n", - odi.scene_pl, odi.graphics_pl, odi.visual_pl, odi.audio_pl, odi.OD_pl); - fprintf(stdout, "Inline Profile Flag %d\n", odi.inline_pl); - } else { - fprintf(stdout, "ObjectDescriptor %d\n", odi.od->objectDescriptorID); - } - - fprintf(stdout, "Object Duration: "); - if (odi.duration) { - PrintTime((u32) (odi.duration*1000)); - } else { - fprintf(stdout, "unknown"); - } - fprintf(stdout, "\n"); - - if (odi.owns_service) { - fprintf(stdout, "Service Handler: %s\n", odi.service_handler); - fprintf(stdout, "Service URL: %s\n", odi.service_url); - } - if (odi.codec_name) { - Float avg_dec_time; - switch (odi.od_type) { - case GF_STREAM_VISUAL: - fprintf(stdout, "Video Object: Width %d - Height %d\r\n", odi.width, odi.height); - fprintf(stdout, "Media Codec: %s\n", odi.codec_name); - if (odi.par) fprintf(stdout, "Pixel Aspect Ratio: %d:%d\n", (odi.par>>16)&0xFF, (odi.par)&0xFF); - break; - case GF_STREAM_AUDIO: - fprintf(stdout, "Audio Object: Sample Rate %d - %d channels\r\n", odi.sample_rate, odi.num_channels); - fprintf(stdout, "Media Codec: %s\n", odi.codec_name); - break; - case GF_STREAM_SCENE: - case GF_STREAM_PRIVATE_SCENE: - if (odi.width && odi.height) { - fprintf(stdout, "Scene Description - Width %d - Height %d\n", odi.width, odi.height); - } else { - fprintf(stdout, "Scene Description - no size specified\n"); - } - fprintf(stdout, "Scene Codec: %s\n", odi.codec_name); - break; - case GF_STREAM_TEXT: - if (odi.width && odi.height) { - fprintf(stdout, "Text Object: Width %d - Height %d\n", odi.width, odi.height); - } else { - fprintf(stdout, "Text Object: No size specified\n"); - } - fprintf(stdout, "Text Codec %s\n", odi.codec_name); - break; - } - - avg_dec_time = 0; - if (odi.nb_dec_frames) { - avg_dec_time = (Float) odi.total_dec_time; - avg_dec_time /= odi.nb_dec_frames; - } - fprintf(stdout, "\tBitrate over last second: %d kbps\n\tMax bitrate over one second: %d kbps\n\tAverage Decoding Time %.2f ms (%d max)\n\tTotal decoded frames %d\n", - (u32) odi.avg_bitrate/1024, odi.max_bitrate/1024, avg_dec_time, odi.max_dec_time, odi.nb_dec_frames); - } - if (odi.protection) fprintf(stdout, "Encrypted Media%s\n", (odi.protection==2) ? " NOT UNLOCKED" : ""); - - count = gf_list_count(odi.od->ESDescriptors); - fprintf(stdout, "%d streams in OD\n", count); - for (i=0; iESDescriptors, i); - - fprintf(stdout, "\nStream ID %d - Clock ID %d\n", esd->ESID, esd->OCRESID); - if (esd->dependsOnESID) fprintf(stdout, "\tDepends on Stream ID %d for decoding\n", esd->dependsOnESID); - - switch (esd->decoderConfig->streamType) { - case GF_STREAM_OD: fprintf(stdout, "\tOD Stream - version %d\n", esd->decoderConfig->objectTypeIndication); break; - case GF_STREAM_OCR: fprintf(stdout, "\tOCR Stream\n"); break; - case GF_STREAM_SCENE: fprintf(stdout, "\tScene Description Stream - version %d\n", esd->decoderConfig->objectTypeIndication); break; - case GF_STREAM_VISUAL: - fprintf(stdout, "\tVisual Stream - media type: "); - switch (esd->decoderConfig->objectTypeIndication) { - case GPAC_OTI_VIDEO_MPEG4_PART2: fprintf(stdout, "MPEG-4\n"); break; - case GPAC_OTI_VIDEO_MPEG2_SIMPLE: fprintf(stdout, "MPEG-2 Simple Profile\n"); break; - case GPAC_OTI_VIDEO_MPEG2_MAIN: fprintf(stdout, "MPEG-2 Main Profile\n"); break; - case GPAC_OTI_VIDEO_MPEG2_SNR: fprintf(stdout, "MPEG-2 SNR Profile\n"); break; - case GPAC_OTI_VIDEO_MPEG2_SPATIAL: fprintf(stdout, "MPEG-2 Spatial Profile\n"); break; - case GPAC_OTI_VIDEO_MPEG2_HIGH: fprintf(stdout, "MPEG-2 High Profile\n"); break; - case GPAC_OTI_VIDEO_MPEG2_422: fprintf(stdout, "MPEG-2 422 Profile\n"); break; - case GPAC_OTI_VIDEO_MPEG1: fprintf(stdout, "MPEG-1\n"); break; - case GPAC_OTI_IMAGE_JPEG: fprintf(stdout, "JPEG\n"); break; - case GPAC_OTI_IMAGE_PNG: fprintf(stdout, "PNG\n"); break; - case GPAC_OTI_IMAGE_JPEG_2000: fprintf(stdout, "JPEG2000\n"); break; - - case GPAC_OTI_MEDIA_GENERIC: - memcpy(code, esd->decoderConfig->decoderSpecificInfo->data, 4); - code[4] = 0; - fprintf(stdout, "GPAC Intern (%s)\n", code); - break; - default: - fprintf(stdout, "Private Type (0x%x)\n", esd->decoderConfig->objectTypeIndication); - break; - } - break; - - case GF_STREAM_AUDIO: - fprintf(stdout, "\tAudio Stream - media type: "); - switch (esd->decoderConfig->objectTypeIndication) { - case GPAC_OTI_AUDIO_AAC_MPEG4: fprintf(stdout, "MPEG-4\n"); break; - case GPAC_OTI_AUDIO_AAC_MPEG2_MP: fprintf(stdout, "MPEG-2 AAC Main Profile\n"); break; - case GPAC_OTI_AUDIO_AAC_MPEG2_LCP: fprintf(stdout, "MPEG-2 AAC LowComplexity Profile\n"); break; - case GPAC_OTI_AUDIO_AAC_MPEG2_SSRP: fprintf(stdout, "MPEG-2 AAC Scalable Sampling Rate Profile\n"); break; - case GPAC_OTI_AUDIO_MPEG2_PART3: fprintf(stdout, "MPEG-2 Audio\n"); break; - case GPAC_OTI_AUDIO_MPEG1: fprintf(stdout, "MPEG-1 Audio\n"); break; - case GPAC_OTI_AUDIO_EVRC_VOICE: fprintf(stdout, "EVRC Audio\n"); break; - case GPAC_OTI_AUDIO_SMV_VOICE: fprintf(stdout, "SMV Audio\n"); break; - case GPAC_OTI_AUDIO_13K_VOICE: fprintf(stdout, "QCELP Audio\n"); break; - case GPAC_OTI_MEDIA_GENERIC: - memcpy(code, esd->decoderConfig->decoderSpecificInfo->data, 4); - code[4] = 0; - fprintf(stdout, "GPAC Intern (%s)\n", code); - break; - default: - fprintf(stdout, "Private Type (0x%x)\n", esd->decoderConfig->objectTypeIndication); - break; - } - break; - case GF_STREAM_MPEG7: fprintf(stdout, "\tMPEG-7 Stream - version %d\n", esd->decoderConfig->objectTypeIndication); break; - case GF_STREAM_IPMP: fprintf(stdout, "\tIPMP Stream - version %d\n", esd->decoderConfig->objectTypeIndication); break; - case GF_STREAM_OCI: fprintf(stdout, "\tOCI Stream - version %d\n", esd->decoderConfig->objectTypeIndication); break; - case GF_STREAM_MPEGJ: fprintf(stdout, "\tMPEGJ Stream - version %d\n", esd->decoderConfig->objectTypeIndication); break; - case GF_STREAM_INTERACT: fprintf(stdout, "\tUser Interaction Stream - version %d\n", esd->decoderConfig->objectTypeIndication); break; - case GF_STREAM_TEXT: fprintf(stdout, "\tStreaming Text Stream - version %d\n", esd->decoderConfig->objectTypeIndication); break; - default: fprintf(stdout, "Unknown Stream\r\n"); break; - } - - fprintf(stdout, "\tBuffer Size %d\n\tAverage Bitrate %d bps\n\tMaximum Bitrate %d bps\n", esd->decoderConfig->bufferSizeDB, esd->decoderConfig->avgBitrate, esd->decoderConfig->maxBitrate); - if (esd->slConfig->predefined==SLPredef_SkipSL) { - fprintf(stdout, "\tNot using MPEG-4 Synchronization Layer\n"); - } else { - fprintf(stdout, "\tStream Clock Resolution %d\n", esd->slConfig->timestampResolution); - } - if (esd->URLString) fprintf(stdout, "\tStream Location: %s\n", esd->URLString); - - /*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; - } - } - fprintf(stdout, "\tStream Language: %s\n", szLang); - } - } - fprintf(stdout, "\n"); - /*check OCI (not everything interests us) - FIXME: support for unicode*/ - count = gf_list_count(odi.od->OCIDescriptors); - if (count) { - fprintf(stdout, "%d Object Content Information descriptors in OD\n", count); - for (i=0; iOCIDescriptors, i); - switch (desc->tag) { - case GF_ODF_SEGMENT_TAG: - { - GF_Segment *sd = (GF_Segment *) desc; - fprintf(stdout, "Segment Descriptor: Name: %s - start time %g sec - duration %g sec\n", sd->SegmentName, sd->startTime, sd->Duration); - } - break; - case GF_ODF_CC_NAME_TAG: - { - GF_CC_Name *ccn = (GF_CC_Name *)desc; - fprintf(stdout, "Content Creators:\n"); - for (j=0; jContentCreators); j++) { - GF_ContentCreatorInfo *ci = (GF_ContentCreatorInfo *) gf_list_get(ccn->ContentCreators, j); - if (!ci->isUTF8) continue; - fprintf(stdout, "\t%s\n", ci->contentCreatorName); - } - } - break; - - case GF_ODF_SHORT_TEXT_TAG: - { - GF_ShortTextual *std = (GF_ShortTextual *)desc; - fprintf(stdout, "Description:\n\tEvent: %s\n\t%s\n", std->eventName, std->eventText); - } - break; - default: - break; - } - } - fprintf(stdout, "\n"); - } - - switch (odi.status) { - case 0: fprintf(stdout, "Stopped - "); break; - case 1: fprintf(stdout, "Playing - "); break; - case 2: fprintf(stdout, "Paused - "); break; - case 3: fprintf(stdout, "Not setup yet\n"); return; - default: fprintf(stdout, "Setup Failed\n"); return; - } - if (odi.buffer>=0) fprintf(stdout, "Buffer: %d ms - ", odi.buffer); - else fprintf(stdout, "Not buffering - "); - fprintf(stdout, "Clock drift: %d ms\n", odi.clock_drift); - if (odi.db_unit_count) fprintf(stdout, "%d AU in DB\n", odi.db_unit_count); - if (odi.cb_max_count) fprintf(stdout, "Composition Buffer: %d CU (%d max)\n", odi.cb_unit_count, odi.cb_max_count); - fprintf(stdout, "\n"); - - if (odi.owns_service) { - const char *url; - u32 done, total, bps; - d_enum = 0; - while (gf_term_get_download_info(term, odm, &d_enum, &url, NULL, &done, &total, &bps)) { - if (d_enum==1) fprintf(stdout, "Current Downloads in service:\n"); - if (done && total) { - fprintf(stdout, "%s: %d / %d bytes (%.2f %%) - %.2f kBps\n", url, done, total, (100.0f*done)/total, ((Float)bps)/1024.0f); - } else { - fprintf(stdout, "%s: %.2f kbps\n", url, ((Float)8*bps)/1024.0f); - } - } - if (!d_enum) fprintf(stdout, "No Downloads in service\n"); - fprintf(stdout, "\n"); - } - d_enum = 0; - while (gf_term_get_channel_net_info(term, odm, &d_enum, &id, &com, &e)) { - if (e) continue; - if (!com.bw_down && !com.bw_up) continue; - - fprintf(stdout, "Stream ID %d statistics:\n", id); - if (com.multiplex_port) { - fprintf(stdout, "\tMultiplex Port %d - multiplex ID %d\n", com.multiplex_port, com.port); - } else { - fprintf(stdout, "\tPort %d\n", com.port); - } - fprintf(stdout, "\tPacket Loss Percentage: %.4f\n", com.pck_loss_percentage); - fprintf(stdout, "\tDown Bandwidth: %d bps\n", com.bw_down); - if (com.bw_up) fprintf(stdout, "\tUp Bandwidth: %d bps\n", com.bw_up); - if (com.ctrl_port) { - if (com.multiplex_port) { - fprintf(stdout, "\tControl Multiplex Port: %d - Control Multiplex ID %d\n", com.multiplex_port, com.ctrl_port); - } else { - fprintf(stdout, "\tControl Port: %d\n", com.ctrl_port); - } - fprintf(stdout, "\tDown Bandwidth: %d bps\n", com.ctrl_bw_down); - fprintf(stdout, "\tUp Bandwidth: %d bps\n", com.ctrl_bw_up); - } - fprintf(stdout, "\n"); - } -} - -void PrintODTiming(GF_Terminal *term, GF_ObjectManager *odm) -{ - GF_MediaInfo odi; - if (!odm) return; - - if (gf_term_get_object_info(term, odm, &odi) != GF_OK) return; - if (!odi.od) { - fprintf(stdout, "Service not attached\n"); - return; - } - - fprintf(stdout, "OD %d: ", odi.od->objectDescriptorID); - switch (odi.status) { - case 1: fprintf(stdout, "Playing - "); break; - case 2: fprintf(stdout, "Paused - "); break; - default: fprintf(stdout, "Stopped - "); break; - } - if (odi.buffer>=0) fprintf(stdout, "Buffer: %d ms - ", odi.buffer); - else fprintf(stdout, "Not buffering - "); - fprintf(stdout, "Clock drift: %d ms", odi.clock_drift); - fprintf(stdout, " - time: "); - PrintTime((u32) (odi.current_time*1000)); - fprintf(stdout, "\n"); -} - -void PrintODBuffer(GF_Terminal *term, GF_ObjectManager *odm) -{ - Float avg_dec_time; - GF_MediaInfo odi; - if (!odm) return; - - if (gf_term_get_object_info(term, odm, &odi) != GF_OK) return; - if (!odi.od) { - fprintf(stdout, "Service not attached\n"); - return; - } - - fprintf(stdout, "OD %d: ", odi.od->objectDescriptorID); - switch (odi.status) { - case 1: fprintf(stdout, "Playing"); break; - case 2: fprintf(stdout, "Paused"); break; - default: fprintf(stdout, "Stopped"); break; - } - if (odi.buffer>=0) fprintf(stdout, " - Buffer: %d ms", odi.buffer); - if (odi.db_unit_count) fprintf(stdout, " - DB: %d AU", odi.db_unit_count); - if (odi.cb_max_count) fprintf(stdout, " - CB: %d/%d CUs", odi.cb_unit_count, odi.cb_max_count); - - fprintf(stdout, "\n * %d decoded frames - %d dropped frames\n", odi.nb_dec_frames, odi.nb_droped); - avg_dec_time = 0; - if (odi.nb_dec_frames) { avg_dec_time = (Float) odi.total_dec_time; avg_dec_time /= odi.nb_dec_frames; } - fprintf(stdout, " * Avg Bitrate %d kbps (%d max) - Avg Decoding Time %.2f ms (%d max)\n", - (u32) odi.avg_bitrate/1024, odi.max_bitrate/1024, avg_dec_time, odi.max_dec_time); -} - -void ViewODs(GF_Terminal *term, Bool show_timing) -{ - u32 i, count; - GF_ObjectManager *odm, *root_odm = gf_term_get_root_object(term); - if (!root_odm) return; - - if (show_timing) { - PrintODTiming(term, root_odm); - } else { - PrintODBuffer(term, root_odm); - } - count = gf_term_get_object_count(term, root_odm); - for (i=0; i - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - com.gpac.${PRODUCT_NAME:identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Osmo4 - CFBundlePackageType - APPL - CFBundleShortVersionString - 9.9.9 - CFBundleSignature - gpac - CFBundleVersion - 9999 - - diff --git a/applications/osmo4_wx/Darwin.Info.plist b/applications/osmo4_wx/Darwin.Info.plist deleted file mode 100644 index 710c02d..0000000 --- a/applications/osmo4_wx/Darwin.Info.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - Osmo4 - CFBundleGetInfoString - Osmo4 0.4.2 - CFBundleIconFile - Osmo - CFBundleIdentifier - org.gpac.Osmo4 - CFBundleInfoDictionaryVersion - 0.4.2 - CFBundlePackageType - APPL - CFBundleShortVersionString - 0.4.2 - CFBundleSignature - Omo4 - CFBundleVersion - 0.4.2 - NSHumanReadableCopyright - Copyright (c) 2003-2005 gpac - NSMainNibFile - NSMainNibFile - NSPrincipalClass - NSApplication - - diff --git a/applications/osmo4_wx/Darwin.InfoPlist.strings b/applications/osmo4_wx/Darwin.InfoPlist.strings deleted file mode 100644 index 2efc670..0000000 Binary files a/applications/osmo4_wx/Darwin.InfoPlist.strings and /dev/null differ diff --git a/applications/osmo4_wx/Darwin.Osmo.icns b/applications/osmo4_wx/Darwin.Osmo.icns deleted file mode 100644 index a598061..0000000 Binary files a/applications/osmo4_wx/Darwin.Osmo.icns and /dev/null differ diff --git a/applications/osmo4_wx/Makefile b/applications/osmo4_wx/Makefile deleted file mode 100644 index e15bdac..0000000 --- a/applications/osmo4_wx/Makefile +++ /dev/null @@ -1,94 +0,0 @@ -include ../../config.mak - -vpath %.cpp $(SRC_PATH)/applications/osmo4_wx - -CFLAGS= $(CPPFLAGS) -I"$(SRC_PATH)/include" - -ifeq ($(DEBUGBUILD), yes) -CFLAGS+=-g -LDFLAGS+=-g -endif - -ifeq ($(GPROFBUILD), yes) -CFLAGS+=-pg -LDFLAGS+=-pg -endif - -ifeq ($(GPACREADONLY), yes) -CFLAGS+=-DGPAC_READ_ONLY -endif - -#common obj -OBJS= wxOsmo4.o wxGPACControl.o fileprops.o Playlist.o menubtn.o - -ifeq ($(CONFIG_WIN32),yes) -EXE=.exe -PROG=Osmo4$(EXE) -else -EXT= -PROG=Osmo4 -endif - -#3 - spidermonkey support -ifeq ($(CONFIG_JS),no) -else -SCENEGRAPH_CFLAGS+=$(JS_FLAGS) -ifeq ($(CONFIG_JS),local) -NEED_LOCAL_LIB="yes" -endif -LINKFLAGS+=$(JS_LIBS) -endif - - -SRCS := $(OBJS:.o=.cpp) - -all: $(PROG) - -Osmo4$(EXE): $(OBJS) - $(CC) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) -L../../bin/gcc -lgpac $(WX_LFLAGS) $(LINKFLAGS) - -%.o: %.cpp - $(CXX) $(CFLAGS) $(WX_CFLAGS) -c -o $@ $< - -clean: - rm -f $(OBJS) ../../bin/gcc/$(PROG) - -install: -ifeq ($(CONFIG_DARWIN),yes) - mkdir -p $(DESTDIR)$(mac_apps)/Osmo4.app/Contents/MacOS - mkdir -p $(DESTDIR)$(mac_apps)/Osmo4.app/Contents/Resources/English.lproj - cp ./Darwin.Info.plist \ - $(DESTDIR)$(mac_apps)/Osmo4.app/Contents/Info.plist - cp ./Darwin.InfoPlist.strings \ - $(DESTDIR)$(mac_apps)/Osmo4.app/Contents/Resources/English.lproj/InfoPlist.strings - cp ./Darwin.Osmo.icns \ - $(DESTDIR)$(mac_apps)/Osmo4.app/Contents/Resources/Osmo.icns - install -m 755 $(INSTFLAGS) ../../bin/gcc/Osmo4 \ - $(DESTDIR)$(mac_apps)/Osmo4.app/Contents/MacOS - echo -n 'APPLOsm4' > $(DESTDIR)$(mac_apps)/Osmo4.app/Contents/PkgInfo -else - rm -f wxOsmo4.o - mkdir -p $(DESTDIR)$(prefix)/bin - install -m 755 $(INSTFLAGS) ../../bin/gcc/Osmo4 "$(DESTDIR)$(prefix)/bin" -endif - -uninstall: - rm -rf $(DESTDIR)$(prefix)/bin/Osmo4 - -dep: - -depend: - rm -f .depend - $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend - -distclean: clean - rm -f Makefile.bak .depend - - - -# include dependency files if they exist -# -ifneq ($(wildcard .depend),) -include .depend -endif - diff --git a/applications/osmo4_wx/Playlist.cpp b/applications/osmo4_wx/Playlist.cpp deleted file mode 100644 index 7ed47a6..0000000 --- a/applications/osmo4_wx/Playlist.cpp +++ /dev/null @@ -1,826 +0,0 @@ -/* - * GPAC - Multimedia Framework C SDK - * - * Copyright (c) Jean Le Feuvre 2000-2005 - * All rights reserved - * - * This file is part of GPAC / Osmo4 wxWidgets GUI - * - * GPAC is gf_free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * GPAC is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - */ - -#include "wxOsmo4.h" -#include "Playlist.h" - - -#include "playlist.xpm" - -PLEntry::PLEntry(wxString url) -{ - m_url = gf_strdup(url.mb_str(wxConvUTF8)); - Bool is_remote = 0;; - wxCharBuffer the_url = (const char *) url.mb_str(wxConvUTF8); - const char *_url = strstr(the_url, "://"); - if (_url) {_url += 3; is_remote = 1; } - else _url = (const char *) the_url; - - char *str = (char*)strrchr(_url, '\\'); - if (!str) str = (char*)strrchr(_url, '/'); - if (str && strlen(str+1)) { - m_disp_name = gf_strdup(str+1); - str = strrchr(m_disp_name, '.'); - if (str) str[0] = 0; - } else { - m_disp_name = gf_strdup(_url); - if (!is_remote) { - str = strrchr(m_disp_name, '.'); - if (str) str[0] = 0; - } - } - m_duration = 0; - m_bIsDead = 0; - m_bIsPlaying = 0; - m_bIsSelected = 0; -} - -PLEntry::~PLEntry() -{ - if (m_url) gf_free(m_url); - if (m_disp_name) gf_free(m_disp_name); - -} - -wxPlaylist::wxPlaylist(wxWindow *parent) - : wxFrame(parent, -1, wxString(_T("Osmo4 Playlist")), wxDefaultPosition, wxDefaultSize, - wxCLOSE_BOX | wxSYSTEM_MENU | wxCAPTION | wxRESIZE_BORDER) -{ - - m_pApp = (wxOsmo4Frame *)parent; - - m_pOpen = new wxBitmap(pl_open); - m_pSave = new wxBitmap(pl_save); - m_pAdd = new wxBitmap(pl_add); - m_pRem = new wxBitmap(pl_rem); - m_pUp = new wxBitmap(pl_up); - m_pDown = new wxBitmap(pl_down); - m_pSort = new wxBitmap(pl_sort); - - m_pToolBar = CreateToolBar(wxTB_HORIZONTAL); - m_pAddBut = new wxMenuButton(m_pToolBar, ID_PL_ADD_FILE, *m_pAdd); - wxMenu *menu = new wxMenu(); - menu->Append(ID_PL_ADD_URL, wxT("&Url")); - menu->Append(ID_PL_ADD_DIR, wxT("&Directory")); - menu->Append(ID_PL_ADD_DIR_REC, wxT("&Directory and subfolders")); - m_pAddBut->AssignMenu(menu); - m_pAddBut->SetToolTip(wxString(wxT("Add Files"))); - - m_pRemBut = new wxMenuButton(m_pToolBar, ID_PL_REM_FILE, *m_pRem); - menu = new wxMenu(); - menu->Append(ID_PL_REM_ALL, wxT("&Clear")); - menu->Append(ID_PL_REM_DEAD, wxT("&Remove dead entries")); - m_pRemBut->AssignMenu(menu); - m_pRemBut->SetToolTip(wxString(wxT("Remove Selected Files"))); - - m_pSortBut = new wxMenuButton(m_pToolBar, ID_PL_SORT_FILE, *m_pSort); - menu = new wxMenu(); - menu->Append(ID_PL_SORT_TITLE, wxT("&Sort by Title")); - menu->Append(ID_PL_SORT_FILE, wxT("&Sort by file name")); - menu->Append(ID_PL_SORT_DUR, wxT("&Sort by Duration")); - menu->AppendSeparator(); - menu->Append(ID_PL_REVERSE, wxT("&Reverse")); - menu->Append(ID_PL_RANDOMIZE, wxT("&Randomize")); - m_pSortBut->AssignMenu(menu); - m_pSortBut->SetToolTip(wxString(wxT("Sort Playlist by filename"))); - - m_pToolBar->AddTool(ID_PL_OPEN, wxT(""), *m_pOpen, wxT("Open Playlist")); - m_pToolBar->AddTool(ID_PL_SAVE, wxT(""), *m_pSave, wxT("Save Playlist")); - m_pToolBar->AddSeparator(); - m_pToolBar->AddControl(m_pAddBut); - m_pToolBar->AddControl(m_pRemBut); - m_pToolBar->AddSeparator(); - m_pToolBar->AddTool(ID_PL_UP, wxT(""), *m_pUp, wxT("Moves Selected Files Up")); - m_pToolBar->AddTool(ID_PL_DOWN, wxT(""), *m_pDown, wxT("Moves Selected Files Down")); - m_pToolBar->AddSeparator(); - m_pToolBar->AddControl(m_pSortBut); - m_pToolBar->Realize(); - - m_FileList = new wxListCtrl(this, ID_FILE_LIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT); - - m_FileList->InsertColumn(0, wxT(""), wxLIST_FORMAT_LEFT, 1); - m_FileList->InsertColumn(1, wxT("Title"), wxLIST_FORMAT_LEFT, 1); - m_FileList->InsertColumn(2, wxT("Duration"), wxLIST_FORMAT_LEFT, 1); - - m_entries = gf_list_new(); - m_cur_entry = -1; - m_all_dead_entries = -1; - - SetSize(220, 380); - Centre(); -} - -wxPlaylist::~wxPlaylist() -{ - Clear(); - gf_list_del(m_entries); - delete m_pAddBut; - delete m_pRemBut; - delete m_pSortBut; - delete m_pOpen; - delete m_pSave; - delete m_pAdd; - delete m_pRem; - delete m_pUp; - delete m_pDown; - delete m_pSort; -} - - -BEGIN_EVENT_TABLE(wxPlaylist, wxWindow) - EVT_CLOSE(wxPlaylist::OnClose) - EVT_SIZE(wxPlaylist::OnSize) - EVT_TOOL(ID_PL_ADD_FILE, wxPlaylist::OnAddFile) - EVT_TOOL(ID_PL_ADD_URL, wxPlaylist::OnAddURL) - EVT_TOOL(ID_PL_ADD_DIR, wxPlaylist::OnAddDir) - EVT_TOOL(ID_PL_ADD_DIR_REC, wxPlaylist::OnAddDirRec) - EVT_TOOL(ID_PL_REM_FILE, wxPlaylist::OnRemFile) - EVT_TOOL(ID_PL_REM_ALL, wxPlaylist::OnRemAll) - EVT_TOOL(ID_PL_REM_DEAD, wxPlaylist::OnRemDead) - EVT_TOOL(ID_PL_UP, wxPlaylist::OnSelUp) - EVT_TOOL(ID_PL_DOWN, wxPlaylist::OnSelDown) - EVT_TOOL(ID_PL_SAVE, wxPlaylist::OnSave) - EVT_TOOL(ID_PL_OPEN, wxPlaylist::OnOpen) - EVT_MENU(ID_PL_PLAY, wxPlaylist::OnPlay) - EVT_MENU(ID_PL_RANDOMIZE, wxPlaylist::OnRandomize) - EVT_MENU(ID_PL_REVERSE, wxPlaylist::OnReverseList) - EVT_MENU(ID_PL_SEL_REV, wxPlaylist::OnReverseSelection) - EVT_MENU(ID_PL_SORT_TITLE, wxPlaylist::OnSortTitle) - EVT_MENU(ID_PL_SORT_FILE, wxPlaylist::OnSortFile) - EVT_MENU(ID_PL_SORT_DUR, wxPlaylist::OnSortDuration) - EVT_LIST_ITEM_ACTIVATED(ID_FILE_LIST, wxPlaylist::OnItemActivate) - EVT_LIST_ITEM_RIGHT_CLICK(ID_FILE_LIST, wxPlaylist::OnRightClick) -END_EVENT_TABLE() - -void wxPlaylist::OnClose(wxCloseEvent &event) -{ - if (event.CanVeto()) { - event.Veto(); - Hide(); - } -} - -void wxPlaylist::OnSize(wxSizeEvent &event) -{ - wxSize s = event.GetSize(); - m_FileList->SetSize(0, 0, s.GetWidth()-2, s.GetHeight()); - m_FileList->SetColumnWidth(0, 30); - m_FileList->SetColumnWidth(2, 60); - m_FileList->SetColumnWidth(1, s.GetWidth()-96); -} - -void wxPlaylist::Clear() -{ - m_FileList->DeleteAllItems(); - while (gf_list_count(m_entries)) { - PLEntry *ple = (PLEntry *) gf_list_get(m_entries, 0); - gf_list_rem(m_entries, 0); - delete ple; - } - m_cur_entry = -1; -} - -void wxPlaylist::ClearButPlaying() -{ - PLEntry *p = NULL; - if (m_cur_entry >= 0) { - p = (PLEntry *) gf_list_get(m_entries, m_cur_entry); - gf_list_rem(m_entries, m_cur_entry); - } - Clear(); - if (p) { - gf_list_add(m_entries, p); - m_cur_entry = 0; - } - RefreshList(); -} - -void wxPlaylist::UpdateEntry(u32 idx) -{ - char szText[20]; - - PLEntry *ple = (PLEntry *) gf_list_get(m_entries, idx); - if (idx+1<10) sprintf(szText, "00%d", idx+1); - else if (idx+1<100) sprintf(szText, "0%d", idx+1); - else sprintf(szText, "%d", idx+1); - m_FileList->SetItem(idx, 0, wxString(szText, wxConvUTF8)); - - wxString str; - if (ple->m_bIsDead) str = wxT("!! ") + wxString(ple->m_disp_name, wxConvUTF8) + wxT(" (DEAD)!!)"); - else if (ple->m_bIsPlaying) str = wxT(">> ") + wxString(ple->m_disp_name, wxConvUTF8) + wxT(" >>"); - else str = wxString(ple->m_disp_name, wxConvUTF8); - m_FileList->SetItem(idx, 1, str); - - if (ple->m_duration) { - u32 h = (u32) (ple->m_duration / 3600); - u32 m = (u32) (ple->m_duration / 60) - h*60; - u32 s = (u32) (ple->m_duration) - h*3600 - m*60; - m_FileList->SetItem(idx, 2, wxString::Format(wxT("%02d:%02d:%02d"), h, m, s) ); - } else { - m_FileList->SetItem(idx, 2, wxT("Unknown")); - } -} - -void wxPlaylist::RefreshList() -{ - u32 i, top_idx; - char szPath[GF_MAX_PATH]; - Bool first_sel; - - top_idx = m_FileList->GetTopItem(); - m_FileList->DeleteAllItems(); - - first_sel = 0; - for (i=0; iInsertItem(i, wxT("")); - /*cast for 64-bit compilation*/ - m_FileList->SetItemData(i, (unsigned long) ple); - UpdateEntry(i); - - if (ple->m_bIsPlaying) m_cur_entry = i; - - if (ple->m_bIsSelected) { - m_FileList->SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED | wxLIST_MASK_STATE); - ple->m_bIsSelected = 0; - /*ensure first item of selection is visible*/ - if (!first_sel) { - first_sel = 1; - top_idx = i; - } - } - } - - if (m_cur_entry >= (s32) gf_list_count(m_entries)-1) m_cur_entry = gf_list_count(m_entries)-1; - else { - s32 last_idx = top_idx + m_FileList->GetCountPerPage(); - m_FileList->EnsureVisible(top_idx); - if (gf_list_count(m_entries)<1+ (u32) last_idx) last_idx = gf_list_count(m_entries)-1; - m_FileList->EnsureVisible(last_idx); - } - - strcpy((char *) szPath, m_pApp->szAppPath); -#ifdef WIN32 - strcat(szPath, "gpac_pl.m3u"); -#else - strcat(szPath, ".gpac_pl.m3u"); -#endif - Save(szPath, 1); -} - -void wxPlaylist::OnAddFile(wxCommandEvent &WXUNUSED(event)) -{ - wxFileDialog dlg(this, wxT("Select file(s)"), wxT(""), wxT(""), m_pApp->GetFileFilter(), wxOPEN | wxCHANGE_DIR | /*wxHIDE_READONLY |*/ wxMULTIPLE); - - if (dlg.ShowModal() == wxID_OK) { - wxArrayString stra; - dlg.GetPaths(stra); - for (u32 i=0; im_pApp->m_term, item_name, 0, 1)) { - PLEntry *ple = new PLEntry(wxString(item_path, wxConvUTF8) ); - gf_list_add(_this->m_entries, ple); - } - return 0; -} - -static Bool pl_enum_dir_dirs(void *cbck, char *item_name, char *item_path) -{ - gf_enum_directory(item_path, 0, pl_enum_dir_item, cbck, NULL); - gf_enum_directory(item_path, 1, pl_enum_dir_dirs, cbck, NULL); - return 0; -} - - -void wxPlaylist::AddDir(Bool do_recurse) -{ - wxDirDialog dlg(this); - dlg.SetPath(wxString(szCacheDir, wxConvUTF8) ); - if (dlg.ShowModal() != wxID_OK) return; - - strcpy(szCacheDir, dlg.GetPath().mb_str(wxConvUTF8)); - gf_enum_directory(szCacheDir, 0, pl_enum_dir_item, this, NULL); - if (do_recurse) gf_enum_directory(szCacheDir, 1, pl_enum_dir_dirs, this, NULL); - m_all_dead_entries = -1; - RefreshList(); -} -void wxPlaylist::OnAddDir(wxCommandEvent &WXUNUSED(event)) -{ - AddDir(0); -} -void wxPlaylist::OnAddDirRec(wxCommandEvent &WXUNUSED(event)) -{ - AddDir(1); -} - -void wxPlaylist::OnAddURL(wxCommandEvent &WXUNUSED(event)) -{ - OpenURLDlg dlg(this, m_pApp->m_user.config); - if (dlg.ShowModal() != wxID_OK) return; - PLEntry *ple = new PLEntry(dlg.m_urlVal); - gf_list_add(m_entries, ple); - m_all_dead_entries = -1; - RefreshList(); -} - -void wxPlaylist::OnRemFile(wxCommandEvent &WXUNUSED(event)) -{ - if (!m_FileList->GetSelectedItemCount()) return; - - long item = -1; - for (;;) { - item = m_FileList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if (item == -1) break; - PLEntry *ple = (PLEntry *) m_FileList->GetItemData(item); - gf_list_del_item(m_entries, ple); - delete ple; - } - RefreshList(); -} - -void wxPlaylist::OnRemAll(wxCommandEvent &WXUNUSED(event)) -{ - Clear(); - RefreshList(); - m_cur_entry = -1; - m_all_dead_entries = 1; -} - -void wxPlaylist::OnRemDead(wxCommandEvent &WXUNUSED(event)) -{ - for (u32 i=0; im_bIsDead) continue; - gf_list_rem(m_entries, i); - i--; - delete ple; - } - m_all_dead_entries = gf_list_count(m_entries) ? 0 : 1; - RefreshList(); -} - - -void wxPlaylist::OnSelUp(wxCommandEvent &WXUNUSED(event)) -{ - s32 i; - if (!m_FileList->GetSelectedItemCount()) return; - long item = -1; - item = m_FileList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if (item <= 0) return; - - item = -1; - for (;;) { - item = m_FileList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if (item == -1) break; - PLEntry *ple = (PLEntry *) m_FileList->GetItemData(item); - i = gf_list_del_item(m_entries, ple); - assert(i>=1); - gf_list_insert(m_entries, ple, i-1); - ple->m_bIsSelected = 1; - } - RefreshList(); -} - -void wxPlaylist::OnSelDown(wxCommandEvent &WXUNUSED(event)) -{ - s32 i; - - if (!m_FileList->GetSelectedItemCount()) return; - long item = -1; - for (;;) { - item = m_FileList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if (item == -1) break; - } - if ((u32) item + 1 == gf_list_count(m_entries)) return; - - item = -1; - for (;;) { - item = m_FileList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if (item == -1) break; - PLEntry *ple = (PLEntry *) m_FileList->GetItemData(item); - i = gf_list_del_item(m_entries, ple); - assert(i>=1); - gf_list_insert(m_entries, ple, i+1); - ple->m_bIsSelected = 1; - } - RefreshList(); -} - - - -void wxPlaylist::OnSave(wxCommandEvent & WXUNUSED(event)) -{ - Bool save_m3u; - char szPath[GF_MAX_PATH]; - if (!gf_list_count(m_entries)) return; - - wxFileDialog dlg(this, wxT("Select file(s)"), wxT(""), wxT(""), wxT("M3U Playlists|*.m3u|ShoutCast Playlists|*.pls|"), wxSAVE | wxCHANGE_DIR | wxOVERWRITE_PROMPT); - if (dlg.ShowModal() != wxID_OK) return; - - strcpy(szPath, dlg.GetPath().mb_str(wxConvUTF8)); - strlwr(szPath); - save_m3u = (dlg.GetFilterIndex()==0) ? 1 : 0; - if (save_m3u) { - if (!strstr(szPath, ".m3u")) { - strcpy(szPath, dlg.GetPath().mb_str(wxConvUTF8)); - strcat(szPath, ".m3u"); - } else { - strcpy(szPath, dlg.GetPath().mb_str(wxConvUTF8)); - } - } else { - if (!strstr(szPath, ".pls")) { - strcpy(szPath, dlg.GetPath().mb_str(wxConvUTF8)); - strcat(szPath, ".pls"); - } else { - strcpy(szPath, dlg.GetPath().mb_str(wxConvUTF8)); - } - } - Save(szPath, save_m3u); -} - -void wxPlaylist::Save(char *szPath, Bool save_m3u) -{ - FILE *out = fopen(szPath, "wt"); - if (!save_m3u) - fprintf(out, "[playlist]\nNumberOfEntries=%d\n", gf_list_count(m_entries)); - - for (u32 i=0; im_url); - } else { - fprintf(out, "File%d=%s\n", i+1, ple->m_url); - fprintf(out, "Title%d=%s\n", i+1, ple->m_disp_name); - if (ple->m_duration) fprintf(out, "Length%d=%d\n", i+1, ple->m_duration); - else fprintf(out, "Length%d=-1\n", i+1); - } - } - if (!save_m3u) fprintf(out, "Version=2\n"); - - fprintf(out, "\n"); - fclose(out); -} - -void wxPlaylist::OnOpen(wxCommandEvent & WXUNUSED(event)) -{ - wxFileDialog dlg(this, wxT("Select file(s)"), wxT(""), wxT(""), wxT("M3U & PLS Playlists|*.m3u;*.pls|M3U Playlists|*.m3u|ShoutCast Playlists|*.pls|"), wxOPEN | wxCHANGE_DIR/* | wxHIDE_READONLY*/); - if (dlg.ShowModal() != wxID_OK) return; - - Clear(); - OpenPlaylist(dlg.GetPath()); - m_cur_entry = 0; - Play(); -} - -void wxPlaylist::OpenPlaylist(wxString filename) -{ - FILE *pl; - PLEntry *ple; - Bool load_m3u, go; - char szLine[GF_MAX_PATH]; - pl = fopen(filename.mb_str(wxConvUTF8) , "rt"); - if (!pl) return; - - ple = NULL; - load_m3u = 1; - while (!feof(pl)) { - fgets(szLine, GF_MAX_PATH, pl); - go = 1; - while (go) { - switch (szLine[strlen(szLine)-1]) { - case '\n': - case '\r': - case ' ': - szLine[strlen(szLine)-1] = 0; - break; - default: - go = 0; - break; - } - } - if (!strlen(szLine)) continue; - if (!stricmp(szLine, "[playlist]")) { - load_m3u = 0; - } else if (load_m3u) { - ple = new PLEntry(wxString(szLine, wxConvUTF8) ); - gf_list_add(m_entries, ple); - } else if (!strnicmp(szLine, "file", 4)) { - char *st = strchr(szLine, '='); - if (!st) ple = NULL; - else { - ple = new PLEntry(wxString(st + 1, wxConvUTF8) ); - gf_list_add(m_entries, ple); - } - } else if (ple && !strnicmp(szLine, "Length", 6)) { - char *st = strchr(szLine, '='); - s32 d = atoi(st + 1); - if (d>0) ple->m_duration = d; - } else if (ple && !strnicmp(szLine, "Title", 5)) { - char *st = strchr(szLine, '='); - gf_free(ple->m_disp_name); - ple->m_disp_name = gf_strdup(st + 6); - } - } - fclose(pl); - m_all_dead_entries = -1; - m_cur_entry = -1; - RefreshList(); -} - -void wxPlaylist::OnRightClick(wxListEvent & event) -{ - if (!m_FileList->GetItemCount()) return; - - wxMenu *popup = new wxMenu(); - - if (m_FileList->GetSelectedItemCount()==1) { - popup->Append(ID_PL_PLAY, wxT("Play")); - popup->AppendSeparator(); - } - popup->Append(ID_PL_SEL_REV, wxT("Inverse Selection")); - if (m_FileList->GetSelectedItemCount()) popup->Append(ID_PL_REM_FILE, wxT("Remove File(s)")); - if (m_FileList->GetItemCount()>1) { - popup->AppendSeparator(); - popup->Append(ID_PL_SORT_TITLE, wxT("Sort By Title")); - popup->Append(ID_PL_SORT_FILE, wxT("Sort By File Name")); - popup->Append(ID_PL_SORT_DUR, wxT("Sort By Duration")); - popup->AppendSeparator(); - popup->Append(ID_PL_REVERSE, wxT("Reverse List")); - popup->Append(ID_PL_RANDOMIZE, wxT("Randomize")); - } - - PopupMenu(popup, event.GetPoint()); - delete popup; -} - -void wxPlaylist::OnReverseSelection(wxCommandEvent &WXUNUSED(event) ) -{ - u32 i; - long item = -1; - for (;;) { - item = m_FileList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if (item == -1) break; - PLEntry *ple = (PLEntry *) m_FileList->GetItemData(item); - ple->m_bIsSelected = 1; - } - for (i=0; im_bIsSelected = !ple->m_bIsSelected; - } - RefreshList(); -} - -void wxPlaylist::OnReverseList(wxCommandEvent &WXUNUSED(event) ) -{ - u32 count = gf_list_count(m_entries); - u32 hcount = count / 2; - count--; - for (u32 i=0; i1) { - u32 pos = gf_rand() % (gf_list_count(m_entries)-1); - PLEntry *ple = (PLEntry *)gf_list_get(m_entries, pos); - gf_list_rem(m_entries, pos); - gf_list_add(new_entries, ple); - } - PLEntry *ple = (PLEntry *)gf_list_get(m_entries, 0); - gf_list_rem(m_entries, 0); - gf_list_add(new_entries, ple); - - gf_list_del(m_entries); - m_entries = new_entries; - m_cur_entry = -1; - RefreshList(); -} - -void wxPlaylist::Sort(u32 type) -{ - u32 i, j, smallest; - - for (i=0; im_url, ple2->m_url); - break; - case 1: - test = stricmp(ple1->m_disp_name, ple2->m_disp_name); - break; - case 2: - test = ple1->m_duration - ple2->m_duration; - break; - } - if (test<0) smallest = j; - } - PLEntry *ple = (PLEntry *)gf_list_get(m_entries, smallest); - gf_list_rem(m_entries, smallest); - gf_list_insert(m_entries, ple, i); - } - m_cur_entry = -1; - RefreshList(); -} - -void wxPlaylist::OnSortFile(wxCommandEvent &WXUNUSED(event) ) { Sort(0); } -void wxPlaylist::OnSortTitle(wxCommandEvent &WXUNUSED(event) ) { Sort(1); } -void wxPlaylist::OnSortDuration(wxCommandEvent &WXUNUSED(event) ) { Sort(2); } - -void wxPlaylist::RefreshCurrent() -{ - PLEntry *ple; - if (m_cur_entry<0) return; - ple = (PLEntry *) gf_list_get(m_entries, m_cur_entry); - if (ple && ple->m_bIsPlaying) { - ple->m_bIsPlaying = 0; - UpdateEntry(m_cur_entry); - } -} - -Bool wxPlaylist::HasValidEntries() -{ - u32 nb_dead = 0; - if (m_all_dead_entries==-1) { - for (u32 i=0; im_bIsPlaying = 0; - if (ple->m_bIsDead) nb_dead ++; - } - m_all_dead_entries = (nb_dead==gf_list_count(m_entries)) ? 1 : 0; - } - return !m_all_dead_entries; -} - -void wxPlaylist::Play() -{ - PLEntry *ple; - - if (!HasValidEntries()) return; - - RefreshCurrent(); - - if (m_cur_entry >= (s32)gf_list_count(m_entries)) { - if (!m_pApp->m_loop) return; - m_cur_entry = 0; - } - - ple = (PLEntry *) gf_list_get(m_entries, m_cur_entry); - if (!ple || ple->m_bIsDead) { - m_cur_entry++; - Play(); - } else { - char szPLE[20]; - ple->m_bIsPlaying = 1; - UpdateEntry(m_cur_entry); - sprintf(szPLE, "%d", m_cur_entry); - gf_cfg_set_key(m_pApp->m_user.config, "General", "PLEntry", szPLE); - m_pApp->DoConnect(); - } -} - -void wxPlaylist::OnItemActivate(wxListEvent &WXUNUSED(event) ) -{ - long item = m_FileList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if (item==-1) return; - RefreshCurrent(); - m_cur_entry = item; - Play(); -} - - -void wxPlaylist::OnPlay(wxCommandEvent &WXUNUSED(event)) -{ - long item = m_FileList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if (item==-1) return; - - RefreshCurrent(); - m_cur_entry = item; - Play(); -} - -void wxPlaylist::Truncate() -{ - if (m_cur_entry<0) return; - while ((u32) m_cur_entry+1 < gf_list_count(m_entries)) { - PLEntry *ple = (PLEntry *) gf_list_get(m_entries, m_cur_entry+1); - gf_list_rem(m_entries, m_cur_entry+1); - delete ple; - } - RefreshList(); -} - -void wxPlaylist::QueueURL(wxString filename) -{ - char *ext = (char*)strrchr(filename.mb_str(wxConvUTF8), '.'); - if (ext && (!stricmp(ext, ".m3u") || !stricmp(ext, ".pls")) ) { - OpenPlaylist(filename); - } else { - PLEntry *ple = new PLEntry(filename); - gf_list_add(m_entries, ple); - } -} - -void wxPlaylist::PlayNext() -{ - RefreshCurrent(); - if (1+m_cur_entry < (s32)gf_list_count(m_entries)) { - m_cur_entry++; - Play(); - } -} - -void wxPlaylist::PlayPrev() -{ - RefreshCurrent(); - if (m_cur_entry>0) { - m_cur_entry--; - Play(); - } -} - -void wxPlaylist::SetDead() -{ - PLEntry *ple = (PLEntry *) gf_list_get(m_entries, m_cur_entry); - if (ple) { - ple->m_bIsDead = 1; - UpdateEntry(m_cur_entry); - if (ple->m_bIsPlaying) PlayNext(); - m_all_dead_entries = -1; - } -} -void wxPlaylist::SetDuration(u32 duration) -{ - PLEntry *ple = (PLEntry *) gf_list_get(m_entries, m_cur_entry); - if (ple) { - ple->m_duration = duration; - UpdateEntry(m_cur_entry); - } -} - -wxString wxPlaylist::GetDisplayName() -{ - if (m_cur_entry>=0) { - PLEntry *ple = (PLEntry *) gf_list_get(m_entries, m_cur_entry); - if (ple) return wxString(wxString(ple->m_disp_name, wxConvUTF8) ); - } - return wxT(""); -} - -wxString wxPlaylist::GetURL() -{ - PLEntry *ple = (PLEntry *) gf_list_get(m_entries, m_cur_entry); - if (ple) return wxString(ple->m_url, wxConvUTF8); - return wxT(""); -} - diff --git a/applications/osmo4_wx/Playlist.h b/applications/osmo4_wx/Playlist.h deleted file mode 100644 index 0ebb230..0000000 --- a/applications/osmo4_wx/Playlist.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * GPAC - Multimedia Framework C SDK - * - * Copyright (c) Jean Le Feuvre 2000-2005 - * All rights reserved - * - * This file is part of GPAC / Osmo4 wxWidgets GUI - * - * GPAC is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * GPAC is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - */ - -#ifndef _PLAYLIST_H -#define _PLAYLIST_H - -#include "wx/wxprec.h" - -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include "menubtn.h" - -enum -{ - ID_FILE_LIST = 1000, -}; - -class wxOsmo4Frame; - -class PLEntry -{ -public: - PLEntry(wxString url); - ~PLEntry(); - - char *m_url; - char *m_disp_name; - u32 m_duration; - - Bool m_bIsSelected; - Bool m_bIsDead; - Bool m_bIsPlaying; -}; - - -class wxPlaylist : public wxFrame -{ -public: - wxPlaylist(wxWindow *parent); - virtual ~wxPlaylist(); - - void Clear(); - void ClearButPlaying(); - void RefreshList(); - - void Truncate(); - void QueueURL(wxString filename); - void Play(); - void PlayNext(); - void PlayPrev(); - void SetDead(); - void SetDuration(u32 duration); - Bool HasValidEntries(); - void OpenPlaylist(wxString fileName); - - /*for current entry played*/ - wxString GetDisplayName(); - wxString GetURL(); - - s32 m_cur_entry; - GF_List *m_entries; - - wxOsmo4Frame *m_pApp; - -private: - DECLARE_EVENT_TABLE() - - void OnClose(wxCloseEvent &event); - void OnSize(wxSizeEvent &event); - void OnAddFile(wxCommandEvent &event); - void OnAddURL(wxCommandEvent &event); - void OnAddDir(wxCommandEvent &event); - void OnAddDirRec(wxCommandEvent &event); - void OnRemFile(wxCommandEvent &event); - void OnRemAll(wxCommandEvent &event); - void OnRemDead(wxCommandEvent &event); - void OnSelUp(wxCommandEvent &event); - void OnSelDown(wxCommandEvent &event); - void OnSave(wxCommandEvent &event); - void OnOpen(wxCommandEvent &event); - void OnRightClick(wxListEvent & event); - void OnReverseSelection(wxCommandEvent &event); - void OnReverseList(wxCommandEvent &event); - void OnRandomize(wxCommandEvent &event); - void OnSortFile(wxCommandEvent &event); - void OnSortTitle(wxCommandEvent &event); - void OnSortDuration(wxCommandEvent &event); - void OnItemActivate(wxListEvent &event); - void OnPlay(wxCommandEvent &event); - - - void Sort(u32 type); - void UpdateEntry(u32 idx); - void RefreshCurrent(); - void Save(char *szPath, Bool save_m3u); - - wxBitmap *m_pOpen, *m_pSave, *m_pAdd, *m_pRem, *m_pUp, *m_pDown, *m_pSort; - wxMenuButton *m_pAddBut, *m_pRemBut, *m_pSortBut; - wxToolBar *m_pToolBar; - wxListCtrl *m_FileList; - char szCacheDir[GF_MAX_PATH]; - s32 m_all_dead_entries; - - void AddDir(Bool do_recurse); -}; - - - -#endif - diff --git a/applications/osmo4_wx/fileprops.cpp b/applications/osmo4_wx/fileprops.cpp deleted file mode 100644 index 4697d55..0000000 --- a/applications/osmo4_wx/fileprops.cpp +++ /dev/null @@ -1,608 +0,0 @@ -/* - * GPAC - Multimedia Framework C SDK - * - * Copyright (c) Jean Le Feuvre 2000-2005 - * All rights reserved - * - * This file is part of GPAC / Osmo4 wxWidgets GUI - * - * GPAC is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * GPAC is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - */ - -#include "fileprops.h" -#include "wxOsmo4.h" -#include "Playlist.h" -#include -#include -#include -#include -/*ISO 639 languages*/ -#include - - -wxFileProps::wxFileProps(wxWindow *parent) - : wxDialog(parent, -1, wxString(_T("File Properties"))) -{ - - m_pApp = (wxOsmo4Frame *)parent; - SetSize(540, 260); - assert(m_pApp->m_pPlayList); - - m_pTreeView = new wxTreeCtrl(this, ID_TREE_VIEW, wxPoint(4, 2), wxSize(200, 180), wxTR_DEFAULT_STYLE | wxSUNKEN_BORDER); - - new wxStaticText(this, 0, _T("Information"), wxPoint(210, 2), wxSize(60, 20)); - m_pViewSel = new wxComboBox(this, ID_VIEW_SEL, _T(""), wxPoint(280, 2), wxSize(120, 24), 0, NULL, wxCB_READONLY); - m_pViewSel->Append(wxT("General")); - m_pViewSel->Append(wxT("Streams")); - m_pViewSel->Append(wxT("Playback")); - m_pViewSel->Append(wxT("Network")); - m_pViewSel->SetSelection(0); - - m_pViewInfo = new wxTextCtrl(this, -1, wxT(""), wxPoint(210, 30), wxSize(320, 200), wxTE_MULTILINE | wxTE_READONLY | wxHSCROLL | wxSUNKEN_BORDER); - -#ifdef WIN32 - m_pViewInfo->SetBackgroundColour(wxColour(wxT("LIGHT GREY"))); -#endif - - m_pViewWI = new wxButton(this, ID_VIEW_WI, wxT("View World Info"), wxPoint(4, 174), wxSize(200, 40)); - m_pViewSG = new wxButton(this, ID_VIEW_SG, wxT("View Scene Graph"), wxPoint(4, 220), wxSize(200, 40)); - - - wxString str = m_pApp->m_pPlayList->GetDisplayName(); - str += wxT(" Properties"); - SetTitle(str); - - m_pTimer = new wxTimer(); - m_pTimer->SetOwner(this, ID_OD_TIMER); - m_pTimer->Start(500, 0); - RewriteODTree(); - -} - -wxFileProps::~wxFileProps() -{ - m_pTimer->Stop(); - delete m_pTimer; -} - - -BEGIN_EVENT_TABLE(wxFileProps, wxDialog) - EVT_TREE_ITEM_ACTIVATED(ID_TREE_VIEW, wxFileProps::OnSetSelection) - EVT_TREE_SEL_CHANGED(ID_TREE_VIEW, wxFileProps::OnSetSelection) - EVT_TREE_ITEM_EXPANDED(ID_TREE_VIEW, wxFileProps::OnSetSelection) - EVT_TREE_ITEM_COLLAPSED(ID_TREE_VIEW, wxFileProps::OnSetSelection) - EVT_TIMER(ID_OD_TIMER, wxFileProps::OnTimer) - EVT_BUTTON(ID_VIEW_SG, wxFileProps::OnViewSG) - EVT_BUTTON(ID_VIEW_WI, wxFileProps::OnViewWorld) - EVT_COMBOBOX(ID_VIEW_SEL, wxFileProps::OnSelectInfo) -END_EVENT_TABLE() - -void wxFileProps::RewriteODTree() -{ - GF_ObjectManager *root_odm = gf_term_get_root_object(m_pApp->m_term); - if (!root_odm) return; - - m_pTreeView->DeleteAllItems(); - ODTreeData *root = new ODTreeData(root_odm); - m_pTreeView->AddRoot(wxT("Root OD"), -1, -1, root); - wxTreeItemId rootId = m_pTreeView->GetRootItem(); - - WriteInlineTree(root); - SetInfo(root_odm); -} - -void wxFileProps::WriteInlineTree(ODTreeData *root) -{ - /*browse all ODs*/ - u32 count = gf_term_get_object_count(m_pApp->m_term, root->m_pODMan); - - for (u32 i=0; im_term, root->m_pODMan, i); - if (!odm) return; - ODTreeData *odd = new ODTreeData(odm); - m_pTreeView->AppendItem(root->GetId(), wxT("Object Descriptor"), -1, -1, odd); - - /*if inline propagate*/ - switch (gf_term_object_subscene_type(m_pApp->m_term, odm)) { - case 1: - m_pTreeView->SetItemText(odd->GetId(), wxT("Root Scene")); - WriteInlineTree(odd); - break; - case 2: - m_pTreeView->SetItemText(odd->GetId(), wxT("Inline Scene")); - WriteInlineTree(odd); - break; - case 3: - m_pTreeView->SetItemText(odd->GetId(), wxT("Extern Proto Lib")); - break; - default: - break; - } - } -} - -void wxFileProps::OnSetSelection(wxTreeEvent& event) -{ - ODTreeData *odd = (ODTreeData *) m_pTreeView->GetItemData(event.GetItem()); - SetInfo(odd->m_pODMan); -} - -void wxFileProps::SetInfo(GF_ObjectManager *odm) -{ - m_current_odm = odm; - - switch (m_pViewSel->GetSelection()) { - case 3: SetNetworkInfo(); break; - case 2: SetDecoderInfo(); break; - case 1: SetStreamsInfo(); break; - default: SetGeneralInfo(); break; - } -} - -void wxFileProps::OnTimer(wxTimerEvent& WXUNUSED(event)) -{ - switch (m_pViewSel->GetSelection()) { - case 2: SetDecoderInfo(); break; - } -} -void wxFileProps::OnSelectInfo(wxCommandEvent & WXUNUSED(event) ) -{ - SetInfo(m_current_odm); -} - -void wxFileProps::SetGeneralInfo() -{ - wxString info; - GF_MediaInfo odi; - u32 h, m, s; - u32 i, j; - - info = wxT(""); - m_pViewInfo->Clear(); - m_pViewInfo->AppendText(info); - - if (!m_current_odm || gf_term_get_object_info(m_pApp->m_term, m_current_odm, &odi) != GF_OK) return; - - if (odi.has_profiles) info += wxT("Initial "); - info += wxString::Format(wxT("Object Descriptor ID %d\n"), odi.od->objectDescriptorID); - if (odi.duration) { - h = (u32) (odi.duration / 3600); - m = (u32) (odi.duration / 60) - h*60; - s = (u32) (odi.duration) - h*3600 - m*60; - info += wxString::Format(wxT("Duration %02d:%02d:%02d\n"), h, m, s); - } else { - info += wxT("Unknown duration\n"); - } - - if (odi.owns_service) { - info += wxT("Service Handler: ") + wxString(odi.service_handler, wxConvUTF8) + wxT("\n"); - info += wxT("Service URL: ") + wxString(odi.service_url, wxConvUTF8) + wxT("\n"); - } - - if (odi.od->URLString) { - info += wxT("Remote OD - URL: ") + wxString(odi.od->URLString, wxConvUTF8) + wxT("\n"); - } - - if (odi.codec_name) { - switch (odi.od_type) { - case GF_STREAM_VISUAL: - info += wxString::Format(wxT("Video Object: Width %d - Height %d\n"), odi.width, odi.height); - info += wxT("Media Codec ") + wxString(odi.codec_name, wxConvUTF8) + wxT("\n"); - break; - case GF_STREAM_AUDIO: - info += wxString::Format(wxT("Audio Object: Sample Rate %d - %d channels\n"), odi.sample_rate, odi.num_channels); - info += wxT("Media Codec ") + wxString(odi.codec_name, wxConvUTF8) + wxT("\n"); - break; - case GF_STREAM_PRIVATE_SCENE: - case GF_STREAM_SCENE: - if (odi.width && odi.height) { - info += wxString::Format(wxT("Scene Description: Width %d - Height %d\n"), odi.width, odi.height); - } else { - info += wxT("Scene Description: No size specified\n"); - } - info += wxT("Scene Codec ") + wxString(odi.codec_name, wxConvUTF8) + wxT("\n"); - break; - case GF_STREAM_TEXT: - if (odi.width && odi.height) { - info += wxString::Format(wxT("Text Object: Width %d - Height %d\n"), odi.width, odi.height); - } else { - info += wxString::Format(wxT("Text Object: No size specified\n")); - } - info += wxT("Text Codec ") + wxString(odi.codec_name, wxConvUTF8) + wxT("\n"); - break; - } - } - if (odi.protection==2) info += wxT("Encrypted Media NOT UNLOCKED"); - else if (odi.protection==1) info += wxT("Encrypted Media"); - - if (!gf_list_count(odi.od->OCIDescriptors)) { - m_pViewInfo->Clear(); - m_pViewInfo->AppendText(info); - return; - } - - info += wxT("\nObject Content Information:\n"); - - /*check OCI (not everything interests us) - FIXME: support for unicode*/ - for (i=0; iOCIDescriptors); i++) { - GF_Descriptor *desc = (GF_Descriptor *) gf_list_get(odi.od->OCIDescriptors, i); - switch (desc->tag) { - case GF_ODF_SEGMENT_TAG: - { - GF_Segment *sd = (GF_Segment *) desc; - info += wxT("\nSegment Descriptor:\nName: ") + wxString((char *) sd->SegmentName, wxConvUTF8); - info += wxString::Format(wxT(" - start time %g sec - duration %g sec\n"), sd->startTime, sd->Duration); - } - break; - case GF_ODF_CC_NAME_TAG: - { - GF_CC_Name *ccn = (GF_CC_Name *)desc; - info += wxT("\nContent Creators:\n"); - for (j=0; jContentCreators); j++) { - GF_ContentCreatorInfo *ci = (GF_ContentCreatorInfo *) gf_list_get(ccn->ContentCreators, j); - if (!ci->isUTF8) continue; - info += wxT("\t") + wxString(ci->contentCreatorName, wxConvUTF8) + wxT("\n"); - } - } - break; - - case GF_ODF_SHORT_TEXT_TAG: - { - GF_ShortTextual *std = (GF_ShortTextual *)desc; - info += wxT("\n") + wxString(std->eventName, wxConvUTF8) + wxT(": ") + wxString(std->eventText, wxConvUTF8) + wxT("\n"); - } - break; - /*todo*/ - case GF_ODF_CC_DATE_TAG: - break; - default: - break; - } - - } - - m_pViewInfo->Clear(); - m_pViewInfo->AppendText(info); -} - -void wxFileProps::SetStreamsInfo() -{ - u32 i, count; - wxString info; - GF_MediaInfo odi; - char code[5]; - - info = wxT(""); - m_pViewInfo->Clear(); - m_pViewInfo->AppendText(info); - - if (!m_current_odm || gf_term_get_object_info(m_pApp->m_term, m_current_odm, &odi) != GF_OK) return; - - if (odi.has_profiles) { - info += wxString::Format(wxT("\tOD Profile@Level %d\n"), odi.OD_pl); - info += wxString::Format(wxT("\tScene Profile@Level %d\n"), odi.scene_pl); - info += wxString::Format(wxT("\tGraphics Profile@Level %d\n"), odi.graphics_pl); - info += wxString::Format(wxT("\tAudio Profile@Level %d\n"), odi.audio_pl); - info += wxString::Format(wxT("\tVisual Profile@Level %d\n"), odi.scene_pl); - if (odi.inline_pl) info += wxT("\tInline Content use same profiles\n"); - info += wxT("\n"); - } - - count = gf_list_count(odi.od->ESDescriptors); - - for (i=0; iESDescriptors, i); - - info += wxString::Format(wxT("Stream ID %d - Clock ID %d\n"), esd->ESID, esd->OCRESID); - if (esd->dependsOnESID) { - info += wxString::Format(wxT("\tDepends on Stream ID %d for decoding\n"), esd->dependsOnESID); - } - switch (esd->decoderConfig->streamType) { - case GF_STREAM_OD: - info += wxString::Format(wxT("\tOD Stream - version %d\n"), esd->decoderConfig->objectTypeIndication); - break; - case GF_STREAM_OCR: - info += wxT("\tObject Clock Reference Stream\n"); - break; - case GF_STREAM_SCENE: - info += wxString::Format(wxT("\tScene Description Stream - version %d\n"), esd->decoderConfig->objectTypeIndication); - break; - case GF_STREAM_PRIVATE_SCENE: - info += wxString::Format(wxT("\tGPAC Private Scene Description Stream\n")); - break; - case GF_STREAM_VISUAL: - info += wxT("\tVisual Stream - media type: "); - switch (esd->decoderConfig->objectTypeIndication) { - case GPAC_OTI_VIDEO_MPEG4_PART2: info += wxT("MPEG-4\n"); break; - case GPAC_OTI_VIDEO_MPEG2_SIMPLE: info += wxT("MPEG-2 Simple Profile\n"); break; - case GPAC_OTI_VIDEO_MPEG2_MAIN: info += wxT("MPEG-2 Main Profile\n"); break; - case GPAC_OTI_VIDEO_MPEG2_SNR: info += wxT("MPEG-2 SNR Profile\n"); break; - case GPAC_OTI_VIDEO_MPEG2_SPATIAL: info += wxT("MPEG-2 Spatial Profile\n"); break; - case GPAC_OTI_VIDEO_MPEG2_HIGH: info += wxT("MPEG-2 High Profile\n"); break; - case GPAC_OTI_VIDEO_MPEG2_422: info += wxT("MPEG-2 422 Profile\n"); break; - case GPAC_OTI_VIDEO_MPEG1: info += wxT("MPEG-1\n"); break; - case GPAC_OTI_IMAGE_JPEG: info += wxT("JPEG\n"); break; - case GPAC_OTI_IMAGE_PNG: info += wxT("PNG\n"); break; - case GPAC_OTI_IMAGE_JPEG_2000: info += wxT("JPEG2000\n"); break; - case 0x80: - memcpy(code, esd->decoderConfig->decoderSpecificInfo->data, 4); - code[4] = 0; - info += wxT("GPAC Intern (") + wxString(code, wxConvUTF8) + wxT(")\n"); - break; - default: - info += wxString::Format(wxT("Private/Unknown Type (0x%x)\n"), esd->decoderConfig->objectTypeIndication); - break; - } - break; - - case GF_STREAM_AUDIO: - info += wxT("\tAudio Stream - media type: "); - switch (esd->decoderConfig->objectTypeIndication) { - case GPAC_OTI_AUDIO_AAC_MPEG4: info += wxT("MPEG-4\n"); break; - case GPAC_OTI_AUDIO_AAC_MPEG2_MP: info += wxT("MPEG-2 AAC Main Profile\n"); break; - case GPAC_OTI_AUDIO_AAC_MPEG2_LCP: info += wxT("MPEG-2 AAC LowComplexity Profile\n"); break; - case GPAC_OTI_AUDIO_AAC_MPEG2_SSRP: info += wxT("MPEG-2 AAC Scalable Sampling Rate Profile\n"); break; - case GPAC_OTI_AUDIO_MPEG2_PART3: info += wxT("MPEG-2 Audio\n"); break; - case GPAC_OTI_AUDIO_MPEG1: info += wxT("MPEG-1 Audio\n"); break; - case 0xA0: info += wxT("EVRC Audio\n"); break; - case 0xA1: info += wxT("SMV Audio\n"); break; - case 0xE1: info += wxT("QCELP Audio\n"); break; - case 0x80: - memcpy(code, esd->decoderConfig->decoderSpecificInfo->data, 4); - code[4] = 0; - info += wxT("GPAC Intern (") + wxString(code, wxConvUTF8) + wxT(")\n"); - break; - default: - info += wxString::Format(wxT("Private/Unknown Type (0x%x)\n"), esd->decoderConfig->objectTypeIndication); - break; - } - break; - case GF_STREAM_MPEG7: - info += wxString::Format(wxT("\tMPEG-7 Stream - version %d\n"), esd->decoderConfig->objectTypeIndication); - break; - case GF_STREAM_IPMP: - info += wxString::Format(wxT("\tIPMP Stream - version %d\n"), esd->decoderConfig->objectTypeIndication); - break; - case GF_STREAM_OCI: - info += wxString::Format(wxT("\tOCI Stream - version %d\n"), esd->decoderConfig->objectTypeIndication); - break; - case GF_STREAM_MPEGJ: - info += wxString::Format(wxT("\tMPEGJ Stream - version %d\n"), esd->decoderConfig->objectTypeIndication); - break; - case GF_STREAM_INTERACT: - info += wxString::Format(wxT("\tUser Interaction Stream - version %d\n"), esd->decoderConfig->objectTypeIndication); - break; - default: - info += wxT("Private/Unknown\n"); - break; - } - - 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); - if (esd->slConfig->predefined==SLPredef_SkipSL) { - info += wxString::Format(wxT("\tNot using MPEG-4 Synchronization Layer\n")); - } else { - info += wxString::Format(wxT("\tStream Clock Resolution %d\n"), esd->slConfig->timestampResolution); - } - if (esd->URLString) - info += wxT("\tStream Location: ") + wxString(esd->URLString, wxConvUTF8) + wxT("\n"); - - /*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 = (char*) "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; - } - } - info += wxString::Format(wxT("\tStream Language: %s\n"), szLang); - } - - } - m_pViewInfo->Clear(); - m_pViewInfo->AppendText(info); -} - - -void wxFileProps::SetDecoderInfo() -{ - GF_MediaInfo odi; - wxString info; - u32 h, m, s; - - if (!m_current_odm || gf_term_get_object_info(m_pApp->m_term, m_current_odm, &odi)) { - m_pViewInfo->Clear(); - m_pViewInfo->AppendText(info); - return; - } - - info = wxT("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; - if (odi.status==0) info += wxT("Stopped"); - else if (odi.status==1) info += wxT("Playing"); - else info += wxT("Paused"); - info += wxString::Format(wxT("\nObject Time: %02d:%02d:%02d\n"), h, m, s); - break; - case 3: - info += wxT("Not Setup\n"); - m_pViewInfo->Clear(); - m_pViewInfo->AppendText(info); - return; - default: - info += wxT("Setup Failed\n"); - m_pViewInfo->Clear(); - m_pViewInfo->AppendText(info); - return; - } - /*get clock drift*/ - info += wxString::Format(wxT("Clock drift: %d ms\n"), odi.clock_drift); - /*get buffering*/ - if (odi.buffer>=0) info += wxString::Format(wxT("Buffering Time: %d ms\n"), odi.buffer); - else if (odi.buffer==-1) info += wxT("Not buffering\n"); - else info += wxT("Not Playing\n"); - - /*get DB occupation*/ - if (odi.buffer>=0) info += wxString::Format(wxT("Decoding Buffer: %d Access Units\n"), odi.db_unit_count); - /*get CB occupation*/ - if (odi.cb_max_count) - info += wxString::Format(wxT("Composition Memory: %d/%d Units\n"), odi.cb_unit_count, odi.cb_max_count); - - 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; - } - info += wxString::Format(wxT("Average Bitrate %d kbps (%d max)\nAverage Decoding Time %.2f ms (%d max)\nTotal decoded frames %d - %d dropped\n"), - (u32) odi.avg_bitrate/1024, odi.max_bitrate/1024, avg_dec_time, odi.max_dec_time, odi.nb_dec_frames, odi.nb_droped); - - m_pViewInfo->Clear(); - m_pViewInfo->AppendText(info); -} - -void wxFileProps::SetNetworkInfo() -{ - wxString info; - u32 id; - NetStatCommand com; - GF_MediaInfo odi; - u32 d_enum; - GF_Err e; - - info = wxT(""); - m_pViewInfo->Clear(); - m_pViewInfo->AppendText(wxT("")); - - if (!m_current_odm || gf_term_get_object_info(m_pApp->m_term, m_current_odm, &odi) != GF_OK) return; - - if (odi.owns_service) { - const char *url, *path; - u32 done, total, bps; - info = wxT("Current Downloads in service:\n"); - d_enum = 0; - while (gf_term_get_download_info(m_pApp->m_term, m_current_odm, &d_enum, &url, &path, &done, &total, &bps)) { - info += wxString(url, wxConvUTF8); - if (total) { - info += wxString::Format(wxT(": %d / %d bytes (%.2f %%) - %.2f kBps\n"), done, total, (100.0*done)/total, ((Double)bps)/1024); - } else { - info += wxString::Format(wxT(": %.2f kBps\n"), ((Double)bps)/1024); - } - } - if (!d_enum) info = wxT("No Downloads in service\n"); - info += wxT("\n"); - } - - d_enum = 0; - while (gf_term_get_channel_net_info(m_pApp->m_term, m_current_odm, &d_enum, &id, &com, &e)) { - if (e) continue; - if (!com.bw_down && !com.bw_up) continue; - - info += wxString::Format(wxT("Stream ID %d statistics:\n"), id); - if (com.multiplex_port) { - info += wxString::Format(wxT("\tMultiplex Port %d - multiplex ID %d\n"), com.multiplex_port, com.port); - } else { - info += wxString::Format(wxT("\tPort %d\n"), com.port); - } - info += wxString::Format(wxT("\tPacket Loss Percentage: %.4f\n"), com.pck_loss_percentage); - info += wxString::Format(wxT("\tDown Bandwidth: %.3f bps\n"), ((Float)com.bw_down)/1024); - if (com.bw_up) info += wxString::Format(wxT("\tUp Bandwidth: %d bps\n"), com.bw_up); - if (com.ctrl_port) { - if (com.multiplex_port) { - info += wxString::Format(wxT("\tControl Multiplex Port: %d - Control Multiplex ID %d\n"), com.multiplex_port, com.ctrl_port); - } else { - info += wxString::Format(wxT("\tControl Port: %d\n"), com.ctrl_port); - } - info += wxString::Format(wxT("\tControl Down Bandwidth: %d bps\n"), com.ctrl_bw_down); - info += wxString::Format(wxT("\tControl Up Bandwidth: %d bps\n"), com.ctrl_bw_up); - } - info += wxT("\n"); - } - m_pViewInfo->Clear(); - m_pViewInfo->AppendText(info); -} - - -void wxFileProps::OnViewWorld(wxCommandEvent &WXUNUSED(event)) -{ - wxString wit; - const char *str; - GF_List *descs; - descs = gf_list_new(); - str = gf_term_get_world_info(m_pApp->m_term, m_current_odm, descs); - - if (!str) { - wxMessageDialog(this, wxT("No World Info available"), wxT("Sorry!"), wxOK).ShowModal(); - return; - } - - wit = wxT(""); - for (u32 i=0; gf_list_count(descs); i++) { - const char *d = (const char *) gf_list_get(descs, i); - wit += wxString(d, wxConvUTF8); - wit += wxT("\n"); - } - wxMessageDialog(this, wit, wxString(str, wxConvUTF8), wxOK).ShowModal(); - gf_list_del(descs); -} - -void wxFileProps::OnViewSG(wxCommandEvent &WXUNUSED(event)) -{ - const char *sOpt; - Bool dump_xmt; - wxFileName out_file; - char szOutFile[GF_MAX_PATH]; - wxString fname; - - sOpt = gf_cfg_get_key(m_pApp->m_user.config, "General", "CacheDirectory"); - out_file.AssignDir(wxString(sOpt, wxConvUTF8) ); - - sOpt = gf_cfg_get_key(m_pApp->m_user.config, "General", "ViewXMT"); - out_file.SetFullName(wxT("scene_dump")); - if (sOpt && !stricmp(sOpt, "yes")) { - dump_xmt = 1; - } else { - dump_xmt = 0; - } - strcpy(szOutFile, out_file.GetFullName().mb_str(wxConvUTF8)); - - GF_Err e = gf_term_dump_scene(m_pApp->m_term, szOutFile, NULL, dump_xmt, 0, m_current_odm); - if (e) { - wxMessageDialog dlg(this, wxString(gf_error_to_string(e), wxConvUTF8), wxT("Error while dumping"), wxOK); - dlg.ShowModal(); - } else { - wxString cmd = get_pref_browser(m_pApp->m_user.config); - cmd += wxT(" "); - cmd += wxString(szOutFile, wxConvUTF8); - wxExecute(cmd); - } -} diff --git a/applications/osmo4_wx/fileprops.h b/applications/osmo4_wx/fileprops.h deleted file mode 100644 index a1ba51b..0000000 --- a/applications/osmo4_wx/fileprops.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * GPAC - Multimedia Framework C SDK - * - * Copyright (c) Jean Le Feuvre 2000-2005 - * All rights reserved - * - * This file is part of GPAC / Osmo4 wxWidgets GUI - * - * GPAC is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * GPAC is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - */ - -#ifndef _FILEPROPS_H -#define _FILEPROPS_H - -#include "wx/wxprec.h" - -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include - -#include - -/*abstract class for all items in the tree*/ -class ODTreeData : public wxTreeItemData -{ -public: - ODTreeData(GF_ObjectManager *odm) : wxTreeItemData(), m_pODMan(odm) {} - GF_ObjectManager *m_pODMan; -}; - - -class wxOsmo4Frame; -class wxFileProps : public wxDialog -{ -public: - wxFileProps(wxWindow *parent); - virtual ~wxFileProps(); - -private: - DECLARE_EVENT_TABLE() - - wxOsmo4Frame *m_pApp; - - wxTreeCtrl *m_pTreeView; - wxTextCtrl *m_pViewInfo; - wxComboBox *m_pViewSel; - wxButton *m_pViewWI, *m_pViewSG; - wxTimer *m_pTimer; - - GF_ObjectManager *m_current_odm; - - void RewriteODTree(); - void SetGeneralInfo(); - void SetStreamsInfo(); - void SetDecoderInfo(); - void SetNetworkInfo(); - void WriteInlineTree(ODTreeData *pRoot); - void OnSetSelection(wxTreeEvent &event); - void OnSelectInfo(wxCommandEvent &event); - void OnTimer(wxTimerEvent &event); - void OnViewWorld(wxCommandEvent &event); - void OnViewSG(wxCommandEvent &event); - void SetInfo(GF_ObjectManager *odm); -}; - -#endif - diff --git a/applications/osmo4_wx/menubtn.cpp b/applications/osmo4_wx/menubtn.cpp deleted file mode 100644 index a13e58c..0000000 --- a/applications/osmo4_wx/menubtn.cpp +++ /dev/null @@ -1,863 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wxMenuButton -// Purpose: A button with a dropdown wxMenu -// Author: John Labenski -// Modified by: -// Created: 11/05/2002 -// RCS-ID: -// Copyright: (c) John Labenki -// Licence: wxWidgets licence -///////////////////////////////////////////////////////////////////////////// - -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "menubtn.h" -#endif - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/control.h" - #include "wx/menu.h" - #include "wx/settings.h" - #include "wx/bitmap.h" - #include "wx/pen.h" - #include "wx/dc.h" -#endif // WX_PRECOMP - -#include -#include -#include -#include - -#include "menubtn.h" - - - -// ========================================================================== -// wxCustomButton -// ========================================================================== -IMPLEMENT_DYNAMIC_CLASS( wxCustomButton, wxControl ) - -BEGIN_EVENT_TABLE(wxCustomButton,wxControl) - EVT_MOUSE_EVENTS ( wxCustomButton::OnMouseEvents ) - EVT_PAINT ( wxCustomButton::OnPaint ) - EVT_SIZE ( wxCustomButton::OnSize ) -END_EVENT_TABLE() - -wxCustomButton::~wxCustomButton() -{ - if (HasCapture()) ReleaseMouse(); - if (m_timer) delete m_timer; -} - -void wxCustomButton::Init() -{ - m_focused = FALSE; - m_labelMargin = wxSize(4,4); - m_bitmapMargin = wxSize(2,2); - m_down = 0; - m_timer = NULL; - m_eventType = 0; - m_button_style = wxCUSTBUT_TOGGLE|wxCUSTBUT_BOTTOM; -} - -bool wxCustomButton::Create(wxWindow* parent, wxWindowID id, - const wxString& label, const wxBitmap &bitmap, - const wxPoint& pos, const wxSize& size, - long style, const wxValidator& val, - const wxString& name) -{ - if (!wxControl::Create(parent,id,pos,size,wxNO_BORDER|wxCLIP_CHILDREN,val,name)) - return FALSE; - - wxControl::SetLabel(label); - wxControl::SetBackgroundColour(parent->GetBackgroundColour()); - wxControl::SetForegroundColour(parent->GetForegroundColour()); - wxControl::SetFont(parent->GetFont()); - - if (bitmap.Ok()) m_bmpLabel = bitmap; - - if (!SetButtonStyle(style)) return FALSE; - - wxSize bestSize = DoGetBestSize(); - SetSize(wxSize(size.x<0 ? bestSize.x:size.x, size.y<0 ? bestSize.y:size.y)); -#if (wxMINOR_VERSION<8) - SetBestSize(GetSize()); -#else - SetInitialSize(GetSize()); -#endif - - CalcLayout(TRUE); - return TRUE; -} - -void wxCustomButton::SetValue(bool depressed) -{ - wxCHECK_RET(!(m_button_style & wxCUSTBUT_NOTOGGLE), wxT("can't set button state")); - m_down = depressed ? 1 : 0; - Refresh(FALSE); -} - -bool wxCustomButton::SetButtonStyle(long style) -{ - int n_styles = 0; - if ((style & wxCUSTBUT_LEFT) != 0) n_styles++; - if ((style & wxCUSTBUT_RIGHT) != 0) n_styles++; - if ((style & wxCUSTBUT_TOP) != 0) n_styles++; - if ((style & wxCUSTBUT_BOTTOM) != 0) n_styles++; - wxCHECK_MSG(n_styles < 2, FALSE, wxT("Only one wxCustomButton label position allowed")); - - n_styles = 0; - if ((style & wxCUSTBUT_NOTOGGLE) != 0) n_styles++; - if ((style & wxCUSTBUT_BUTTON) != 0) n_styles++; - if ((style & wxCUSTBUT_TOGGLE) != 0) n_styles++; - if ((style & wxCUSTBUT_BUT_DCLICK_TOG) != 0) n_styles++; - if ((style & wxCUSTBUT_TOG_DCLICK_BUT) != 0) n_styles++; - wxCHECK_MSG(n_styles < 2, FALSE, wxT("Only one wxCustomButton style allowed")); - - m_button_style = style; - - if ((m_button_style & wxCUSTBUT_BUTTON) != 0) - m_down = 0; - - CalcLayout(TRUE); - return TRUE; -} - -void wxCustomButton::SetLabel( const wxString &label ) -{ - wxControl::SetLabel(label); - CalcLayout(TRUE); -} - -// sequence of events in GTK is up, dclick, up. - -void wxCustomButton::OnMouseEvents(wxMouseEvent& event) -{ - if (m_button_style & wxCUSTBUT_NOTOGGLE) return; - - if (event.LeftDown() || event.RightDown()) - { - if (!HasCapture()) - CaptureMouse(); // keep depressed until up - - m_down++; - Redraw(); - } - else if (event.LeftDClick() || event.RightDClick()) - { - m_down++; // GTK eats second down event - Redraw(); - } - else if (event.LeftUp()) - { - if (HasCapture()) - ReleaseMouse(); - - m_eventType = wxEVT_LEFT_UP; - -#if (wxMINOR_VERSION<8) - if (wxRect(wxPoint(0,0), GetSize()).Inside(event.GetPosition())) -#else - if (wxRect(wxPoint(0,0), GetSize()).Contains(event.GetPosition())) -#endif - { - if ((m_button_style & wxCUSTBUT_BUTTON) && (m_down > 0)) - { - m_down = 0; - Redraw(); - SendEvent(); - return; - } - else - { - if (!m_timer) - { - m_timer = new wxTimer(this, m_down+1); - m_timer->Start(200, TRUE); - } - else - { - m_eventType = wxEVT_LEFT_DCLICK; - } - - if ((m_button_style & wxCUSTBUT_TOGGLE) && - (m_button_style & wxCUSTBUT_TOG_DCLICK_BUT)) m_down++; - } - } - - Redraw(); - } - else if (event.RightUp()) - { - if (HasCapture()) - ReleaseMouse(); - - m_eventType = wxEVT_RIGHT_UP; - -#if (wxMINOR_VERSION<8) - if (wxRect(wxPoint(0,0), GetSize()).Inside(event.GetPosition())) -#else - if (wxRect(wxPoint(0,0), GetSize()).Contains(event.GetPosition())) -#endif - { - if ((m_button_style & wxCUSTBUT_BUTTON) && (m_down > 0)) - { - m_down = 0; - Redraw(); - SendEvent(); - return; - } - else - { - m_down++; - - if (!m_timer) - { - m_timer = new wxTimer(this, m_down); - m_timer->Start(250, TRUE); - } - else - { - m_eventType = wxEVT_RIGHT_DCLICK; - } - } - } - - Redraw(); - } - else if (event.Entering()) - { - m_focused = TRUE; - if ((event.LeftIsDown() || event.RightIsDown()) && HasCapture()) - m_down++; - - Redraw(); - } - else if (event.Leaving()) - { - m_focused = FALSE; - if ((event.LeftIsDown() || event.RightIsDown()) && HasCapture()) - m_down--; - - Redraw(); - } -} - - - -void wxCustomButton::SendEvent() -{ - if (((m_button_style & wxCUSTBUT_TOGGLE) && (m_eventType == wxEVT_LEFT_UP)) || - ((m_button_style & wxCUSTBUT_BUT_DCLICK_TOG) && (m_eventType == wxEVT_LEFT_DCLICK)) || - ((m_button_style & wxCUSTBUT_TOG_DCLICK_BUT) && (m_eventType == wxEVT_LEFT_UP))) - { - wxCommandEvent eventOut(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, GetId()); - eventOut.SetInt(m_down%2 ? 1 : 0); - eventOut.SetExtraLong(m_eventType); - eventOut.SetEventObject(this); - GetEventHandler()->ProcessEvent(eventOut); - } - else - { - wxCommandEvent eventOut(wxEVT_COMMAND_BUTTON_CLICKED, GetId()); - eventOut.SetInt(0); - eventOut.SetExtraLong(m_eventType); - eventOut.SetEventObject(this); - GetEventHandler()->ProcessEvent(eventOut); - } -} - -wxBitmap wxCustomButton::CreateBitmapDisabled(const wxBitmap &bitmap) const -{ - wxCHECK_MSG(bitmap.Ok(), wxNullBitmap, wxT("invalid bitmap")); - - unsigned char br = GetBackgroundColour().Red(); - unsigned char bg = GetBackgroundColour().Green(); - unsigned char bb = GetBackgroundColour().Blue(); - - wxImage image = bitmap.ConvertToImage(); - int pos, width = image.GetWidth(), height = image.GetHeight(); - unsigned char *img_data = image.GetData(); - - for (int j=0; j lh ? bh : lh; - if (has_bitmap && has_label) lw -= wxMin(m_labelMargin.x, m_bitmapMargin.x); - return wxSize(lw+bw, h); - } - - int w = bw > lw ? bw : lw; - if (has_bitmap && has_label) lh -= wxMin(m_labelMargin.y, m_bitmapMargin.y); - return wxSize(w, lh+bh); -} - -void wxCustomButton::CalcLayout(bool refresh) -{ - int w, h; - GetSize(&w,&h); - - int bw = 0, bh = 0; - int lw = 0, lh = 0; - - if (m_bmpLabel.Ok()) // assume they're all the same size - { - bw = m_bmpLabel.GetWidth(); - bh = m_bmpLabel.GetHeight(); - } - wxString label = GetLabel(); - if (!label.IsEmpty()) - { - GetTextExtent(label, &lw, &lh); - } - - // Center the label or bitmap if only one or the other - if (!m_bmpLabel.Ok()) - { - m_bitmapPos = wxPoint(0,0); - m_labelPos = wxPoint((w-lw)/2, (h-lh)/2); - } - else if (label.IsEmpty()) - { - m_bitmapPos = wxPoint((w-bw)/2, (h-bh)/2); - m_labelPos = wxPoint(0,0); - } - else if (m_button_style & wxCUSTBUT_LEFT) - { - int mid_margin = wxMax(m_labelMargin.x, m_bitmapMargin.x); - m_labelPos = wxPoint((w - (bw+lw+m_labelMargin.x+m_bitmapMargin.x+mid_margin))/2 + m_labelMargin.x, (h - lh)/2); - m_bitmapPos = wxPoint(m_labelPos.x + lw + mid_margin, (h - bh)/2); - } - else if (m_button_style & wxCUSTBUT_RIGHT) - { - int mid_margin = wxMax(m_labelMargin.x, m_bitmapMargin.x); - m_bitmapPos = wxPoint((w - (bw+lw+m_labelMargin.x+m_bitmapMargin.x+mid_margin))/2 + m_bitmapMargin.x, (h - bh)/2); - m_labelPos = wxPoint(m_bitmapPos.x + bw + mid_margin, (h - lh)/2); - } - else if (m_button_style & wxCUSTBUT_TOP) - { - int mid_margin = wxMax(m_labelMargin.y, m_bitmapMargin.y); - m_labelPos = wxPoint((w - lw)/2, (h - (bh+lh+m_labelMargin.y+m_bitmapMargin.y+mid_margin))/2 + m_labelMargin.y); - m_bitmapPos = wxPoint((w - bw)/2, m_labelPos.y + lh + mid_margin); - } - else // if (m_button_style & wxCUSTBUT_BOTTOM) DEFAULT - { - int mid_margin = wxMax(m_labelMargin.y, m_bitmapMargin.y); - m_bitmapPos = wxPoint((w - bw)/2, (h - (bh+lh+m_labelMargin.y+m_bitmapMargin.y+mid_margin))/2 + m_bitmapMargin.y); - m_labelPos = wxPoint((w - lw)/2, m_bitmapPos.y + bh + mid_margin); - } - - if (refresh) Refresh(FALSE); -} - - -/* XPM */ -static const char *down_arrow_xpm_data[] = { -/* columns rows colors chars-per-pixel */ -"5 3 2 1", -" c None", -"a c Black", -/* pixels */ -"aaaaa", -" aaa ", -" a "}; - -static wxBitmap s_dropdownBitmap; // all buttons share the same bitmap - -enum -{ - IDD_DROPDOWN_BUTTON = 100 -}; - -//----------------------------------------------------------------------------- -// wxMenuButtonEvents -//----------------------------------------------------------------------------- - -DEFINE_LOCAL_EVENT_TYPE(wxEVT_MENUBUTTON_OPEN) - -// ========================================================================== -// MenuDropButton -// ========================================================================== - -class MenuDropButton : public wxCustomButton -{ -public: - MenuDropButton( wxWindow *parent, wxWindowID id, long style) : wxCustomButton() - { - if (!s_dropdownBitmap.Ok()) - s_dropdownBitmap = wxBitmap(down_arrow_xpm_data); - - Create( parent, id, wxEmptyString, s_dropdownBitmap, wxDefaultPosition, - wxSize(wxMENUBUTTON_DROP_WIDTH, wxMENUBUTTON_DROP_HEIGHT), style); - } - - virtual void Paint( wxDC &dc ) - { - wxCustomButton *labelBut = ((wxMenuButton*)GetParent())->GetLabelButton(); - - // pretend that both buttons have focus (for flat style) - if (labelBut) - { - wxPoint p = GetParent()->ScreenToClient(wxGetMousePosition()); - -#if (wxMINOR_VERSION<8) - if (GetRect().Inside(p) || labelBut->GetRect().Inside(p)) -#else - if (GetRect().Contains(p) || labelBut->GetRect().Contains(p)) -#endif - { - m_focused = TRUE; - - if (!labelBut->GetFocused()) - labelBut->SetFocused(TRUE); - } - else - { - m_focused = FALSE; - - if (labelBut->GetFocused()) - labelBut->SetFocused(FALSE); - } - } - - wxCustomButton::Paint(dc); - } -}; - -// ========================================================================== -// MenuLabelButton -// ========================================================================== - -class MenuLabelButton : public wxCustomButton -{ -public: - MenuLabelButton( wxWindow* parent, wxWindowID id, - const wxString &label, - const wxBitmap &bitmap, - long style ) : wxCustomButton() - { - Create(parent, id, label, bitmap, wxDefaultPosition, wxDefaultSize, style); - } - - virtual void Paint( wxDC &dc ) - { - wxCustomButton *dropBut = ((wxMenuButton*)GetParent())->GetDropDownButton(); - - // pretend that both buttons have focus (for flat style) - if (dropBut) - { - wxPoint p = GetParent()->ScreenToClient(wxGetMousePosition()); - -#if (wxMINOR_VERSION<8) - if (GetRect().Inside(p) || dropBut->GetRect().Inside(p)) -#else - if (GetRect().Contains(p) || dropBut->GetRect().Contains(p)) -#endif - { - m_focused = TRUE; - - if (!dropBut->GetFocused()) - dropBut->SetFocused(TRUE); - } - else - { - m_focused = FALSE; - - if (dropBut->GetFocused()) - dropBut->SetFocused(FALSE); - } - } - - wxCustomButton::Paint(dc); - } -}; - -// ========================================================================== -// wxMenuButton -// ========================================================================== - -IMPLEMENT_DYNAMIC_CLASS( wxMenuButton, wxControl ) - -BEGIN_EVENT_TABLE(wxMenuButton,wxControl) - EVT_BUTTON(wxID_ANY, wxMenuButton::OnButton) - -#ifdef __WXMSW__ - EVT_MENU(wxID_ANY, wxMenuButton::OnMenu) -#endif -END_EVENT_TABLE() - -wxMenuButton::~wxMenuButton() -{ - AssignMenu(NULL, TRUE); -} - -void wxMenuButton::Init() -{ - m_labelButton = NULL; - m_dropdownButton = NULL; - m_menu = NULL; - m_menu_static = FALSE; - m_style = 0; -} - -bool wxMenuButton::Create( wxWindow* parent, wxWindowID id, - const wxString &label, - const wxBitmap &bitmap, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& val, - const wxString& name) -{ - m_style = style; - - long flat = style & wxMENUBUT_FLAT; - - wxControl::Create(parent,id,pos,size,wxNO_BORDER|wxCLIP_CHILDREN,val,name); - wxControl::SetLabel(label); - SetBackgroundColour(parent->GetBackgroundColour()); - SetForegroundColour(parent->GetForegroundColour()); - SetFont(parent->GetFont()); - - m_labelButton = new MenuLabelButton(this, id, label, bitmap, wxCUSTBUT_BUTTON|flat); - m_dropdownButton = new MenuDropButton(this, IDD_DROPDOWN_BUTTON, wxCUSTBUT_BUTTON|flat); - - wxSize bestSize = DoGetBestSize(); - SetSize( wxSize(size.x < 0 ? bestSize.x : size.x, - size.y < 0 ? bestSize.y : size.y) ); - -#if (wxMINOR_VERSION<8) - SetBestSize(GetSize()); -#else - SetInitialSize(GetSize()); -#endif - - return TRUE; -} - -#ifdef __WXMSW__ -// FIXME - I think there was a patch to fix this -void wxMenuButton::OnMenu( wxCommandEvent &event ) -{ - event.Skip(); - wxMenuItem *mi = m_menu->FindItem(event.GetId()); - if (mi && (mi->GetKind() == wxITEM_RADIO)) - m_menu->Check(event.GetId(), TRUE); -} -#endif // __WXMSW__ - -void wxMenuButton::OnButton( wxCommandEvent &event) -{ - int win_id = event.GetId(); - - if (win_id == IDD_DROPDOWN_BUTTON) - { - wxNotifyEvent mevent(wxEVT_MENUBUTTON_OPEN, GetId()); - mevent.SetEventObject(this); - if (GetEventHandler()->ProcessEvent(mevent) && !mevent.IsAllowed()) - return; - - if (!m_menu) - return; - - PopupMenu(m_menu, wxPoint(0, GetSize().y)); - - m_labelButton->Refresh(FALSE); - m_dropdownButton->Refresh(FALSE); - } - else if (win_id == m_labelButton->GetId()) - { - - wxCommandEvent cevent(wxEVT_COMMAND_MENU_SELECTED, win_id); - cevent.SetEventObject(this); - cevent.SetId(win_id); - GetParent()->GetEventHandler()->ProcessEvent(cevent); - - if (!m_menu) return; - - const wxMenuItemList &items = m_menu->GetMenuItems(); - int first_radio_id = -1; - int checked_id = -1; - bool check_next = FALSE; - - // find the next available radio item to check - for (wxMenuItemList::Node *node = items.GetFirst(); node; node = node->GetNext()) - { - wxMenuItem *mi = (wxMenuItem*)node->GetData(); - if (mi && (mi->GetKind() == wxITEM_RADIO)) - { - if (first_radio_id == -1) - first_radio_id = mi->GetId(); - - if (check_next) - { - check_next = FALSE; - checked_id = mi->GetId(); - break; - } - else if (mi->IsChecked()) - check_next = TRUE; - } - } - // the last item was checked, go back to the first - if (check_next && (first_radio_id != -1)) - checked_id = first_radio_id; - - if (checked_id != -1) - { - m_menu->Check(checked_id, TRUE); - - wxCommandEvent mevent( wxEVT_COMMAND_MENU_SELECTED, checked_id); - mevent.SetEventObject( m_menu ); - mevent.SetInt(1); - GetEventHandler()->ProcessEvent(mevent); - } - } -} - -int wxMenuButton::GetSelection() const -{ - wxCHECK_MSG(m_menu != NULL, wxNOT_FOUND, wxT("No attached menu in wxMenuButton::GetSelection")); - - const wxMenuItemList &items = m_menu->GetMenuItems(); - - for (wxMenuItemList::Node *node = items.GetFirst(); node; node = node->GetNext()) - { - wxMenuItem *mi = (wxMenuItem*)node->GetData(); - if (mi && (mi->GetKind() == wxITEM_RADIO)) - { - if (mi->IsChecked()) - return mi->GetId(); - } - } - - return wxNOT_FOUND; -} - -void wxMenuButton::AssignMenu(wxMenu *menu, bool static_menu) -{ - if (!m_menu_static && m_menu) - delete m_menu; - - m_menu = menu; - m_menu_static = static_menu; -} - -void wxMenuButton::SetToolTip(const wxString &tip) -{ - wxWindow::SetToolTip(tip); - ((wxWindow*)m_labelButton)->SetToolTip(tip); - ((wxWindow*)m_dropdownButton)->SetToolTip(tip); -} -void wxMenuButton::SetToolTip(wxToolTip *tip) -{ - wxWindow::SetToolTip(tip); - ((wxWindow*)m_labelButton)->SetToolTip(tip); - ((wxWindow*)m_dropdownButton)->SetToolTip(tip); -} - -void wxMenuButton::DoSetSize(int x, int y, int width, int height, int sizeFlags) -{ - wxSize curSize( GetSize() ); - wxSize bestSize( DoGetBestSize() ); - - if (width == -1) - width = curSize.GetWidth(); - if (width < 10) - width = bestSize.GetWidth(); - - if (height == -1) - height = curSize.GetHeight(); - if (height < 5) - height = bestSize.GetHeight(); - - wxWindow::DoSetSize(x, y, width, height, sizeFlags); - - if (m_labelButton) - m_labelButton->SetSize(0, 0, width - wxMENUBUTTON_DROP_WIDTH, height); - if (m_dropdownButton) - m_dropdownButton->SetSize(width-wxMENUBUTTON_DROP_WIDTH, 0, wxMENUBUTTON_DROP_WIDTH, height); -} - -wxSize wxMenuButton::DoGetBestSize() -{ - if (!m_labelButton || !m_dropdownButton) - return wxSize(wxMENUBUTTON_DROP_WIDTH+wxMENUBUTTON_DROP_HEIGHT, wxMENUBUTTON_DROP_HEIGHT); - - wxSize size = m_labelButton->GetBestSize(); - size.x += wxMENUBUTTON_DROP_WIDTH; - return size; -} diff --git a/applications/osmo4_wx/menubtn.h b/applications/osmo4_wx/menubtn.h deleted file mode 100644 index 441c7b7..0000000 --- a/applications/osmo4_wx/menubtn.h +++ /dev/null @@ -1,314 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wxMenuButton -// Purpose: A button with a dropdown wxMenu -// Author: John Labenski -// Modified by: -// Created: 11/05/2002 -// Copyright: (c) John Labenski -// Licence: wxWidgets licence -///////////////////////////////////////////////////////////////////////////// - -/* - -wxMenuButton is a button that drops down an assigned wxMenu - -Create the button with either a text or bitmap label. - Create a new wxMenu and call AssignMenu and thats it. When you press the - dropdown button the menu appears. When you press the label button the next - wxITEM_RADIO (ie wxMenuItem::GetKind) in the menu is selected round robin. - If there are no radio items then it really just acts like a menubar, though - this is probably not too useful. The events sent in this case are EVT_MENUs - either generated by the menu when you click on it or created when you click - on the label to select the next radio item. -*/ - -#ifndef _WX_MENUBTN_H_ -#define _WX_MENUBTN_H_ - -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma interface "menubtn.h" -#endif - -class wxMenu; -class wxBitmap; -class wxCustomButton; - -//----------------------------------------------------------------------------- -// wxCustomButton styles -//----------------------------------------------------------------------------- - -enum wxCustomButton_Style -{ - // Position of the label, use only one - wxCUSTBUT_LEFT = 0x0001, - wxCUSTBUT_RIGHT = 0x0002, - wxCUSTBUT_TOP = 0x0004, - wxCUSTBUT_BOTTOM = 0x0008, - // Button style, use only one - wxCUSTBUT_NOTOGGLE = 0x0100, - wxCUSTBUT_BUTTON = 0x0200, - wxCUSTBUT_TOGGLE = 0x0400, - wxCUSTBUT_BUT_DCLICK_TOG = 0x0800, - wxCUSTBUT_TOG_DCLICK_BUT = 0x1000, - // drawing styles - wxCUSTBUT_FLAT = 0x2000 // flat, mouseover raises if not depressed -}; - -//----------------------------------------------------------------------------- -// wxCustomButton -//----------------------------------------------------------------------------- - -class WXDLLEXPORT wxCustomButton : public wxControl -{ -public: - - wxCustomButton() : wxControl() { Init(); } - - // wxToggleButton or wxButton compatible constructor (also wxTextCtrl) - wxCustomButton(wxWindow* parent, wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCUSTBUT_TOGGLE, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxT("wxCustomButton")) - : wxControl() - { - Init(); - Create(parent,id,label,wxNullBitmap,pos,size,style,val,name); - } - - // wxBitmapButton compatible constructor - wxCustomButton(wxWindow *parent, wxWindowID id, - const wxBitmap& bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCUSTBUT_TOGGLE, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxT("wxCustomButton")) - : wxControl() - { - Init(); - Create(parent,id,wxEmptyString,bitmap,pos,size,style,val,name); - } - - // Native constructor - wxCustomButton(wxWindow *parent, wxWindowID id, - const wxString& label, const wxBitmap& bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxCUSTBUT_TOGGLE|wxCUSTBUT_BOTTOM, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxT("wxCustomButton")) - : wxControl() - { - Init(); - Create(parent,id,label,bitmap,pos,size,style,val,name); - } - - virtual ~wxCustomButton(); - - bool Create(wxWindow* parent, - wxWindowID id, - const wxString& label, - const wxBitmap &bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxT("wxCustomButton")); - - bool GetValue() const { return m_down%2 != 0; } - void SetValue( bool depressed ); - - // Use combinations of wxCustomButton_Style(s) - long GetButtonStyle() const { return m_button_style; } - bool SetButtonStyle( long style ); - - // Set the text label, wxEmptyString for none - void SetLabel( const wxString &label ); - - // set the bitmaps, ONLY this Label bitmap is used for calculating control size - // all bitmaps will be centered accordingly in any case - // call SetSet(GetBestSize()) if you change their size and want the control to resize appropriately - void SetBitmapLabel(const wxBitmap& bitmap); - void SetBitmapSelected(const wxBitmap& sel) { m_bmpSelected = sel; CalcLayout(TRUE); }; - void SetBitmapFocus(const wxBitmap& focus) { m_bmpFocus = focus; CalcLayout(TRUE); }; - void SetBitmapDisabled(const wxBitmap& disabled) { m_bmpDisabled = disabled; CalcLayout(TRUE); }; - // wxBitmapButton compatibility - void SetLabel(const wxBitmap& bitmap) { SetBitmapLabel(bitmap); } - - // retrieve the bitmaps - const wxBitmap& GetBitmapLabel() const { return m_bmpLabel; } - const wxBitmap& GetBitmapSelected() const { return m_bmpSelected; } - const wxBitmap& GetBitmapFocus() const { return m_bmpFocus; } - const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; } - - // Creates a "disabled" bitmap by dithering it with the background colour - wxBitmap CreateBitmapDisabled(const wxBitmap &bitmap) const; - - // set/get the margins (in pixels) around the label and bitmap - // if fit = TRUE then resize the button to fit - void SetMargins(const wxSize &margin, bool fit = FALSE); - - // set/get the margins around the text label - // the inter bitmap/label margin is the max of either margin, not the sum - void SetLabelMargin(const wxSize &margin, bool fit = FALSE); - wxSize GetLabelMargin() const { return m_labelMargin; } - // set/get the margins around the bitmap - // the inter bitmap/label margin is the max of either margin, not the sum - void SetBitmapMargin(const wxSize &margin, bool fit = FALSE); - wxSize GetBitmapMargin() const { return m_bitmapMargin; } - - // can be used to activate the focused behavior (see MenuButton) - void SetFocused(bool focused) { m_focused = focused; Refresh(FALSE); } - bool GetFocused() const { return m_focused; } - -protected: - void OnPaint(wxPaintEvent &event); - void Redraw(); - virtual void Paint( wxDC &dc ); - - virtual wxSize DoGetBestSize() const; - - virtual void SendEvent(); - - void OnMouseEvents(wxMouseEvent &event); - - void OnSize( wxSizeEvent &event ); - - virtual void CalcLayout(bool refresh); - - long m_down; // toggle state if m_down%2 then depressed - bool m_focused; // mouse in window - long m_button_style; - - // the bitmaps for various states - wxBitmap m_bmpLabel, - m_bmpSelected, - m_bmpFocus, - m_bmpDisabled; - - // the margins around the label/bitmap - wxSize m_labelMargin, - m_bitmapMargin; - - wxPoint m_bitmapPos, - m_labelPos; - - wxTimer *m_timer; - - wxEventType m_eventType; // store the mouse event type - -private: - void Init(); - DECLARE_DYNAMIC_CLASS(wxCustomButton) - DECLARE_EVENT_TABLE() -}; - -//----------------------------------------------------------------------------- -// wxMenuButton styles -//----------------------------------------------------------------------------- - -#define wxMENUBUTTON_DROP_WIDTH 10 -#define wxMENUBUTTON_DROP_HEIGHT 22 - -enum wxMenuButton_Styles -{ - wxMENUBUT_FLAT = wxCUSTBUT_FLAT -}; - -//----------------------------------------------------------------------------- -// wxMenuButton -//----------------------------------------------------------------------------- - -class wxMenuButton : public wxControl -{ -public: - - wxMenuButton() : wxControl() { Init(); } - - // Use this constructor if you need one compatible with a wxBitmapButton - // setup the button later with AssignMenu - wxMenuButton( wxWindow* parent, wxWindowID id, - const wxBitmap &bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxT("wxMenuButton")) - : wxControl() - { - Init(); - Create(parent,id,wxEmptyString,bitmap,pos,size,style,val,name); - } - - virtual ~wxMenuButton(); - - bool Create( wxWindow* parent, - wxWindowID id, - const wxString &label, - const wxBitmap &bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxNO_BORDER, - const wxValidator& val = wxDefaultValidator, - const wxString& name = wxT("wxMenuButton")); - - // Gets the id of the first selected radio item or wxNOT_FOUND (-1) if none - int GetSelection() const; - - // This menu will be displayed when the dropdown button is pressed. - // if static_menu is FALSE it will be deleted when the buttton is destroyed. - void AssignMenu(wxMenu *menu, bool static_menu = FALSE); - - wxMenu *GetMenu() const { return m_menu; } - - // get a pointer to the label button, for turning it into a toggle perhaps - wxCustomButton *GetLabelButton() const { return m_labelButton; } - wxCustomButton *GetDropDownButton() const { return m_dropdownButton; } - - void SetToolTip(const wxString &tip); - void SetToolTip(wxToolTip *tip); - -protected: - void OnButton(wxCommandEvent &event); - - virtual void DoSetSize(int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO); - - virtual wxSize DoGetBestSize(); - -// FIXME! - in MSW the radio items don't check themselves -#ifdef __WXMSW__ - void OnMenu( wxCommandEvent &event ); -#endif - - wxCustomButton *m_labelButton; - wxCustomButton *m_dropdownButton; - - wxMenu *m_menu; - bool m_menu_static; - long m_style; - -private: - void Init(); - DECLARE_DYNAMIC_CLASS(wxMenuButton) - DECLARE_EVENT_TABLE() -}; - -//----------------------------------------------------------------------------- -// wxMenuButtonEvents -// -// EVT_MENUBUTTON_OPEN(id, fn) - menu is about to be opened, (dis)(en)able items -// or call Veto() to stop menu from popping up -// this is a wxNotifyEvent -//----------------------------------------------------------------------------- - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_LOCAL_EVENT_TYPE( wxEVT_MENUBUTTON_OPEN, 0 ) -END_DECLARE_EVENT_TYPES() - -#define EVT_MENUBUTTON_OPEN(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_MENUBUTTON_OPEN, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) & fn, (wxObject *) NULL ), - -#endif // _WX_MENUBTN_H_ diff --git a/applications/osmo4_wx/osmo4.ico b/applications/osmo4_wx/osmo4.ico deleted file mode 100644 index 36ff667..0000000 Binary files a/applications/osmo4_wx/osmo4.ico and /dev/null differ diff --git a/applications/osmo4_wx/osmo4.xpm b/applications/osmo4_wx/osmo4.xpm deleted file mode 100644 index bec8e6a..0000000 --- a/applications/osmo4_wx/osmo4.xpm +++ /dev/null @@ -1,301 +0,0 @@ -/* XPM */ -static const char * osmo4[] = { -"32 32 266 2", -" c None", -". c #990909", -"+ c #A10505", -"@ c #AB0404", -"# c #AF0202", -"$ c #B10303", -"% c #AE0202", -"& c #A90505", -"* c #A10606", -"= c #990E0E", -"- c #990D0D", -"; c #A80303", -"> c #BD0000", -", c #D40000", -"' c #DE0000", -") c #E20000", -"! c #E10000", -"~ c #DC0000", -"{ c #CD0000", -"] c #B80101", -"^ c #A40909", -"/ c #A20505", -"( c #BD0101", -"_ c #E00000", -": c #CB0000", -"< c #A80000", -"[ c #7E0101", -"} c #6B0202", -"| c #670202", -"1 c #720202", -"2 c #920000", -"3 c #B70000", -"4 c #D70000", -"5 c #B80303", -"6 c #9D0B0B", -"7 c #980909", -"8 c #B00202", -"9 c #DB0000", -"0 c #B50909", -"a c #8A1313", -"b c #1C0505", -"c c #070505", -"d c #080808", -"e c #0A0A0A", -"f c #090909", -"g c #070707", -"h c #0C0404", -"i c #5B1414", -"j c #A70F0F", -"k c #CC0303", -"l c #CC0000", -"m c #AB0505", -"n c #950D0D", -"o c #B60101", -"p c #DD0000", -"q c #CF0202", -"r c #9C1414", -"s c #141414", -"t c #0C0C0C", -"u c #0F0F0F", -"v c #111111", -"w c #101010", -"x c #0E0E0E", -"y c #B70707", -"z c #DF0000", -"A c #D50000", -"B c #A90606", -"C c #970E0E", -"D c #B30202", -"E c #C50505", -"F c #812121", -"G c #191919", -"H c #161616", -"I c #181818", -"J c #171717", -"K c #151515", -"L c #AF0A0A", -"M c #D70101", -"N c #D60000", -"O c #AD0606", -"P c #AA0303", -"Q c #DA0000", -"R c #C80505", -"S c #8E1E1E", -"T c #1D1D1D", -"U c #1F1F1F", -"V c #202020", -"W c #B00909", -"X c #CE0000", -"Y c #9F0A0A", -"Z c #9B0808", -"` c #D20000", -" . c #D80101", -".. c #8B1B1B", -"+. c #2D2D2D", -"@. c #272727", -"#. c #262626", -"$. c #252525", -"%. c #BB0606", -"&. c #BB0303", -"*. c #AF0303", -"=. c #AF0B0B", -"-. c #303030", -";. c #2B2B2B", -">. c #323232", -",. c #CD0202", -"'. c #A60A0A", -"). c #9E0909", -"!. c #CF0000", -"~. c #CE0404", -"{. c #292929", -"]. c #B10808", -"^. c #A70303", -"/. c #B60A0A", -"(. c #961010", -"_. c #B90000", -":. c #9C1212", -"<. c #1A1A1A", -"[. c #222222", -"}. c #1C1C1C", -"|. c #C20202", -"1. c #A30606", -"2. c #C60000", -"3. c #2A2A2A", -"4. c #3B3B3B", -"5. c #444444", -"6. c #434343", -"7. c #3A3A3A", -"8. c #1E1E1E", -"9. c #131313", -"0. c #BB0A0A", -"a. c #AD0707", -"b. c #9A1515", -"c. c #D30000", -"d. c #353535", -"e. c #484848", -"f. c #5F5F5F", -"g. c #6C6C6C", -"h. c #646464", -"i. c #565656", -"j. c #343434", -"k. c #212121", -"l. c #121212", -"m. c #B30505", -"n. c #B10404", -"o. c #9A1111", -"p. c #424242", -"q. c #555555", -"r. c #6B6B6B", -"s. c #757575", -"t. c #6E6E6E", -"u. c #606060", -"v. c #4E4E4E", -"w. c #3F3F3F", -"x. c #2C2C2C", -"y. c #B10909", -"z. c #B60707", -"A. c #9B1515", -"B. c #D00000", -"C. c #494949", -"D. c #595959", -"E. c #676767", -"F. c #696969", -"G. c #616161", -"H. c #525252", -"I. c #454545", -"J. c #B20707", -"K. c #363636", -"L. c #626262", -"M. c #5B5B5B", -"N. c #505050", -"O. c #282828", -"P. c #B80B0B", -"Q. c #AC0707", -"R. c #AA1111", -"S. c #0D0D0D", -"T. c #585858", -"U. c #545454", -"V. c #4B4B4B", -"W. c #BF0303", -"X. c #9F0B0B", -"Y. c #B90707", -"Z. c #242424", -"`. c #313131", -" + c #3E3E3E", -".+ c #474747", -"++ c #4D4D4D", -"@+ c #4F4F4F", -"#+ c #4C4C4C", -"$+ c #3D3D3D", -"%+ c #D90000", -"&+ c #8E1010", -"*+ c #A00808", -"=+ c #D00303", -"-+ c #3C3C3C", -";+ c #0B0B0B", -">+ c #AE0808", -",+ c #C10101", -"'+ c #BB0202", -")+ c #BA0A0A", -"!+ c #1B1B1B", -"~+ c #2F2F2F", -"{+ c #C10303", -"]+ c #A10A0A", -"^+ c #9F0707", -"/+ c #D80000", -"(+ c #BE0303", -"_+ c #821C1C", -":+ c #C20404", -"<+ c #232323", -"[+ c #A90C0C", -"}+ c #970C0C", -"|+ c #960E0E", -"1+ c #BE0101", -"2+ c #C60505", -"3+ c #131212", -"4+ c #B00B0B", -"5+ c #CE0101", -"6+ c #A80707", -"7+ c #990B0B", -"8+ c #C40404", -"9+ c #AD0909", -"0+ c #D00101", -"a+ c #B00505", -"b+ c #7B1C1C", -"c+ c #960C0C", -"d+ c #BC0202", -"e+ c #BC0808", -"f+ c #962525", -"g+ c #482E2E", -"h+ c #1E1616", -"i+ c #141010", -"j+ c #2F2020", -"k+ c #703636", -"l+ c #A81212", -"m+ c #A90707", -"n+ c #8E1313", -"o+ c #D30606", -"p+ c #B91E1E", -"q+ c #901919", -"r+ c #661010", -"s+ c #540F0F", -"t+ c #4F0D0D", -"u+ c #5A0F0F", -"v+ c #7A1515", -"w+ c #A21E1E", -"x+ c #C51212", -"y+ c #D60101", -"z+ c #980D0D", -"A+ c #930C0C", -"B+ c #B30404", -"C+ c #C60202", -"D+ c #7B1919", -"E+ c #8C1515", -"F+ c #9F0909", -"G+ c #B20303", -"H+ c #C30000", -"I+ c #CA0000", -"J+ c #C90000", -"K+ c #BC0101", -"L+ c #AA0505", -"M+ c #8F1111", -"N+ c #7F1E1E", -"O+ c #732626", -"P+ c #762A2A", -"Q+ c #6E2828", -" ", -" . + @ # $ % & * = ", -" - ; > , ' ) ) ! ) ! ~ { ] ^ ", -" / ( ' _ : < [ } | 1 2 3 4 ) , 5 6 ", -" 7 8 9 ' 0 a b c d e e f g h i j k ) l m ", -" n o p q r s t u v v w t x y z A B ", -" C D ) E F G H I G J K L M N O ", -" P Q R S T U U T V W ' X Y ", -" Z ` ... +.@.#.$. %.! &. ", -" *.) =. -.;.>. ,.4 '. ", -" ).!.~. {. ].) ( ", -" ^.z /. $. A ` (. ", -" _.! :. K K <.V [.}.K K |.z 1. ", -" 2.9 v <.3.4.5.6.7.;.8.9.J 0.) a. ", -" b.!.c. w }.d.e.f.g.h.i.5.j.k.l. m._ n. ", -" o.` !. u J 3.p.q.r.s.t.u.v.w.x.T w y._ z. ", -" A.B.` u k.j.C.D.E.g.F.G.H.I.j.$.9.l. m._ J. ", -" : 4 s v #.K.C.q.u.h.L.M.N.I.K.O.J x P.) Q. ", -" > z R. S.9.#.d.5.v.i.D.T.U.V.p.j.{.G t W._ X. ", -" % ) Y. l.9.Z.`. +.+++N.@+#+I.$+>.@.I t { %+&+ ", -" *+, =+ x w V ;.K.$+6.I.I.p.-+K.;.[.H ;+ >+z ,+ ", -" '+_ )+ x S.!+Z.~+d.7.-+-+7.d.~+#.8.9.;+ {+_ ]+ ", -" ^+/+, e s }.$.;.~+`.`.-.;.#.U J S.w z.' (+_+ ", -" ] ) :+ t S.K T [.@.O.O.@.<+U I v ;+ [+` ~ }+ ", -" |+1+) 2+ e t 9.I }.T 8.}.G K u e 3+ 4+5+' 6+ ", -" 7+l ) 8+ e ;+u 9.K K 9.v S.f w 9+0+) a+b+ ", -" c+d+) N e+f+g+h+;+f e f i+j+k+l+|.~ /+m+ ", -" n+D N ! o+p+q+r+s+t+u+v+w+x+y+! X z+ ", -" A+B+X _ ! ~ /+N %+' ) ~ C+Y D+ ", -" E+F+G+H+I+l J+K+L+M+N+ ", -" O+P+Q+ ", -" "}; diff --git a/applications/osmo4_wx/playlist.xpm b/applications/osmo4_wx/playlist.xpm deleted file mode 100644 index cfad2dc..0000000 --- a/applications/osmo4_wx/playlist.xpm +++ /dev/null @@ -1,158 +0,0 @@ -/* XPM */ -static const char* pl_open[] = { -"16 16 5 1", -" c #000000", -"! c #808000", -"# c #C0C0C0", -"$ c #FFFF00", -"% c #FFFFFF", -"################", -"################", -"######### ####", -"######## ### # #", -"############# #", -"# ######## #", -" %$% #####", -" $%$%$%$%$ #####", -" %$%$%$%$% #####", -" $%$% #", -" %$% !!!!!!!!! #", -" $% !!!!!!!!! ##", -" % !!!!!!!!! ###", -" !!!!!!!!! ####", -" #####", -"################"}; - -/* XPM */ -static const char* pl_save[] = { -"16 16 3 1", -" c #000000", -"! c #808000", -"# c #C0C0C0", -"################", -"# #", -"# ! ######## # #", -"# ! ######## #", -"# ! ######## ! #", -"# ! ######## ! #", -"# ! ######## ! #", -"# ! ######## ! #", -"# !! !! #", -"# !!!!!!!!!!!! #", -"# !! ! #", -"# !! ## ! #", -"# !! ## ! #", -"# !! ## ! #", -"## #", -"################"}; - -/* XPM */ -static const char* pl_add[] = { -"16 16 2 1", -" c #000000", -"! c #C0C0C0", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!! !!!!!!!", -"!!!!!! !!!!!!!", -"!!!!!! !!!!!!!", -"!!!!!! !!!!!!!", -"!! !!!", -"!! !!!", -"!! !!!", -"!!!!!! !!!!!!!", -"!!!!!! !!!!!!!", -"!!!!!! !!!!!!!", -"!!!!!! !!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!"}; - -/* XPM */ -static const char* pl_rem[] = { -"16 16 2 1", -" c #000000", -"! c #C0C0C0", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!! !!!", -"!! !!!", -"!! !!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!"}; - -/* XPM */ -static const char* pl_up[] = { -"16 16 2 1", -" c #000000", -"! c #C0C0C0", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!! !!!!!!!!", -"!!!!!! !!!!!!!", -"!!!!! !!!!!!", -"!!!! !!!!!", -"!!! !!!!", -"!!!!!! !!!!!!!", -"!!!!!! !!!!!!!", -"!!!!!! !!!!!!!", -"!!!!!! !!!!!!!", -"!!!!!! !!!!!!!", -"!!!!!! !!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!"}; - -/* XPM */ -static const char* pl_down[] = { -"16 16 2 1", -" c #000000", -"! c #C0C0C0", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!! !!!!!!!", -"!!!!!! !!!!!!!", -"!!!!!! !!!!!!!", -"!!!!!! !!!!!!!", -"!!!!!! !!!!!!!", -"!!!!!! !!!!!!!", -"!!! !!!!", -"!!!! !!!!!", -"!!!!! !!!!!!", -"!!!!!! !!!!!!!", -"!!!!!!! !!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!"}; - -/* XPM */ -static const char* pl_sort[] = { -"16 16 2 1", -" c #000000", -"! c #C0C0C0", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!! !!!!! !!!!!", -"!!!! !!!! !!!!", -"!!!! !!! !!!", -"!!!! !!!!! !!!!!", -"!!!! !!!!! !!!!!", -"!!!! !!!!! !!!!!", -"!!!! !!!!! !!!!!", -"!! !!! !!!!!", -"!!! !!!! !!!!!", -"!!!! !!!!! !!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!"}; - diff --git a/applications/osmo4_wx/resource.h b/applications/osmo4_wx/resource.h deleted file mode 100644 index ace6dd4..0000000 --- a/applications/osmo4_wx/resource.h +++ /dev/null @@ -1,16 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by wxOsmo4.rc -// -#define IDI_OSMO_ICON 101 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 104 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/applications/osmo4_wx/toolbar.xpm b/applications/osmo4_wx/toolbar.xpm deleted file mode 100644 index 887d59e..0000000 --- a/applications/osmo4_wx/toolbar.xpm +++ /dev/null @@ -1,254 +0,0 @@ -/* XPM */ -static const char* tool_open_file[] = { -"16 16 2 1", -" c #000000", -"! c none", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!! !!!!!!!", -"!!!!!! !!!!!!", -"!!!!! !!!!!", -"!!!! !!!!", -"!!! !!!", -"!! !!", -"!! !!", -"!!!!!!!!!!!!!!!!", -"!! !!", -"!! !!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!"}; - -/* XPM */ -static const char* tool_prev[] = { -"16 16 3 1", -" c #000000", -"! c none", -"# c #FF0000", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!! !!", -"!!!!!!!!!! !!", -"!!!!!!!! ## !!", -"!!!!!! #### !!", -"!!!! ###### !!", -"!!! ######## !!", -"!!!! ##### !!", -"!!!!!! ### !!", -"!!!!!!!! # !!", -"!!!!!!!!!! !!", -"!!!!!!!!!!!! !!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!"}; - -/* XPM */ -static const char* tool_next[] = { -"16 16 3 1", -" c #000000", -"! c none", -"# c #FF0000", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!! !!!!!!!!!!!!", -"!! !!!!!!!!!!", -"!! ## !!!!!!!!", -"!! #### !!!!!!", -"!! ###### !!!!", -"!! ######## !!!", -"!! ###### !!!!", -"!! #### !!!!!!", -"!! ## !!!!!!!!", -"!! !!!!!!!!!!", -"!! !!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!"}; - -/* XPM */ -static const char* tool_play[] = { -"16 16 2 1", -" c #000000", -"! c none", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!! !!!!!!!!!!!!", -"!! !!!!!!!!!!", -"!! !!!!!!!!", -"!! !!!!!!", -"!! !!!!", -"!! !!", -"!! !!!!", -"!! !!!!!!", -"!! !!!!!!!!", -"!! !!!!!!!!!!", -"!! !!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!"}; - -/* XPM */ -static const char* tool_pause[] = { -"16 16 3 1", -" c #000000", -"! c #808080", -"# c none", -"################", -"################", -"################", -"### !##! ###", -"### !##! ###", -"### !##! ###", -"### !##! ###", -"### !##! ###", -"### !##! ###", -"### !##! ###", -"### !##! ###", -"### !##! ###", -"### !##! ###", -"### !##! ###", -"################", -"################"}; - - -/* XPM */ -static const char* tool_step[] = { -"16 16 2 1", -" c #000000", -"! c none", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!! !!!!!!!!!!!", -"!! !!!!!!!!!", -"!! !!!!!!!", -"!!!! !!!!!", -"!!!!!! !!!", -"!!!!!!!! !!", -"!!!!!! !!!", -"!!!! !!!!!", -"!! !!!!!!!", -"!! !!!!!!!!!", -"!! !!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!"}; - - -/* XPM */ -static const char* tool_stop[] = { -"16 16 2 1", -" c #000000", -"! c none", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!", -"!! !!", -"!! !!", -"!! !!", -"!! !!", -"!! !!", -"!! !!", -"!! !!", -"!! !!", -"!! !!", -"!! !!", -"!! !!", -"!!!!!!!!!!!!!!!!", -"!!!!!!!!!!!!!!!!"}; - -/* XPM */ -static const char* tool_info[] = { -"16 16 3 1", -" c #000000", -"! c none", -"# c #0000FF", -"!!!!!!!!!!!!!!!!", -"!!!!! !!!!!", -"!!! !!!", -"!! ###### !!", -"! ####!!#### !", -"! ####!!#### !", -" ############ ", -" #####!!##### ", -" ######!!##### ", -" #####!!##### ", -" #####!!##### ", -"! ####!!#### !", -"! #####!!### !", -"!! ###### !!", -"!!! !!!", -"!!!!! !!!!!"}; - - -/* XPM */ -static const char* tool_config[] = { -"16 16 3 1", -" c #000000", -"! c #808080", -"# c none", -"################", -"################", -"## ## ######", -"## ## # ## # ##", -"## ## #", -"## #!# ####### #", -"## # #!# ## ## #", -"## #!# #!# ! # #", -"## # #!# ## ## #", -"## #!# #!##### #", -"## # #!# ## ## #", -"## #!# #!# ! # #", -"## # #!# ## ## #", -"## #", -"################", -"################"}; - -/* XPM */ -static const char* tool_sw_2d[] = { -"16 16 4 1", -" c #FF0000", -". c #C0C0C0", -"+ c #0000FF", -"@ c #000000", -" .............. ", -". ..++..++++.. .", -".. +..+..+..+ ..", -"... ..+..+.. ...", -".... +...+. +...", -"...+. +..+ .+...", -"...+++ .+ ++....", -"....... .......", -"....@@ @@ @.....", -"...@. .@.@ .....", -"...@ ....@. ....", -"... ..@@.@.. ...", -".. @...@.@.@. ..", -". ..@@@@@@@@.. .", -" .............. ", -"................"}; - -/* XPM */ -static const char* tool_sw_3d[] = { -"16 16 4 1", -" c #FFFFFF", -". c #C0C0C0", -"+ c #0000FF", -"@ c #000000", -" ", -"................", -"....++..++++....", -"...+..+..+..+...", -"......+..+..+...", -"....++...+..+...", -"...+..+..+..+...", -"...++++.++++....", -"................", -"....@@@@@@@.....", -"...@...@.@......", -"...@.....@......", -"...@..@@.@......", -"...@...@.@.@....", -"....@@@@@@@@....", -"................"}; - diff --git a/applications/osmo4_wx/wxGPACControl.cpp b/applications/osmo4_wx/wxGPACControl.cpp deleted file mode 100644 index 7d16802..0000000 --- a/applications/osmo4_wx/wxGPACControl.cpp +++ /dev/null @@ -1,1031 +0,0 @@ -/* - * GPAC - Multimedia Framework C SDK - * - * Copyright (c) Jean Le Feuvre 2000-2005 - * All rights reserved - * - * This file is part of GPAC / Osmo4 wxWidgets GUI - * - * GPAC is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * GPAC is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - */ - -#include "wxOsmo4.h" -#include -#include -#include -#include -#include -#include - -#include - -#include "wxGPACControl.h" - - -#define NUM_RATES 11 -static const char *BIFSRates[11] = -{ - "5.0", - "7.5", - "10.0", - "12.5", - "15.0", - "24.0", - "25.0", - "30.0", - "50.0", - "60.0", - "100.0" -}; - -void wxGPACControl::SetYUVLabel() -{ - u32 yuv_format = gf_term_get_option(m_pApp->m_term, GF_OPT_YUV_FORMAT); - if (!yuv_format) { - m_yuvtxt->SetLabel(wxT("(No YUV used)")); - } else { - char str[100]; - sprintf(str, "(%s used)", gf_4cc_to_str(yuv_format)); - m_yuvtxt->SetLabel(wxString(str, wxConvUTF8) ); - } -} - -wxGPACControl::wxGPACControl(wxWindow *parent) - : wxDialog(parent, -1, wxString(wxT("GPAC Control Panel"))) -{ - const char *sOpt; - SetSize(320, 240); - u32 i; - wxBoxSizer *bs; - Centre(); - - m_pApp = (wxOsmo4Frame *)parent; - - s_main = new wxBoxSizer(wxVERTICAL); - - s_header = new wxBoxSizer(wxHORIZONTAL); - //s_header->Add(new wxStaticText(this, 0, wxT("Category"), wxDefaultPosition, wxSize(60, 20)), wxALIGN_CENTER); - m_select = new wxComboBox(this, ID_SELECT, wxT(""), wxDefaultPosition, wxSize(120, 30), 0, NULL, wxCB_READONLY); - s_header->Add(m_select, 2, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_header->Add( new wxButton(this, ID_APPLY, wxT("Apply"), wxDefaultPosition, -#ifdef WIN32 - wxSize(40, 20) -#else - wxSize(40, 30) -#endif - ), - 1, wxALIGN_TOP|wxALIGN_RIGHT|wxADJUST_MINSIZE); - s_main->Add(s_header, 0, wxEXPAND, 0); - - /*general section*/ - s_general = new wxBoxSizer(wxVERTICAL); - m_loop = new wxCheckBox(this, 0, wxT("Loop at End"), wxPoint(10, 40), wxSize(140, 20)); - s_general->Add(m_loop); - m_lookforsubs = new wxCheckBox(this, 0, wxT("Look for Subtitles"), wxPoint(180, 40), wxSize(140, 20)); - s_general->Add(m_lookforsubs); - m_noconsole = new wxCheckBox(this, 0, wxT("Disable console messages"), wxPoint(10, 80), wxSize(180, 20)); - s_general->Add(m_noconsole); - m_viewxmt = new wxCheckBox(this, 0, wxT("View graph in XMT-A format"), wxPoint(10, 120), wxSize(180, 20)); - s_general->Add(m_viewxmt); - s_main->Add(s_general, 0, wxEXPAND, 0); - - /*MPEG-4 systems*/ - s_mpeg4 = new wxBoxSizer(wxVERTICAL); - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Prefered Stream Language")), wxALIGN_CENTER | wxADJUST_MINSIZE); - m_lang = new wxComboBox(this, 0, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); - bs->Add(m_lang, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_mpeg4->Add(bs, 0, wxALL|wxEXPAND, 2); - - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Decoder Threading Mode")), wxALIGN_CENTER | wxADJUST_MINSIZE); - m_thread = new wxComboBox(this, 0, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); - bs->Add(m_thread, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_mpeg4->Add(bs, 0, wxALL|wxEXPAND, 2); - m_bifsalwaysdrawn = new wxCheckBox(this, 0, wxT("Always draw late BIFS frames")); - s_mpeg4->Add(m_bifsalwaysdrawn); - m_singletime = new wxCheckBox(this, 0, wxT("Force Single Timeline")); - s_mpeg4->Add(m_singletime); - s_main->Add(s_mpeg4, 0, wxEXPAND, 0); - - /*media decoders*/ - s_mdec = new wxBoxSizer(wxVERTICAL); - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Prefered Audio Output")), wxALIGN_CENTER | wxADJUST_MINSIZE); - m_decaudio = new wxComboBox(this, 0, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); - bs->Add(m_decaudio, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_mdec->Add(bs, 0, wxALL|wxEXPAND, 2); - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Prefered Video Output")), wxALIGN_CENTER | wxADJUST_MINSIZE); - m_decvideo = new wxComboBox(this, 0, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); - bs->Add(m_decvideo, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_mdec->Add(bs, 0, wxALL|wxEXPAND, 2); - s_main->Add(s_mdec, 0, wxEXPAND, 0); - - /*Rendering*/ - s_rend = new wxBoxSizer(wxVERTICAL); - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Target Frame Rate")), wxALIGN_CENTER | wxADJUST_MINSIZE); - m_fps = new wxComboBox(this, 0, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); - bs->Add(m_fps, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_rend->Add(bs, 0, wxALL|wxEXPAND, 2); - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Anti-Aliasing")), wxALIGN_CENTER | wxADJUST_MINSIZE); - m_aa = new wxComboBox(this, 0, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); - bs->Add(m_aa, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_rend->Add(bs, 0, wxALL|wxEXPAND, 2); - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Graphics Driver")), wxALIGN_CENTER | wxADJUST_MINSIZE); - m_graph = new wxComboBox(this, 0, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); - bs->Add(m_graph, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_rend->Add(bs, 0, wxALL|wxEXPAND, 2); - bs = new wxBoxSizer(wxHORIZONTAL); - m_draw_bounds = new wxComboBox(this, 0, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); - bs->Add(new wxStaticText(this, 0, wxT("Bounds")), wxALIGN_CENTER | wxADJUST_MINSIZE | wxALIGN_RIGHT); - bs->Add(m_draw_bounds, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_rend->Add(bs, 0, wxALL|wxEXPAND, 2); - m_fast = new wxCheckBox(this, 0, wxT("Fast Rendering")); - m_force_size = new wxCheckBox(this, 0, wxT("Force Scene Size")); - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(m_fast, wxALIGN_CENTER | wxADJUST_MINSIZE); - bs->Add(m_force_size, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_rend->Add(bs, 0, wxALL|wxEXPAND, 2); - m_use3D = new wxCheckBox(this, 0, wxT("Use 3D Renderer")); - s_rend->Add(m_use3D, 0, wxALL|wxEXPAND, 2); - m_bWas3D = m_use3D->GetValue(); - s_main->Add(s_rend, 0, wxEXPAND, 0); - - /*Render 2D*/ - s_rend2d = new wxBoxSizer(wxVERTICAL); - m_direct = new wxCheckBox(this, 0, wxT("Direct Rendering")); - s_rend2d->Add(m_direct, 0, wxALL|wxEXPAND, 2); - m_scalable = new wxCheckBox(this, 0, wxT("Scalable Zoom")); - s_rend2d->Add(m_scalable, 0, wxALL|wxEXPAND, 2); - bs = new wxBoxSizer(wxHORIZONTAL); - m_noyuv = new wxCheckBox(this, 0, wxT("Disable YUV hardware")); - bs->Add(m_noyuv, wxALIGN_CENTER | wxADJUST_MINSIZE); - m_yuvtxt = new wxStaticText(this, 0, wxT("(No YUV used)"), wxDefaultPosition, wxSize(60, 20), wxALIGN_LEFT); - bs->Add(m_yuvtxt, wxALIGN_CENTER|wxADJUST_MINSIZE); - s_rend2d->Add(bs, 0, wxALL|wxEXPAND, 2); - s_main->Add(s_rend2d, 0, wxEXPAND, 0); - - /*Render 3D*/ - s_rend3d = new wxBoxSizer(wxVERTICAL); - m_raster_outlines = new wxCheckBox(this, 0, wxT("Use OpenGL Raster outlines")); - s_rend3d->Add(m_raster_outlines, 0, wxALL|wxEXPAND, 2); - m_polyaa = new wxCheckBox(this, 0, wxT("Enable polygon anti-aliasing")); - s_rend3d->Add(m_polyaa, 0, wxALL|wxEXPAND, 2); - m_nobackcull = new wxCheckBox(this, 0, wxT("Disable backface culling")); - s_rend3d->Add(m_nobackcull, 0, wxALL|wxEXPAND, 2); - - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Wireframe mode")), wxALIGN_CENTER | wxADJUST_MINSIZE); - m_wire = new wxComboBox(this, 0, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); - bs->Add(m_wire, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_rend3d->Add(bs, 0, wxALL|wxEXPAND, 2); - - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Draw Normals")), wxALIGN_CENTER | wxADJUST_MINSIZE); - m_normals = new wxComboBox(this, 0, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); - bs->Add(m_normals, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_rend3d->Add(bs, 0, wxALL|wxEXPAND, 2); - - m_emulpow2 = new wxCheckBox(this, 0, wxT("Emulate power-of-two textures for video")); - s_rend3d->Add(m_emulpow2, 0, wxALL|wxEXPAND, 2); - m_norectext = new wxCheckBox(this, 0, wxT("Disable rectangular texture extensions")); - s_rend3d->Add(m_norectext, 0, wxALL|wxEXPAND, 2); - m_copypixels = new wxCheckBox(this, 0, wxT("Bitmap node uses direct pixel copy")); - s_rend3d->Add(m_copypixels, 0, wxALL|wxEXPAND, 2); - s_main->Add(s_rend3d, 0, wxEXPAND, 0); - - /*video*/ - s_video = new wxBoxSizer(wxVERTICAL); - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Video Driver")), wxALIGN_CENTER | wxADJUST_MINSIZE | wxALIGN_RIGHT); - m_video = new wxComboBox(this, 0, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); - bs->Add(m_video , wxALIGN_CENTER | wxADJUST_MINSIZE); - s_video->Add(bs, 0, wxALL|wxEXPAND, 2); - m_switchres = new wxCheckBox(this, 0, wxT("Change video resolution in fullscreen")); - s_video->Add(m_switchres, 0, wxALL|wxEXPAND, 2); - m_usehwmem = new wxCheckBox(this, 0, wxT("Use hardware memory in 2D mode")); - s_video->Add(m_usehwmem, 0, wxALL|wxEXPAND, 2); - s_main->Add(s_video, 0, wxEXPAND, 0); - - - /*audio*/ - s_audio = new wxBoxSizer(wxVERTICAL); - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Audio Driver")), wxALIGN_CENTER | wxADJUST_MINSIZE); - m_audio = new wxComboBox(this, ID_AUDIO_DRIVER, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); - bs->Add(m_audio, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_audio->Add(bs, 0, wxALL|wxEXPAND, 2); - m_forcecfg = new wxCheckBox(this, ID_FORCE_AUDIO, wxT("Force Audio Config")); - m_forcecfg->SetValue(1); - s_audio->Add(m_forcecfg, 0, wxALL|wxEXPAND, 2); - - - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Number of buffers")), wxALIGN_CENTER|wxADJUST_MINSIZE); - m_nbbuf = new wxSpinCtrl(this, -1, wxT(""), wxDefaultPosition, wxSize(20, 20), wxSP_WRAP | wxSP_ARROW_KEYS, 1, 30, 15); - m_nbbuf->SetValue(8); - bs->Add(m_nbbuf, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_audio->Add(bs, 0, wxALL|wxEXPAND, 2); - - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Total length in ms")), wxALIGN_CENTER | wxADJUST_MINSIZE); - m_buflen = new wxSpinCtrl(this, -1, wxT(""), wxDefaultPosition, wxSize(20, 20), wxSP_WRAP | wxSP_ARROW_KEYS, 1, 1000); - m_buflen->SetValue(400); - bs->Add(m_buflen, wxALIGN_CENTER | wxADJUST_MINSIZE|wxLEFT,10); - s_audio->Add(bs, 0, wxALL|wxEXPAND, 2); - - m_noresync = new wxCheckBox(this, -1, wxT("Disable Resynchronization")); - s_audio->Add(m_noresync); - m_nomulitch = new wxCheckBox(this, -1, wxT("Disable Multichannel")); - s_audio->Add(m_nomulitch); -#ifdef WIN32 - m_notifs = new wxCheckBox(this, -1, wxT("Disable DirectSound Notifications")); - s_audio->Add(m_notifs); -#endif - s_main->Add(s_audio, 0, wxEXPAND, 0); - - /*font*/ - s_font = new wxBoxSizer(wxVERTICAL); - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Font Engine")), wxALIGN_CENTER | wxADJUST_MINSIZE | wxALIGN_RIGHT); - m_font = new wxComboBox(this, 0, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); - bs->Add(m_font, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_font->Add(bs, 0, wxALL|wxEXPAND, 2); - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("System Font Directory")), wxALIGN_CENTER | wxADJUST_MINSIZE | wxALIGN_RIGHT); - m_fontdir = new wxButton(this, ID_FONT_DIR, wxT("..."), wxDefaultPosition, wxDefaultSize); - bs->Add(m_fontdir, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_font->Add(bs, 0, wxALL|wxEXPAND, 2); - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Text Texturing Mode")), wxALIGN_CENTER | wxADJUST_MINSIZE | wxALIGN_RIGHT); - m_texturemode = new wxComboBox(this, 0, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); - bs->Add(m_texturemode, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_font->Add(bs, 0, wxALL|wxEXPAND, 2); - s_main->Add(s_font, 0, wxEXPAND, 0); - - /*download*/ - s_dnld = new wxBoxSizer(wxVERTICAL); - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Cache Directory")), wxALIGN_CENTER | wxADJUST_MINSIZE | wxALIGN_RIGHT); - m_cachedir = new wxButton(this, ID_CACHE_DIR, wxT("...")); - bs->Add(m_cachedir, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_dnld->Add(bs, 0, wxALL|wxEXPAND, 2); - m_cleancache = new wxCheckBox(this, -1, wxT("Remove temp files on exit")); - s_dnld->Add(m_cleancache); - m_restartcache = new wxCheckBox(this, -1, wxT("Always redownload incomplete cached files")); - s_dnld->Add(m_restartcache); - bs = new wxBoxSizer(wxHORIZONTAL); - m_progressive = new wxCheckBox(this, ID_PROGRESSIVE, wxT("XML progressive load")); - bs->Add(m_progressive, wxALIGN_CENTER | wxADJUST_MINSIZE); - m_sax_duration = new wxTextCtrl(this, 0, wxT(""), wxPoint(10, 120), wxSize(60, 20)); - bs->Add(m_sax_duration, wxALIGN_CENTER | wxADJUST_MINSIZE); - bs->Add(new wxStaticText(this, 0, wxT("max load slice (ms)")), wxADJUST_MINSIZE | wxALIGN_CENTER); - s_dnld->Add(bs, 0, wxALL|wxEXPAND, 2); - bs = new wxBoxSizer(wxHORIZONTAL); - m_use_proxy = new wxCheckBox(this, ID_USE_PROXY, wxT("Use proxy")); - bs->Add(m_use_proxy, wxALIGN_CENTER | wxADJUST_MINSIZE); - m_proxy_name = new wxTextCtrl(this, 0, wxT(""), wxPoint(10, 120), wxSize(60, 20)); - bs->Add(m_proxy_name, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_dnld->Add(bs, 0, wxALL|wxEXPAND, 2); - s_main->Add(s_dnld, 0, wxEXPAND, 0); - - /*streaming*/ - s_stream = new wxBoxSizer(wxVERTICAL); - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Default RTSP port")), wxALIGN_CENTER | wxADJUST_MINSIZE | wxALIGN_RIGHT); - m_port = new wxComboBox(this, ID_RTSP_PORT, wxT(""), wxPoint(160, 40), wxSize(140, 30), 0, NULL, wxCB_READONLY); - bs->Add(m_port, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_stream->Add(bs, 0, wxALL|wxEXPAND, 2); - m_rtsp = new wxCheckBox(this, ID_RTP_OVER_RTSP, wxT("RTP over RTSP"), wxPoint(10, 80), wxSize(140, 20)); - m_reorder = new wxCheckBox(this, -1, wxT("use RTP reordering"), wxPoint(160, 80), wxSize(130, 20)); - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(m_rtsp, wxALIGN_CENTER | wxADJUST_MINSIZE); - bs->Add(m_reorder, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_stream->Add(bs, 0, wxALL|wxEXPAND, 2); - bs = new wxBoxSizer(wxHORIZONTAL); - m_timeout = new wxTextCtrl(this, 0, wxT(""), wxPoint(10, 120), wxSize(60, 20)); - bs->Add(new wxStaticText(this, 0, wxT("Control Timeout (ms): ")), wxALIGN_CENTER | wxADJUST_MINSIZE | wxALIGN_RIGHT); - bs->Add(m_timeout, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_stream->Add(bs, 0, wxALL|wxEXPAND, 2); - bs = new wxBoxSizer(wxHORIZONTAL); - m_buffer = new wxTextCtrl(this, 0, wxT(""), wxPoint(10, 150), wxSize(60, 20)); - bs->Add(new wxStaticText(this, 0, wxT("Media Buffering (ms): ")), wxALIGN_CENTER | wxADJUST_MINSIZE | wxALIGN_RIGHT); - bs->Add(m_buffer, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_stream->Add(bs, 0, wxALL|wxEXPAND, 2); - bs = new wxBoxSizer(wxHORIZONTAL); - m_dorebuffer = new wxCheckBox(this, ID_RTSP_REBUFFER, wxT("Rebuffer if below")); - bs->Add(m_dorebuffer, wxALIGN_CENTER | wxADJUST_MINSIZE); - m_rebuffer = new wxTextCtrl(this, 0, wxT(""), wxPoint(200, 180), wxSize(60, 20)); - bs->Add(m_rebuffer, wxALIGN_CENTER | wxADJUST_MINSIZE); - m_rebuffer->Disable(); - s_stream->Add(bs, 0, wxALL|wxEXPAND, 2); - s_main->Add(s_stream, 0, wxEXPAND, 0); - - /*streaming cache*/ - s_rec = new wxBoxSizer(wxVERTICAL); - bs = new wxBoxSizer(wxHORIZONTAL); - bs->Add(new wxStaticText(this, 0, wxT("Record To: ")), wxALIGN_CENTER | wxADJUST_MINSIZE | wxALIGN_RIGHT); - m_recdir = new wxButton(this, ID_RECORD_DIR, wxT("...")); - bs->Add(m_recdir, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_rec->Add(bs, 0, wxALL|wxEXPAND, 2); - m_overwrite = new wxCheckBox(this, -1, wxT("Overwrite existing files")); - s_rec->Add(m_overwrite); - bs = new wxBoxSizer(wxHORIZONTAL); - m_usename = new wxCheckBox(this, ID_USE_FILENAME, wxT("Use filename")); - m_recfile = new wxTextCtrl(this, 0, wxT("")); - bs->Add(m_usename, wxALIGN_CENTER | wxADJUST_MINSIZE); - bs->Add(m_recfile, wxALIGN_CENTER | wxADJUST_MINSIZE); - s_rec->Add(bs, 0, wxALL|wxEXPAND, 2); - s_main->Add(s_rec, 0, wxEXPAND, 0); - - /*load options*/ - GF_Config *cfg = m_pApp->m_user.config; - /*general*/ - sOpt = gf_cfg_get_key(cfg, "General", "Loop"); - m_loop->SetValue((sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "General", "LookForSubtitles"); - m_lookforsubs->SetValue((sOpt && !stricmp(sOpt, "no")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "General", "ConsoleOff"); - m_noconsole->SetValue((sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "General", "ViewXMT"); - m_viewxmt->SetValue((sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - - /*systems config*/ - sOpt = gf_cfg_get_key(cfg, "Systems", "Language3CC"); - if (!sOpt) sOpt = "eng"; - u32 select = 0; - i=0; - while (GF_ISO639_Lang[i]) { - /*only use common languages (having both 2- and 3-char code names)*/ - if (GF_ISO639_Lang[i+2][0]) { - m_lang->Append(wxString(GF_ISO639_Lang[i], wxConvUTF8) ); - if (sOpt && !stricmp(sOpt, GF_ISO639_Lang[i+1])) select = m_lang->GetCount() - 1; - } - i+=3; - } - m_lang->SetSelection(select); - sOpt = gf_cfg_get_key(cfg, "Systems", "ThreadingPolicy"); - select = 0; - m_thread->Append(wxT("Single Thread")); - m_thread->Append(wxT("Mutli Thread")); - if (sOpt && !stricmp(sOpt, "Multi")) select = 1; - m_thread->Append(wxT("Free")); - if (sOpt && !stricmp(sOpt, "Free")) select = 2; - m_thread->SetSelection(select); - sOpt = gf_cfg_get_key(cfg, "Systems", "ForceSingleClock"); - m_singletime->SetValue((sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "Systems", "AlwaysDrawBIFS"); - m_bifsalwaysdrawn->SetValue((sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - - - /*audio dec enum*/ - sOpt = gf_cfg_get_key(cfg, "Systems", "DefAudioDec"); - u32 count = gf_modules_get_count(m_pApp->m_user.modules); - GF_BaseDecoder *ifc_d; - select = 0; - s32 to_sel = 0; - for (i=0; im_user.modules, i, GF_MEDIA_DECODER_INTERFACE); - if (!ifc_d) continue; - if (ifc_d->CanHandleStream(ifc_d, GF_STREAM_AUDIO, NULL, 0)) { - if (sOpt && !stricmp(ifc_d->module_name, sOpt)) select = to_sel; - m_decaudio->Append(wxString(ifc_d->module_name, wxConvUTF8) ); - to_sel++; - } - gf_modules_close_interface((GF_BaseInterface *) ifc_d); - } - m_decaudio->SetSelection(select); - - /*video dec enum*/ - sOpt = gf_cfg_get_key(cfg, "Systems", "DefVideoDec"); - select = to_sel = 0; - for (i=0; im_user.modules, i, GF_MEDIA_DECODER_INTERFACE); - if (!ifc_d) continue; - if (ifc_d->CanHandleStream(ifc_d, GF_STREAM_VISUAL, NULL, 0)) { - if (sOpt && !stricmp(ifc_d->module_name, sOpt)) select = to_sel; - m_decvideo->Append(wxString(ifc_d->module_name, wxConvUTF8) ); - to_sel++; - } - gf_modules_close_interface((GF_BaseInterface *) ifc_d); - } - m_decvideo->SetSelection(select); - - /*rendering FIXME*/ - m_bWas3D = 0; - m_use3D->SetValue(m_bWas3D ? 1 : 0); - - sOpt = gf_cfg_get_key(cfg, "Compositor", "ForceSceneSize"); - m_force_size->SetValue( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - - sOpt = gf_cfg_get_key(cfg, "Compositor", "FrameRate"); - if (!sOpt) sOpt = "30.0"; - select = 0; - for (i = 0; iAppend(wxString(BIFSRates[i], wxConvUTF8) ); - if (sOpt && !stricmp(sOpt, BIFSRates[i]) ) select = i; - } - m_fps->SetSelection(select); - - sOpt = gf_cfg_get_key(cfg, "Compositor", "HighSpeed"); - m_fast->SetValue( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - - sOpt = gf_cfg_get_key(cfg, "Compositor", "AntiAlias"); - m_aa->Append(wxT("None")); - m_aa->Append(wxT("Text only")); - m_aa->Append(wxT("Complete")); - select = 2; - if (sOpt && !stricmp(sOpt, "Text")) select = 1; - else if (sOpt && !stricmp(sOpt, "None")) select = 0; - m_aa->SetSelection(select); - - sOpt = gf_cfg_get_key(cfg, "Compositor", "BoundingVolume"); - m_draw_bounds->Append(wxT("None")); - m_draw_bounds->Append(wxT("Box/Rect")); - m_draw_bounds->Append(wxT("AABB Tree")); - select = 0; - if (sOpt && !stricmp(sOpt, "Box")) select = 1; - else if (sOpt && !stricmp(sOpt, "AABB")) select = 2; - m_draw_bounds->SetSelection(select); - - /*render2d*/ - sOpt = gf_cfg_get_key(cfg, "Compositor", "DirectDraw"); - m_direct->SetValue( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "Compositor", "ScalableZoom"); - m_scalable->SetValue( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "Compositor", "DisableYUV"); - m_noyuv->SetValue( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - SetYUVLabel(); - - /*graphics driver enum*/ - sOpt = gf_cfg_get_key(cfg, "Compositor", "Raster2D"); - GF_BaseInterface *ifce; - select = to_sel = 0; - for (i=0; im_user.modules, i, GF_RASTER_2D_INTERFACE); - if (!ifce) continue; - if (sOpt && !stricmp(((GF_BaseInterface *)ifce)->module_name, sOpt)) select = to_sel; - m_graph->Append(wxString(((GF_BaseInterface *)ifce)->module_name, wxConvUTF8) ); - gf_modules_close_interface(ifce); - to_sel++; - } - m_graph->SetSelection(select); - - /*render3d*/ - sOpt = gf_cfg_get_key(cfg, "Compositor", "RasterOutlines"); - m_raster_outlines->SetValue( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "Compositor", "EmulatePOW2"); - m_emulpow2->SetValue((sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "Compositor", "PolygonAA"); - m_polyaa->SetValue((sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "Compositor", "BackFaceCulling"); - m_nobackcull->SetValue((sOpt && !stricmp(sOpt, "Off")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "Compositor", "Wireframe"); - sOpt = gf_cfg_get_key(cfg, "Compositor", "BitmapCopyPixels"); - m_copypixels->SetValue((sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "Compositor", "DisableRectExt"); - m_norectext->SetValue((sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - m_wire->Append(wxT("No Wireframe")); - m_wire->Append(wxT("Wireframe Only")); - m_wire->Append(wxT("Solid and Wireframe")); - sOpt = gf_cfg_get_key(cfg, "Compositor", "Wireframe"); - if (sOpt && !stricmp(sOpt, "WireOnly")) m_wire->SetSelection(1); - else if (sOpt && !stricmp(sOpt, "WireOnSolid")) m_wire->SetSelection(2); - else m_wire->SetSelection(0); - m_normals->Append(wxT("Never")); - m_normals->Append(wxT("Per Face")); - m_normals->Append(wxT("Per Vertex")); - sOpt = gf_cfg_get_key(cfg, "Compositor", "DrawNormals"); - if (sOpt && !stricmp(sOpt, "PerFace")) m_normals->SetSelection(1); - else if (sOpt && !stricmp(sOpt, "PerVertex")) m_normals->SetSelection(2); - else m_normals->SetSelection(0); - - /*video*/ - sOpt = gf_cfg_get_key(cfg, "Video", "SwitchResolution"); - m_switchres->SetValue( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "Video", "UseHardwareMemory"); - m_usehwmem->SetValue( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "Video", "DriverName"); - select = to_sel = 0; - for (i=0; im_user.modules, i, GF_VIDEO_OUTPUT_INTERFACE); - if (!ifce) continue; - if (sOpt && !stricmp(((GF_BaseInterface *)ifce)->module_name, sOpt)) select = to_sel; - m_video->Append(wxString(((GF_BaseInterface *)ifce)->module_name, wxConvUTF8) ); - gf_modules_close_interface(ifce); - to_sel++; - } - m_video->SetSelection(select); - - /*audio*/ - sOpt = gf_cfg_get_key(cfg, "Audio", "ForceConfig"); - m_forcecfg->SetValue( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "Audio", "NumBuffers"); - m_nbbuf->SetValue( sOpt ? wxString(sOpt, wxConvUTF8) : wxT("2")); - sOpt = gf_cfg_get_key(cfg, "Audio", "TotalDuration"); - m_buflen->SetValue( sOpt ? wxString(sOpt, wxConvUTF8) : wxT("120")); - wxCommandEvent event; - ForceAudio(event); - sOpt = gf_cfg_get_key(cfg, "Audio", "NoResync"); - m_noresync->SetValue( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "Audio", "DisableMultiChannel"); - m_nomulitch->SetValue( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - - /*driver enum*/ - sOpt = gf_cfg_get_key(cfg, "Audio", "DriverName"); - select = to_sel = 0; - for (i=0; im_user.modules, i, GF_AUDIO_OUTPUT_INTERFACE); - if (!ifce) continue; - if (sOpt && !stricmp(((GF_BaseInterface *)ifce)->module_name, sOpt)) select = to_sel; - m_audio->Append(wxString(((GF_BaseInterface *)ifce)->module_name, wxConvUTF8) ); - gf_modules_close_interface(ifce); - to_sel++; - } - m_audio->SetSelection(select); -#ifdef WIN32 - sOpt = gf_cfg_get_key(cfg, "Audio", "DisableNotification"); - m_notifs->SetValue( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - wxCommandEvent audevt; - OnSetAudioDriver(audevt); -#endif - - /*font*/ - sOpt = gf_cfg_get_key(cfg, "FontEngine", "FontReader"); - to_sel = select = 0; - for (i=0; im_user.modules, i, GF_FONT_READER_INTERFACE); - if (!ifce) continue; - if (sOpt && !stricmp(((GF_BaseInterface *)ifce)->module_name, sOpt)) select = to_sel; - m_font->Append(wxString(((GF_BaseInterface *)ifce)->module_name, wxConvUTF8) ); - gf_modules_close_interface(ifce); - to_sel++; - } - m_font->SetSelection(select); - sOpt = gf_cfg_get_key(cfg, "FontEngine", "FontDirectory"); - if (sOpt) m_fontdir->SetLabel(wxString(sOpt, wxConvUTF8) ); - sOpt = gf_cfg_get_key(cfg, "Compositor", "TextureTextMode"); - m_texturemode->Append(wxT("Default")); - m_texturemode->Append(wxT("Never")); - m_texturemode->Append(wxT("Always")); - if (sOpt && !stricmp(sOpt, "Always")) m_texturemode->SetSelection(2); - else if (sOpt && !stricmp(sOpt, "3D")) m_texturemode->SetSelection(1); - else m_texturemode->SetSelection(0); - - /*downloader*/ - sOpt = gf_cfg_get_key(cfg, "General", "CacheDirectory"); - if (sOpt) m_cachedir->SetLabel(wxString(sOpt, wxConvUTF8) ); - sOpt = gf_cfg_get_key(cfg, "Downloader", "CleanCache"); - m_cleancache->SetValue( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "Downloader", "RestartFiles"); - m_restartcache->SetValue( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "SAXLoader", "Progressive"); - m_progressive->SetValue( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - sOpt = gf_cfg_get_key(cfg, "SAXLoader", "MaxDuration"); - m_sax_duration->SetValue(sOpt ? wxString(sOpt, wxConvUTF8) : wxT("30")); - if (! m_progressive->GetValue()) m_sax_duration->Enable(0); - - sOpt = gf_cfg_get_key(cfg, "HTTPProxy", "Enabled"); - m_use_proxy->SetValue( (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0); - char szProxy[GF_MAX_PATH]; - strcpy(szProxy, ""); - sOpt = gf_cfg_get_key(cfg, "HTTPProxy", "Name"); - if (sOpt) { - strcat(szProxy, sOpt); - sOpt = gf_cfg_get_key(cfg, "HTTPProxy", "Port"); - if (sOpt) { - strcat(szProxy, ":"); - strcat(szProxy, sOpt); - } - } else { - m_use_proxy->SetValue(0); - } - m_proxy_name->SetValue( wxString((char *)szProxy, wxConvUTF8) ); - if (! m_use_proxy->GetValue()) m_proxy_name->Enable(0); - - /*streaming*/ - m_port->Append(wxT("554 (RTSP standard)")); - m_port->Append(wxT("7070 (RTSP ext)")); - m_port->Append(wxT("80 (RTSP / HTTP tunnel)")); - m_port->Append(wxT("8080 (RTSP / HTTP tunnel)")); - sOpt = gf_cfg_get_key(cfg, "Streaming", "DefaultPort"); - u32 port = 554; - Bool force_rtsp = 0; - if (sOpt) port = atoi(sOpt); - switch (port) { - case 8080: - m_port->SetSelection(3); - force_rtsp = 1; - break; - case 80: - m_port->SetSelection(2); - force_rtsp = 1; - break; - case 7070: - m_port->SetSelection(1); - break; - default: - m_port->SetSelection(0); - break; - } - - Bool use_rtsp = 0; - sOpt = gf_cfg_get_key(cfg, "Streaming", "RTPoverRTSP"); - if (sOpt && !stricmp(sOpt, "yes")) use_rtsp = 1; - - if (force_rtsp) { - m_rtsp->SetValue(1); - m_rtsp->Enable(0); - m_reorder->SetValue(0); - m_reorder->Enable(0); - } else { - m_rtsp->SetValue(use_rtsp ? 1 : 0); - m_rtsp->Enable(1); - m_reorder->Enable(1); - sOpt = gf_cfg_get_key(cfg, "Streaming", "ReorderSize"); - m_reorder->SetValue( (sOpt && !stricmp(sOpt, "0")) ? 1 : 0); - } - sOpt = gf_cfg_get_key(cfg, "Streaming", "RTSPTimeout"); - m_timeout->SetValue(sOpt ? wxString(sOpt, wxConvUTF8) : wxT("30000")); - sOpt = gf_cfg_get_key(cfg, "Network", "BufferLength"); - m_buffer->SetValue(sOpt ? wxString(sOpt, wxConvUTF8) : wxT("3000")); - sOpt = gf_cfg_get_key(cfg, "Network", "RebufferLength"); - u32 buf_len = 0; - if (sOpt) buf_len = atoi(sOpt); - if (buf_len) { - m_dorebuffer->SetValue(1); - m_rebuffer->SetValue(wxString(sOpt, wxConvUTF8)); - m_rebuffer->Enable(1); - } else { - m_dorebuffer->SetValue(0); - m_rebuffer->SetValue(wxT("0")); - m_rebuffer->Enable(0); - } - - RTPoverRTSP(event); - - sOpt = gf_cfg_get_key(cfg, "StreamingCache", "RecordDirectory"); - if (!sOpt) sOpt = gf_cfg_get_key(cfg, "General", "CacheDirectory"); - if (sOpt) m_recdir->SetLabel(wxString(sOpt, wxConvUTF8)); - sOpt = gf_cfg_get_key(cfg, "StreamingCache", "KeepExistingFiles"); - m_overwrite->SetValue((sOpt && !stricmp(sOpt, "yes")) ? 0 : 1); - - sOpt = gf_cfg_get_key(cfg, "StreamingCache", "BaseFileName"); - if (sOpt) { - m_usename->SetValue(1); - m_recfile->Enable(1); - m_recfile->SetValue(wxString(sOpt, wxConvUTF8)); - } else { - m_usename->SetValue(0); - m_recfile->Enable(0); - m_recfile->SetValue(wxT("uses service URL")); - } - - m_select->Append(wxT("General")); - m_select->Append(wxT("MPEG-4 Systems")); - m_select->Append(wxT("Media Decoders")); - m_select->Append(wxT("Compositor")); - m_select->Append(wxT("Renderer 2D")); - m_select->Append(wxT("Renderer 3D")); - m_select->Append(wxT("Video Output")); - m_select->Append(wxT("Audio Output")); - m_select->Append(wxT("Text Engine")); - m_select->Append(wxT("File Download")); - m_select->Append(wxT("Real-Time Streaming")); - m_select->Append(wxT("Streaming Cache")); - - sOpt = gf_cfg_get_key(cfg, "General", "ConfigPanel"); - m_sel = sOpt ? atoi(sOpt) : 0; - if (m_sel>11) m_sel=11; - m_select->SetSelection(m_sel); - - DoSelect(); -} - -BEGIN_EVENT_TABLE(wxGPACControl, wxDialog) - EVT_BUTTON(ID_APPLY, wxGPACControl::Apply) - EVT_COMBOBOX(ID_SELECT, wxGPACControl::OnSetSelection) - EVT_CHECKBOX(ID_FORCE_AUDIO, wxGPACControl::ForceAudio) - EVT_COMBOBOX(ID_AUDIO_DRIVER, wxGPACControl::OnSetAudioDriver) - EVT_BUTTON(ID_FONT_DIR, wxGPACControl::FontDir) - EVT_BUTTON(ID_CACHE_DIR, wxGPACControl::CacheDir) - EVT_CHECKBOX(ID_PROGRESSIVE, wxGPACControl::OnProgressive) - EVT_CHECKBOX(ID_USE_PROXY, wxGPACControl::OnUseProxy) - EVT_CHECKBOX(ID_RTP_OVER_RTSP, wxGPACControl::RTPoverRTSP) - EVT_CHECKBOX(ID_RTSP_REBUFFER, wxGPACControl::Rebuffer) - EVT_COMBOBOX(ID_RTSP_PORT, wxGPACControl::OnSetRTSPPort) - EVT_CHECKBOX(ID_USE_FILENAME, wxGPACControl::OnUseFileName) - EVT_BUTTON(ID_RECORD_DIR, wxGPACControl::OnRecDir) -END_EVENT_TABLE() - - -wxGPACControl::~wxGPACControl() -{ - char str[20]; - sprintf(str, "%d", m_sel); - gf_cfg_set_key(m_pApp->m_user.config, "General", "ConfigPanel", str); -} - - -void wxGPACControl::DoSelect() -{ - - /*hide everything*/ - s_main->Show(s_general, false); - s_main->Show(s_mpeg4, false); - s_main->Show(s_mdec, false); - s_main->Show(s_rend, false); - s_main->Show(s_rend2d, false); - s_main->Show(s_rend3d, false); - s_main->Show(s_video, false); - s_main->Show(s_audio, false); - s_main->Show(s_font, false); - s_main->Show(s_dnld, false); - s_main->Show(s_stream, false); - s_main->Show(s_rec, false); - switch (m_sel) { - case 0: s_main->Show(s_general, true); break; - case 1: s_main->Show(s_mpeg4, true); break; - case 2: s_main->Show(s_mdec, true); break; - case 3: s_main->Show(s_rend, true); break; - case 4: s_main->Show(s_rend2d, true); break; - case 5: s_main->Show(s_rend3d, true); break; - case 6: s_main->Show(s_video, true); break; - case 7: s_main->Show(s_audio, true); break; - case 8: s_main->Show(s_font, true); break; - case 9: s_main->Show(s_dnld, true); break; - case 10: s_main->Show(s_stream, true); break; - case 11: s_main->Show(s_rec, true); break; - } - SetSizer(s_main); - s_main->Fit(this); - //s_main->Layout(); - return; - -} - -void wxGPACControl::OnSetSelection(wxCommandEvent &WXUNUSED(event)) -{ - m_sel = m_select->GetSelection(); - DoSelect(); -} - -void wxGPACControl::FontDir(wxCommandEvent &WXUNUSED(event)) -{ - wxDirDialog dlg(this); - dlg.SetPath(m_fontdir->GetLabel()); - if (dlg.ShowModal() == wxID_OK) { - m_fontdir->SetLabel(dlg.GetPath()); - } -} -void wxGPACControl::CacheDir(wxCommandEvent &WXUNUSED(event)) -{ - wxDirDialog dlg(this); - dlg.SetPath(m_cachedir->GetLabel()); - if (dlg.ShowModal() == wxID_OK) { - m_cachedir->SetLabel(dlg.GetPath()); - } -} - -void wxGPACControl::OnProgressive(wxCommandEvent &WXUNUSED(event)) -{ - m_sax_duration->Enable(m_progressive->GetValue() ? 1 : 0); -} - -void wxGPACControl::OnUseProxy(wxCommandEvent &WXUNUSED(event)) -{ - m_proxy_name->Enable(m_use_proxy->GetValue() ? 1 : 0); -} - -void wxGPACControl::RTPoverRTSP(wxCommandEvent &WXUNUSED(event)) -{ - m_reorder->Enable(m_rtsp->GetValue() ? 0 : 1); -} - -void wxGPACControl::Rebuffer(wxCommandEvent &WXUNUSED(event)) -{ - if (m_dorebuffer->GetValue()) { - m_rebuffer->Enable(); - } else { - m_rebuffer->Disable(); - } -} - -void wxGPACControl::OnSetRTSPPort(wxCommandEvent &WXUNUSED(event)) -{ - if (m_port->GetSelection() > 1) { - m_rtsp->Enable(0); - m_reorder->Enable(0); - } else { - m_rtsp->Enable(1); - m_reorder->Enable(1); - } -} - -void wxGPACControl::OnRecDir(wxCommandEvent &WXUNUSED(event)) -{ - wxDirDialog dlg(this); - dlg.SetPath(m_recdir->GetLabel()); - if (dlg.ShowModal() == wxID_OK) { - m_recdir->SetLabel(dlg.GetPath()); - } -} - -void wxGPACControl::OnUseFileName(wxCommandEvent &WXUNUSED(event)) -{ - if (m_usename->GetValue()) { - m_recfile->Enable(); - m_recfile->SetValue(wxT("record")); - } else { - m_recfile->Disable(); - m_recfile->SetValue(wxT("uses service URL")); - } -} - -void wxGPACControl::ForceAudio(wxCommandEvent &WXUNUSED(event)) -{ - if (m_forcecfg->GetValue()) { - m_nbbuf->Enable(); - m_buflen->Enable(); - } else { - m_nbbuf->Disable(); - m_buflen->Disable(); - } -} - -void wxGPACControl::OnSetAudioDriver(wxCommandEvent &WXUNUSED(event)) -{ -#ifdef WIN32 - if (strstr(m_audio->GetStringSelection().mb_str(wxConvUTF8), "DirectSound")) { - m_notifs->Enable(1); - } else { - m_notifs->Enable(0); - } -#endif -} - - - -void wxGPACControl::Apply(wxCommandEvent &WXUNUSED(event)) -{ - /*save options*/ - GF_Config *cfg = m_pApp->m_user.config; - - m_pApp->m_loop = m_loop->GetValue() ? 1 : 0; - gf_cfg_set_key(cfg, "General", "Loop", m_loop->GetValue() ? "yes" : "no"); - m_pApp->m_lookforsubs = m_lookforsubs->GetValue() ? 1 : 0; - gf_cfg_set_key(cfg, "General", "LookForSubtitles", m_lookforsubs->GetValue() ? "yes" : "no"); - m_pApp->m_console_off = m_noconsole->GetValue() ? 1 : 0; - gf_cfg_set_key(cfg, "General", "ConsoleOff", m_noconsole->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "General", "ViewXMT", m_viewxmt->GetValue() ? "yes" : "no"); - - s32 sel = m_lang->GetSelection(); - u32 i=0; - while (GF_ISO639_Lang[i]) { - /*only use common languages (having both 2- and 3-char code names)*/ - if (GF_ISO639_Lang[i+2][0]) { - if (!sel) break; - sel--; - } - i+=3; - } - gf_cfg_set_key(cfg, "Systems", "LanguageName", GF_ISO639_Lang[i]); - gf_cfg_set_key(cfg, "Systems", "Language3CC", GF_ISO639_Lang[i+1]); - gf_cfg_set_key(cfg, "Systems", "Language2CC", GF_ISO639_Lang[i+2]); - - - sel = m_thread->GetSelection(); - gf_cfg_set_key(cfg, "Systems", "ThreadingPolicy", (sel==0) ? "Single" : ( (sel==1) ? "Multi" : "Free")); - gf_cfg_set_key(cfg, "Systems", "ForceSingleClock", m_singletime->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "Systems", "AlwaysDrawBIFS", m_bifsalwaysdrawn->GetValue() ? "yes" : "no"); - - gf_cfg_set_key(cfg, "Systems", "DefAudioDec", m_decaudio->GetStringSelection().mb_str(wxConvUTF8)); - gf_cfg_set_key(cfg, "Systems", "DefVideoDec", m_decvideo->GetStringSelection().mb_str(wxConvUTF8)); - - - gf_cfg_set_key(cfg, "Compositor", "HighSpeed", m_fast->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "Compositor", "ForceSceneSize", m_force_size->GetValue() ? "yes" : "no"); - - gf_cfg_set_key(cfg, "Compositor", "FrameRate", BIFSRates[m_fps->GetSelection()]); - sel = m_aa->GetSelection(); - gf_cfg_set_key(cfg, "Compositor", "AntiAlias", (sel==0) ? "None" : ( (sel==1) ? "Text" : "All")); - sel = m_draw_bounds->GetSelection(); - gf_cfg_set_key(cfg, "Compositor", "BoundingVolume", (sel==2) ? "AABB" : (sel==1) ? "Box" : "None"); - - Bool is_3D = m_use3D->GetValue() ? 1 : 0; - if (m_bWas3D != is_3D) { - /*FIXME*/ - } - gf_cfg_set_key(cfg, "Compositor", "Raster2D", m_graph->GetStringSelection().mb_str(wxConvUTF8)); - - gf_cfg_set_key(cfg, "Compositor", "DirectDraw", m_direct->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "Compositor", "ScalableZoom", m_scalable->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "Compositor", "DisableYUV", m_noyuv->GetValue() ? "yes" : "no"); - - gf_cfg_set_key(cfg, "Compositor", "RasterOutlines", m_raster_outlines->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "Compositor", "EmulatePOW2", m_emulpow2->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "Compositor", "PolygonAA", m_polyaa->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "Compositor", "DisableRectExt", m_norectext->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "Compositor", "BitmapCopyPixels", m_copypixels->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "Compositor", "BackFaceCulling", m_nobackcull->GetValue() ? "Off" : "On"); - - sel = m_wire->GetSelection(); - gf_cfg_set_key(cfg, "Compositor", "Wireframe", (sel==2) ? "WireOnSolid" : ( (sel==1) ? "WireOnly" : "WireNone" ) ); - sel = m_normals->GetSelection(); - gf_cfg_set_key(cfg, "Compositor", "DrawNormals", (sel==2) ? "PerVertex" : ( (sel==1) ? "PerFace" : "Never" ) ); - - gf_cfg_set_key(cfg, "Video", "SwitchResolution", m_switchres->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "Video", "UseHardwareMemory", m_usehwmem->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "Video", "DriverName", m_video->GetStringSelection().mb_str(wxConvUTF8)); - - - gf_cfg_set_key(cfg, "Audio", "ForceConfig", m_forcecfg->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "Audio", "NoResync", m_noresync->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "Audio", "DisableMultiChannel", m_nomulitch->GetValue() ? "yes" : "no"); - - gf_cfg_set_key(cfg, "Audio", "NumBuffers", wxString::Format(wxT("%d"), m_nbbuf->GetValue()).mb_str(wxConvUTF8) ); - gf_cfg_set_key(cfg, "Audio", "TotalDuration", wxString::Format(wxT("%d"), m_buflen->GetValue()).mb_str(wxConvUTF8) ); - gf_cfg_set_key(cfg, "Audio", "DriverName", m_audio->GetStringSelection().mb_str(wxConvUTF8)); -#ifdef WIN32 - if (m_notifs->IsEnabled()) - gf_cfg_set_key(cfg, "Audio", "DisableNotification", m_notifs->GetValue() ? "yes" : "no"); -#endif - - gf_cfg_set_key(cfg, "FontEngine", "FontReader", m_font->GetStringSelection().mb_str(wxConvUTF8)); - gf_cfg_set_key(cfg, "FontEngine", "FontDirectory", m_fontdir->GetLabel().mb_str(wxConvUTF8)); - switch (m_texturemode->GetSelection()) { - case 2: gf_cfg_set_key(cfg, "Compositor", "TextureTextMode", "Always"); break; - case 1: gf_cfg_set_key(cfg, "Compositor", "TextureTextMode", "Never"); break; - default: gf_cfg_set_key(cfg, "Compositor", "TextureTextMode", "Default"); break; - } - - gf_cfg_set_key(cfg, "Downloader", "CleanCache", m_cleancache->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "Downloader", "RestartFiles", m_restartcache->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "SAXLoader", "Progressive", m_progressive->GetValue() ? "yes" : "no"); - gf_cfg_set_key(cfg, "SAXLoader", "MaxDuration", m_sax_duration->GetLabel().mb_str(wxConvUTF8)); - gf_cfg_set_key(cfg, "General", "CacheDirectory", m_cachedir->GetLabel().mb_str(wxConvUTF8)); - - - Bool force_rtsp = 0; - switch (m_port->GetSelection()) { - case 3: - gf_cfg_set_key(cfg, "Streaming", "DefaultPort", "8080"); - force_rtsp = 1; - break; - case 2: - gf_cfg_set_key(cfg, "Streaming", "DefaultPort", "80"); - force_rtsp = 1; - break; - case 1: - gf_cfg_set_key(cfg, "Streaming", "DefaultPort", "7070"); - break; - default: - gf_cfg_set_key(cfg, "Streaming", "DefaultPort", "554"); - break; - } - - if (force_rtsp) { - gf_cfg_set_key(cfg, "Streaming", "RTPoverRTSP", "yes"); - } else { - gf_cfg_set_key(cfg, "Streaming", "RTPoverRTSP", m_rtsp->GetValue() ? "yes" : "no"); - if (!m_rtsp->GetValue()) gf_cfg_set_key(cfg, "Streaming", "ReorderSize", m_dorebuffer->GetValue() ? "30" : "0"); - } - - gf_cfg_set_key(cfg, "Streaming", "RTSPTimeout", m_timeout->GetValue().mb_str(wxConvUTF8)); - gf_cfg_set_key(cfg, "Network", "BufferLength", m_buffer->GetValue().mb_str(wxConvUTF8)); - if (m_dorebuffer->GetValue()) { - gf_cfg_set_key(cfg, "Network", "RebufferLength", m_rebuffer->GetValue().mb_str(wxConvUTF8)); - } else { - gf_cfg_set_key(cfg, "Network", "RebufferLength", "0"); - } - - gf_cfg_set_key(cfg, "StreamingCache", "KeepExistingFiles", m_overwrite->GetValue() ? "no" : "yes"); - if (m_usename->GetValue()) { - gf_cfg_set_key(cfg, "StreamingCache", "BaseFileName", m_recfile->GetValue().mb_str(wxConvUTF8)); - } else { - gf_cfg_set_key(cfg, "StreamingCache", "BaseFileName", NULL); - } - gf_cfg_set_key(cfg, "StreamingCache", "RecordDirectory", m_recdir->GetLabel().mb_str(wxConvUTF8)); - - - gf_term_set_option(m_pApp->m_term, GF_OPT_RELOAD_CONFIG, 1); -} - diff --git a/applications/osmo4_wx/wxGPACControl.h b/applications/osmo4_wx/wxGPACControl.h deleted file mode 100644 index 043d902..0000000 --- a/applications/osmo4_wx/wxGPACControl.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * GPAC - Multimedia Framework C SDK - * - * Copyright (c) Jean Le Feuvre 2000-2005 - * All rights reserved - * - * This file is part of GPAC / Osmo4 wxWidgets GUI - * - * GPAC is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * GPAC is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - */ - -#ifndef _OPTIONS_H -#define _OPTIONS_H - -#include "wx/wxprec.h" - -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include -#include - -enum -{ - ID_SELECT = 1000, - ID_APPLY, - - ID_MAKE_DEF, - ID_FORCE_AUDIO, - ID_AUDIO_DRIVER, - ID_FONT_DIR, - ID_CACHE_DIR, - ID_PROGRESSIVE, - ID_RTSP_PORT, - ID_RTP_OVER_RTSP, - ID_RTSP_REBUFFER, - ID_RECORD_DIR, - ID_USE_FILENAME, - ID_USE_PROXY, -}; - -class wxOsmo4Frame; -class wxGPACControl : public wxDialog -{ -public: - wxGPACControl(wxWindow *parent); - virtual ~wxGPACControl(); - -private: - DECLARE_EVENT_TABLE() - - wxOsmo4Frame *m_pApp; - - wxComboBox *m_select; - Bool m_bWas3D; - - void Apply(wxCommandEvent &event); - void OnSetSelection(wxCommandEvent &event); - void ForceAudio(wxCommandEvent &event); - void OnSetAudioDriver(wxCommandEvent &event); - void FontDir(wxCommandEvent &event); - void CacheDir(wxCommandEvent &event); - void OnProgressive(wxCommandEvent &event); - void OnUseProxy(wxCommandEvent &event); - void RTPoverRTSP(wxCommandEvent &event); - void Rebuffer(wxCommandEvent &event); - void OnSetRTSPPort(wxCommandEvent &event); - void OnUseFileName(wxCommandEvent &event); - void OnRecDir(wxCommandEvent &event); - void DoSelect(); - s32 m_sel; - void SetYUVLabel(); - - wxBoxSizer *s_header, *s_main, *s_general, *s_mpeg4, *s_mdec, *s_rend, *s_rend2d, *s_rend3d, *s_audio, *s_video, *s_font, *s_dnld, *s_stream, *s_rec; - - /*general section*/ - wxCheckBox *m_loop, *m_lookforsubs, *m_noconsole, *m_viewxmt; - /*MPEG-4 systems*/ - wxCheckBox *m_bifsalwaysdrawn, *m_singletime; - wxComboBox *m_lang, *m_thread; - /*media decoders*/ - wxComboBox *m_decaudio, *m_decvideo; - /*Rendering*/ - wxComboBox *m_fps, *m_aa, *m_draw_bounds; - wxCheckBox *m_use3D, *m_fast, *m_force_size; - /*Renderer 2D*/ - wxComboBox *m_graph; - wxCheckBox *m_noyuv, *m_direct, *m_scalable; - wxStaticText *m_yuvtxt; - /*Renderer 3D*/ - wxCheckBox *m_raster_outlines, *m_polyaa, *m_nobackcull, *m_emulpow2, *m_norectext, *m_copypixels; - wxComboBox *m_wire, *m_normals; - /*video*/ - wxComboBox *m_video; - wxCheckBox *m_switchres, *m_usehwmem; - /*audio*/ - wxSpinCtrl *m_nbbuf, *m_buflen; - wxComboBox *m_audio; - wxCheckBox *m_forcecfg, *m_noresync, *m_nomulitch; -#ifdef WIN32 - wxCheckBox *m_notifs; -#endif - /*font*/ - wxComboBox *m_font; - wxButton *m_fontdir; - wxComboBox *m_texturemode; - /*file download*/ - wxButton *m_cachedir; - wxCheckBox *m_cleancache, *m_restartcache, *m_progressive, *m_use_proxy; - wxTextCtrl *m_sax_duration, *m_proxy_name; - /*streaming*/ - wxComboBox *m_port; - wxCheckBox *m_rtsp, *m_reorder, *m_dorebuffer; - wxTextCtrl *m_timeout, *m_buffer, *m_rebuffer; - /*file recorder*/ - wxButton *m_recdir; - wxCheckBox *m_overwrite, *m_usename; - wxTextCtrl *m_recfile; -}; - -#endif - diff --git a/applications/osmo4_wx/wxOsmo4.cpp b/applications/osmo4_wx/wxOsmo4.cpp deleted file mode 100644 index b25b199..0000000 --- a/applications/osmo4_wx/wxOsmo4.cpp +++ /dev/null @@ -1,2347 +0,0 @@ -/* - * GPAC - Multimedia Framework C SDK - * - * Copyright (c) Jean Le Feuvre 2000-2005 - * All rights reserved - * - * This file is part of GPAC / Osmo4 wxWidgets GUI - * - * GPAC is gf_free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * GPAC is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - */ - - -#include "wxOsmo4.h" -#include "wxGPACControl.h" -#include "fileprops.h" -#include -#include -#include -#include -#include - - -IMPLEMENT_APP(wxOsmo4App) - -#include "osmo4.xpm" - -#include - - - - - -#include -#include - -#include "toolbar.xpm" - -#include "Playlist.h" - -#ifdef WIN32 -#define FRAME_H 140 -#else -#define FRAME_H 110 -#endif - - -wxString get_pref_browser(GF_Config *cfg) -{ - const char *sOpt = gf_cfg_get_key(cfg, "General", "Browser"); - if (sOpt) return wxString(sOpt, wxConvUTF8); - return wxEmptyString; -/* -#ifdef __WXMAC__ - return wxT("safari"); -#else -#ifdef WIN32 - return wxT("explorer.exe"); -#else - return wxT("mozilla"); -#endif -#endif*/ -} - - -IMPLEMENT_DYNAMIC_CLASS(wxGPACEvent, wxEvent ) - -wxGPACEvent::wxGPACEvent(wxWindow* win) -{ - SetEventType(GPAC_EVENT); - SetEventObject(win); - gpac_evt.type = 0; - to_url = wxT(""); -} -wxEvent *wxGPACEvent::Clone() const -{ - wxGPACEvent *evt = new wxGPACEvent((wxWindow *) m_eventObject); - evt->to_url = to_url; - evt->gpac_evt = gpac_evt; - return evt; -} - -#include - -/*open file dlg*/ -BEGIN_EVENT_TABLE(OpenURLDlg, wxDialog) - EVT_BUTTON(ID_URL_GO, OpenURLDlg::OnGo) -END_EVENT_TABLE() - -OpenURLDlg::OpenURLDlg(wxWindow *parent, GF_Config *cfg) - : wxDialog(parent, -1, wxString(wxT("Enter remote presentation location"))) -{ -#ifndef WIN32 - SetSize(430, 35); -#else - SetSize(430, 55); -#endif - Centre(); - m_url = new wxComboBox(this, -1, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN); - m_url->SetSize(0, 2, 340, 18, wxSIZE_AUTO); - m_go = new wxButton(this, ID_URL_GO, wxT("Go !")); -#ifndef WIN32 - m_go->SetSize(344, 2, 20, 18, wxSIZE_AUTO); -#else - m_go->SetSize(364, 2, 30, 18, wxSIZE_AUTO); -#endif - m_urlVal = wxT(""); - - m_cfg = cfg; - - const char *sOpt; - u32 i=0; - - while (1) { - sOpt = gf_cfg_get_key_name(m_cfg, "RecentFiles", i); - if (!sOpt) break; - m_url->Append(wxString(sOpt, wxConvUTF8) ); - i++; - } -} - -#define MAX_LAST_FILES 20 -void UpdateLastFiles(GF_Config *cfg, const char *URL) -{ - u32 nb_entries; - gf_cfg_set_key(cfg, "RecentFiles", URL, NULL); - gf_cfg_insert_key(cfg, "RecentFiles", URL, "", 0); - /*remove last entry if needed*/ - nb_entries = gf_cfg_get_key_count(cfg, "RecentFiles"); - if (nb_entries>MAX_LAST_FILES) { - gf_cfg_set_key(cfg, "RecentFiles", gf_cfg_get_key_name(cfg, "RecentFiles", nb_entries-1), NULL); - } -} - -void OpenURLDlg::OnGo(wxCommandEvent& event) -{ - m_urlVal = m_url->GetValue(); - UpdateLastFiles(m_cfg, m_urlVal.mb_str(wxConvUTF8)); - EndModal(wxID_OK); -} -/*end open file dlg*/ - -#ifdef WIN32 -u32 get_sys_col(int idx) -{ - u32 res; - DWORD val = GetSysColor(idx); - res = (val)&0xFF; res<<=8; - res |= (val>>8)&0xFF; res<<=8; - res |= (val>>16)&0xFF; - return res; -} -#endif - -static void wxOsmo4_progress_cbk(const void *usr, const char *title, u64 done, u64 total) -{ - if (!total) return; - wxOsmo4Frame *app = (wxOsmo4Frame *)usr; - s32 prog = (s32) ( (100 * (u64)done) / total); - if (app->m_last_prog < prog) { - app->m_last_prog = prog; - - if (prog<100) { - /*appears to crash wxWidgets / X11 when refreshing the text too often*/ - if (app->m_LastStatusTime + 200 > gf_sys_clock()) return; - char msg[1024]; - sprintf(msg, "%s %02d %%)", title, prog); - //app->SetStatus(wxString(msg, wxConvUTF8)); - } else { - app->SetStatus(wxT("Ready")); - app->m_last_prog = -1; - } - } -} - -Bool GPAC_EventProc(void *ptr, GF_Event *evt) -{ - wxCommandEvent event; - wxOsmo4Frame *app = (wxOsmo4Frame *)ptr; - - switch (evt->type) { - case GF_EVENT_DURATION: - app->m_duration = (u32) (evt->duration.duration*1000); - app->m_can_seek = evt->duration.can_seek; - if (app->m_duration<1100) app->m_can_seek = 0; - app->m_pProg->Enable(app->m_can_seek ? 1 : 0); - app->m_pPlayList->SetDuration((u32) evt->duration.duration); - break; - case GF_EVENT_MESSAGE: - { - const char *servName; - if (!evt->message.service || !strcmp(evt->message.service, app->m_pPlayList->GetURL().mb_str(wxConvUTF8))) { - servName = "main service"; - } else { - servName = evt->message.service; - } - if (!evt->message.message) return 0; - - if (evt->message.error) { - app->SetStatus(wxString(evt->message.message, wxConvUTF8) + wxT(" (") + wxString(servName, wxConvUTF8) + wxT(")") ); - if (!app->m_connected) app->m_pPlayList->SetDead(); - } - else if (!app->m_console_off) { - if (strstr(evt->message.message, "100 %")) { - app->SetStatus(wxT("")); - } else { - app->SetStatus(wxString(evt->message.message, wxConvUTF8) ); - } - } - -#if 0 - /*log*/ - if (evt->message.error) - ::wxLogMessage(wxString(evt->message.message, wxConvUTF8) + wxT(" (") + wxString(servName, wxConvUTF8) + wxT(") ") + wxString(gf_error_to_string(evt->message.error), wxConvUTF8) ); - else - ::wxLogMessage(wxString(evt->message.message, wxConvUTF8) + wxT(" (") + wxString(servName, wxConvUTF8) + wxT(")")); -#endif - } - break; - case GF_EVENT_PROGRESS: - { - const char *sTitle; - if (evt->progress.progress_type==0) sTitle = (char *)"Buffer"; - else if (evt->progress.progress_type==1) sTitle = (char *)"Download"; - else if (evt->progress.progress_type==2) sTitle = (char *)"Import"; - gf_set_progress(sTitle, evt->progress.done, evt->progress.total); - } - break; - case GF_EVENT_KEYDOWN: - if (app->m_can_seek && (evt->key.flags & GF_KEY_MOD_ALT)) { - s32 res; - switch (evt->key.key_code) { - case GF_KEY_LEFT: - res = gf_term_get_time_in_ms(app->m_term) - 5*app->m_duration/100; - if (res<0) res=0; - gf_term_play_from_time(app->m_term, res, 0); - break; - case GF_KEY_RIGHT: - res = gf_term_get_time_in_ms(app->m_term) + 5*app->m_duration/100; - if ((u32) res>=app->m_duration) res = 0; - gf_term_play_from_time(app->m_term, res, 0); - break; - case GF_KEY_DOWN: - res = gf_term_get_time_in_ms(app->m_term) - 60000; - if (res<0) res=0; - gf_term_play_from_time(app->m_term, res, 0); - break; - case GF_KEY_UP: - res = gf_term_get_time_in_ms(app->m_term) + 60000; - if ((u32) res>=app->m_duration) res = 0; - gf_term_play_from_time(app->m_term, res, 0); - break; - } - } else if (evt->key.flags & GF_KEY_MOD_CTRL) { - switch (evt->key.key_code) { - case GF_KEY_LEFT: - app->m_pPlayList->PlayPrev(); - break; - case GF_KEY_RIGHT: - app->m_pPlayList->PlayNext(); - break; - } - } else { - switch (evt->key.key_code) { - case GF_KEY_HOME: - gf_term_set_option(app->m_term, GF_OPT_NAVIGATION_TYPE, 1); - break; - case GF_KEY_ESCAPE: - if (gf_term_get_option(app->m_term, GF_OPT_FULLSCREEN)) - gf_term_set_option(app->m_term, GF_OPT_FULLSCREEN, 0); - break; - default: - { - wxGPACEvent wxevt(app); - wxevt.gpac_evt = *evt; - app->AddPendingEvent(wxevt); - } - break; - } - } - break; - - case GF_EVENT_CONNECT: - { - wxGPACEvent wxevt(app); - wxevt.gpac_evt.type = GF_EVENT_CONNECT; - wxevt.gpac_evt.connect.is_connected = evt->connect.is_connected; - if (!evt->connect.is_connected) app->m_duration = 0; - app->AddPendingEvent(wxevt); - } - break; - case GF_EVENT_NAVIGATE: - { - wxGPACEvent wxevt(app); - wxevt.to_url = wxString(evt->navigate.to_url, wxConvUTF8); - wxevt.gpac_evt.type = evt->type; - app->AddPendingEvent(wxevt); - } - return 1; - case GF_EVENT_SET_CAPTION: - { - wxGPACEvent wxevt(app); - wxevt.to_url = wxString(evt->caption.caption, wxConvUTF8); - wxevt.gpac_evt.type = evt->type; - app->AddPendingEvent(wxevt); - } - return 1; - - case GF_EVENT_QUIT: - case GF_EVENT_VIEWPOINTS: - case GF_EVENT_STREAMLIST: - case GF_EVENT_SCENE_SIZE: -// case GF_EVENT_SIZE: - { - wxGPACEvent wxevt(app); - wxevt.gpac_evt = *evt; - app->AddPendingEvent(wxevt); - } - break; - case GF_EVENT_DBLCLICK: - gf_term_set_option(app->m_term, GF_OPT_FULLSCREEN, !gf_term_get_option(app->m_term, GF_OPT_FULLSCREEN)); - return 0; - case GF_EVENT_MOUSEDOWN: - if (!gf_term_get_option(app->m_term, GF_OPT_FULLSCREEN)) { -#ifdef __WXGTK__ - app->m_pVisual->SetFocus(); -#else - app->m_pView->SetFocus(); -#endif - } - break; - case GF_EVENT_AUTHORIZATION: - { - wxGPACEvent wxevt(app); - wxTextEntryDialog user_d (0, - wxT("Please set the user name for connection"), - wxString(evt->auth.site_url, wxConvUTF8), - wxString(evt->auth.user, wxConvUTF8)); - if (user_d.ShowModal() != wxID_OK) - return 0; - strncpy(evt->auth.user, user_d.GetValue().mb_str(wxConvUTF8), 50); - wxPasswordEntryDialog passwd_d(0, - wxT("Please enter password"), - wxString(evt->auth.site_url, wxConvUTF8), - wxString(evt->auth.password, wxConvUTF8)); - if (passwd_d.ShowModal() != wxID_OK) - return 0; - strncpy(evt->auth.password, passwd_d.GetValue().mb_str(wxConvUTF8), 50); - return 1; - } - case GF_EVENT_SYS_COLORS: -#ifdef WIN32 - evt->sys_cols.sys_colors[0] = get_sys_col(COLOR_ACTIVEBORDER); - evt->sys_cols.sys_colors[1] = get_sys_col(COLOR_ACTIVECAPTION); - evt->sys_cols.sys_colors[2] = get_sys_col(COLOR_APPWORKSPACE); - evt->sys_cols.sys_colors[3] = get_sys_col(COLOR_BACKGROUND); - evt->sys_cols.sys_colors[4] = get_sys_col(COLOR_BTNFACE); - evt->sys_cols.sys_colors[5] = get_sys_col(COLOR_BTNHIGHLIGHT); - evt->sys_cols.sys_colors[6] = get_sys_col(COLOR_BTNSHADOW); - evt->sys_cols.sys_colors[7] = get_sys_col(COLOR_BTNTEXT); - evt->sys_cols.sys_colors[8] = get_sys_col(COLOR_CAPTIONTEXT); - evt->sys_cols.sys_colors[9] = get_sys_col(COLOR_GRAYTEXT); - evt->sys_cols.sys_colors[10] = get_sys_col(COLOR_HIGHLIGHT); - evt->sys_cols.sys_colors[11] = get_sys_col(COLOR_HIGHLIGHTTEXT); - evt->sys_cols.sys_colors[12] = get_sys_col(COLOR_INACTIVEBORDER); - evt->sys_cols.sys_colors[13] = get_sys_col(COLOR_INACTIVECAPTION); - evt->sys_cols.sys_colors[14] = get_sys_col(COLOR_INACTIVECAPTIONTEXT); - evt->sys_cols.sys_colors[15] = get_sys_col(COLOR_INFOBK); - evt->sys_cols.sys_colors[16] = get_sys_col(COLOR_INFOTEXT); - evt->sys_cols.sys_colors[17] = get_sys_col(COLOR_MENU); - evt->sys_cols.sys_colors[18] = get_sys_col(COLOR_MENUTEXT); - evt->sys_cols.sys_colors[19] = get_sys_col(COLOR_SCROLLBAR); - evt->sys_cols.sys_colors[20] = get_sys_col(COLOR_3DDKSHADOW); - evt->sys_cols.sys_colors[21] = get_sys_col(COLOR_3DFACE); - evt->sys_cols.sys_colors[22] = get_sys_col(COLOR_3DHIGHLIGHT); - evt->sys_cols.sys_colors[23] = get_sys_col(COLOR_3DLIGHT); - evt->sys_cols.sys_colors[24] = get_sys_col(COLOR_3DSHADOW); - evt->sys_cols.sys_colors[25] = get_sys_col(COLOR_WINDOW); - evt->sys_cols.sys_colors[26] = get_sys_col(COLOR_WINDOWFRAME); - evt->sys_cols.sys_colors[27] = get_sys_col(COLOR_WINDOWTEXT); - return 1; -#else - memset(evt->sys_cols.sys_colors, 0, sizeof(u32)*28); - return 1; -#endif - } - return 0; -} - - - -bool wxOsmo4App::OnInit() -{ -#ifdef __WXGTK__ - XSynchronize((Display *) wxGetDisplay(), 1); -#endif - wxFrame *frame = new wxOsmo4Frame(); - frame->Show(TRUE); - SetTopWindow(frame); - return true; -} - - -class myDropfiles : public wxFileDropTarget -{ -public: - myDropfiles() : wxFileDropTarget() {} - virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames); - wxOsmo4Frame *m_pMain; -}; - -bool myDropfiles::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) -{ - u32 count = filenames.GetCount(); - - if (count==1) { - const char *ext = strrchr(filenames.Item(0).mb_str(wxConvUTF8) , '.'); - /*if playing and sub d&d, open sub in current presentation*/ - if (m_pMain->m_connected && ext && ( !stricmp(ext, ".srt") || !stricmp(ext, ".sub") || !stricmp(ext, ".ttxt") || !stricmp(ext, ".xml") ) ) { - m_pMain->AddSubtitle(filenames.Item(0).mb_str(wxConvUTF8) , 1); - return TRUE; - } - } - - for (u32 i=0; im_pPlayList->QueueURL(filenames.Item(i)); - - m_pMain->m_pPlayList->RefreshList(); - m_pMain->m_pPlayList->PlayNext(); - return TRUE; -} - -bool GPACLogs::OnFrameClose(wxFrame *frame) -{ - Show(FALSE); - return 0; -} - -void wxOsmo4Frame::ShowViewWindow(Bool do_show) -{ - m_pView->Show(do_show ? 1 : 0); -#ifdef __WXGTK__ - //m_pView->Show(0); -#endif -} - -#ifdef __WXGTK__ -extern "C" { -#ifdef __WXGTK20__ - int gdk_x11_drawable_get_xid( void * ); - void *gdk_x11_drawable_get_xdisplay( void * ); -#endif - void *gtk_widget_get_parent_window( void * ); -} -#endif - - -void wxOsmo4Frame::CheckVideoOut() -{ - const char *sOpt = gf_cfg_get_key(m_user.config, "Video", "DriverName"); - void *os_handle = NULL; - void *os_display = NULL; - /*build a child window for embed display*/ - if (sOpt && stricmp(sOpt, "SDL Video Output")) { - if (m_user.os_window_handler) return; - m_bExternalView = 0; - -#ifdef __WXGTK__ - GtkWidget* widget = m_pVisual->GetHandle(); - -#ifdef __WXGTK20__ - os_handle = (void *) gdk_x11_drawable_get_xid(gtk_widget_get_parent_window(widget)); -#else - os_handle = (void *)*(int *)( (char *)gtk_widget_get_parent_window(widget) + 2 * sizeof(void *) ); -#endif - -#elif defined (WIN32) - os_handle = m_pView->GetHandle(); -#endif - if (os_handle) { - m_user.os_window_handler = os_handle; - m_user.os_display = os_display; - ShowViewWindow(1); - m_pView->SetSize(320, 240); - SetSize(wxSize(320, 240+FRAME_H)); - SetWindowStyle(wxDEFAULT_FRAME_STYLE); - DoLayout(320, 240); - return; - } - } - /*we're using SDL, don't use SDL hack*/ - m_bExternalView = 1; - m_user.os_window_handler = 0; - m_user.os_display = NULL; - SetSize(wxSize(320,FRAME_H)); - m_pView->SetSize(0, 0); - ShowViewWindow(0); - DoLayout(); - SetWindowStyle(wxDEFAULT_FRAME_STYLE & ~(wxMAXIMIZE_BOX | wxRESIZE_BORDER)); -} - -static void wxOsmo4_do_log(void *cbk, u32 level, u32 tool, const char *fmt, va_list list) -{ - wxOsmo4Frame *osmo = (wxOsmo4Frame *)cbk; - - if (osmo->m_logs) { - vfprintf(osmo->m_logs, fmt, list); - fflush(osmo->m_logs); - } else { - ::wxVLogMessage(wxString(fmt, wxConvUTF8), list); - } -} - - -Bool wxOsmo4Frame::LoadTerminal() -{ - m_term = NULL; - memset(&m_user, 0, sizeof(GF_User)); - - /*locate exec dir for cfg file*/ - wxPathList pathList; - wxString currentDir(wxGetCwd()); - wxString abs_gpac_path = wxT(""); - char *gpac_cfg, *sep; - - ::wxLogMessage(wxT("Looking for GPAC configuration file")); - - /*load config*/ - Bool first_launch = 0; - m_user.config = gf_cfg_init(NULL, &first_launch); - - if (!m_user.config) { - wxMessageDialog(NULL, wxT("Cannot open GPAC configuration file"), wxT("Init error"), wxOK); - return 0; - } - - gpac_cfg = gf_cfg_get_filename(m_user.config); - sep = strrchr(gpac_cfg, '/'); - if (!sep) sep = strrchr(gpac_cfg, '\\'); - if (sep) sep[0] = 0; - strcpy(szAppPath, gpac_cfg); - if (sep) sep[0] = '/'; - gf_free(gpac_cfg); - - /*check log file*/ - const char *str = gf_cfg_get_key(m_user.config, "General", "LogFile"); - if (str) m_logs = fopen(str, "wt"); - gf_log_set_callback(this, wxOsmo4_do_log); - - /*set log level*/ - gf_log_set_tools_levels( gf_cfg_get_key(m_user.config, "General", "Logs") ); - - gf_sys_init(0); - - ::wxLogMessage(wxT("GPAC configuration file opened - looking for modules")); - - m_user.modules = gf_modules_new(str, m_user.config); - /*initial launch*/ - if (!m_user.modules || !gf_modules_get_count(m_user.modules)) { - wxMessageDialog(NULL, wxT("No modules available - system cannot work"), wxT("Fatal Error"), wxOK).ShowModal(); - if (m_user.modules) gf_modules_del(m_user.modules); - gf_cfg_del(m_user.config); - m_user.config = NULL; - return 0; - } - - if (first_launch) { - u32 i; - for (i=0; iCanHandleURL(ifce, "test.test"); - gf_modules_close_interface((GF_BaseInterface *) ifce); - } - } - } - - - - ::wxLogMessage(wxT("%d modules found:"), gf_modules_get_count(m_user.modules)); - for (u32 i=0; im_pMain = this; - SetDropTarget(droptarget); - m_pLogs = new GPACLogs(this); - m_bGrabbed = 0; - - /*new menu bar*/ - wxMenuBar *b = new wxMenuBar(); - /*file*/ - wxMenu *menu = new wxMenu(); - menu->Append(GWX_FILE_OPEN, wxT("&Open File\tCtrl+O"), wxT("Open local presentation")); - menu->Append(GWX_FILE_OPEN_URL, wxT("&Open URL\tCtrl+U"), wxT("Open remote presentation")); - menu->AppendSeparator(); - menu->Append(FILE_PROPERTIES, wxT("&Properties\tCtrl+I"), wxT("Show presentation properties")); - menu->Enable(FILE_PROPERTIES, 0); - wxMenu *smenu = new wxMenu(); - smenu->Append(ID_MCACHE_ENABLE, wxT("&Enable"), wxT("Turns Recorder On/Off")); - smenu->Append(ID_MCACHE_STOP, wxT("&Stop"), wxT("Stops recording and saves")); - smenu->Append(ID_MCACHE_ABORT, wxT("&Abort"), wxT("Stops recording and discards")); - menu->Append(0, wxT("&Streaming Cache"), smenu); - menu->AppendSeparator(); - menu->Append(FILE_COPY, wxT("&Copy\tCtrl+C"), wxT("Copy selected text")); - menu->Append(FILE_PASTE, wxT("&Paste\tCtrl+V"), wxT("Copy selected text")); - menu->AppendSeparator(); - menu->Append(FILE_QUIT, wxT("E&xit"), wxT("Quit the application")); - b->Append(menu, wxT("&File")); - /*view*/ - menu = new wxMenu(); - vp_list = new wxMenu(); - menu->Append(0, wxT("&Viewpoint"), vp_list); - smenu = new wxMenu(); - smenu->Append(ID_HEADLIGHT, wxT("Headlight"), wxT("Turns headlight on/off"), wxITEM_CHECK); - smenu->AppendSeparator(); - smenu->Append(ID_NAVIGATE_NONE, wxT("None"), wxT("Disables Navigation"), wxITEM_CHECK); - smenu->Append(ID_NAVIGATE_WALK, wxT("Walk"), wxT("Walk Navigation"), wxITEM_CHECK); - smenu->Append(ID_NAVIGATE_FLY, wxT("Fly"), wxT("Fly Navigation"), wxITEM_CHECK); - smenu->Append(ID_NAVIGATE_EXAMINE, wxT("Examine"), wxT("Examine Navigation"), wxITEM_CHECK); - smenu->Append(ID_NAVIGATE_PAN, wxT("Pan"), wxT("Pan Navigation"), wxITEM_CHECK); - smenu->Append(ID_NAVIGATE_SLIDE, wxT("Slide"), wxT("Slide Navigation"), wxITEM_CHECK); - smenu->Append(ID_NAVIGATE_ORBIT, wxT("Orbit"), wxT("Orbit Navigation"), wxITEM_CHECK); - smenu->Append(ID_NAVIGATE_GAME, wxT("Game"), wxT("Game Navigation"), wxITEM_CHECK); - smenu->AppendSeparator(); - wxMenu *ssmenu = new wxMenu(); - ssmenu->Append(ID_COLLIDE_NONE, wxT("None"), wxT("No Collision detection"), wxITEM_CHECK); - ssmenu->Append(ID_COLLIDE_REG, wxT("Regular"), wxT("Regular Collision detection"), wxITEM_CHECK); - ssmenu->Append(ID_COLLIDE_DISP, wxT("Displacement"), wxT("Collision detecion with camera displacement"), wxITEM_CHECK); - smenu->Append(0, wxT("&Collision"), ssmenu); - smenu->Append(ID_GRAVITY, wxT("Gravity"), wxT("Turns gravity on/off"), wxITEM_CHECK); - smenu->AppendSeparator(); - smenu->Append(ID_NAVIGATE_RESET, wxT("Reset"), wxT("Reset Navigation")); - - menu->Append(0, wxT("&Navigation"), smenu); - menu->AppendSeparator(); - menu->Append(VIEW_FULLSCREEN, wxT("&Fullscreen"), wxT("Toggles Fullscreen"), wxITEM_CHECK); - menu->Append(VIEW_ORIGINAL, wxT("&Original Size"), wxT("Restore original size")); - smenu = new wxMenu(); - smenu->Append(VIEW_AR_KEEP, wxT("Keep Original\tCtrl+1"), wxT("Keep original aspect ratio"), wxITEM_CHECK); - smenu->Append(VIEW_AR_FILL, wxT("Fill Screen\tCtrl+2"), wxT("Stretch presentation to fill screen"), wxITEM_CHECK); - smenu->Append(VIEW_AR_43, wxT("Ratio 4/3\tCtrl+3"), wxT("Force aspect ratio to 4/3"), wxITEM_CHECK); - smenu->Append(VIEW_AR_169, wxT("Ratio 16/9\tCtrl+4"), wxT("Force aspect ratio to 16/9"), wxITEM_CHECK); - menu->Append(0, wxT("&Aspect Ratio"), smenu); - smenu->Check(VIEW_AR_KEEP, 1); - menu->AppendSeparator(); - menu->Append(VIEW_OPTIONS, wxT("&Options"), wxT("View Options")); - menu->AppendSeparator(); - menu->Append(VIEW_RTI, wxT("&Resource Usage"), wxT("View Resource Usage"), wxITEM_CHECK); - menu->Append(VIEW_LOGS, wxT("&Logs"), wxT("View GPAC logs")); - b->Append(menu, wxT("&View")); - - /*play*/ - menu = new wxMenu(); - sel_menu = new wxMenu(); - sel_menu->Append(0, wxT("&Audio"), new wxMenu()); - sel_menu->Append(0, wxT("&Video"), new wxMenu()); - sel_menu->Append(0, wxT("&Subtitles"), new wxMenu()); - sel_menu->AppendSeparator(); - sel_menu->Append(ID_ADD_SUB, wxT("&Add Subtitle"), wxT("Adds subtitle")); - menu->Append(ID_STREAM_MENU, wxT("&Streams Selection"), sel_menu); - chap_menu = new wxMenu(); - menu->Append(ID_CHAPTER_MENU, wxT("&Chapters"), chap_menu); - - menu->AppendSeparator(); - menu->Append(VIEW_PLAYLIST, wxT("&Playlist\tCtrl+L"), wxT("Show navigation history as playlist"), wxITEM_CHECK); - menu->Append(ID_CLEAR_NAV, wxT("&Clear History"), wxT("Clear navigation history")); - menu->AppendSeparator(); - menu->Append(FILE_PLAY, wxT("&Play/Pause\tCtrl+P"), wxT("Play/Pause/Resume Presentation")); - menu->Append(FILE_STEP, wxT("&Step-by-Step\tCtrl+S"), wxT("Play/Pause/Resume Presentation")); - menu->Append(FILE_STOP, wxT("&Stop"), wxT("Stop Presentation")); - menu->AppendSeparator(); - menu->Append(FILE_RELOAD_CONFIG, wxT("&Reload Config\tCtrl+R"), wxT("Reload Configuration File")); - menu->Append(FILE_RELOAD, wxT("&Reload File\tCtrl+R"), wxT("Reload Presentation")); - b->Append(menu, wxT("&Play")); - - menu = new wxMenu(); - menu->Append(APP_SHORTCUTS, wxT("&Shortcuts"), wxT("Show keyboard shortcuts")); - menu->Append(APP_NAV_KEYS, wxT("&Navigation Keys"), wxT("Show navigation keys")); - menu->AppendSeparator(); - menu->Append(APP_ABOUT, wxT("&About"), wxT("Display information and copyright")); - b->Append(menu, wxT("&?")); - - SetMenuBar(b); - - m_pStatusbar = CreateStatusBar(1, 0, -1, wxT("statusBar")); - ws[0] = 60; - ws[1] = 70; - ws[2] = -1; - m_pStatusbar->SetFieldsCount(3, ws); - - SetStatusBarPane(2); - wxColour foreCol = m_pStatusbar->GetBackgroundColour(); - SetBackgroundColour(foreCol); - - - m_pTimer = new wxTimer(); - m_pTimer->SetOwner(this, ID_CTRL_TIMER); - m_bGrabbed = 0; - - /*create toolbar*/ - m_pToolBar = CreateToolBar(wxTB_FLAT|wxTB_HORIZONTAL); - m_pOpenFile = new wxBitmap(tool_open_file); - m_pPrev = new wxBitmap(tool_prev); - m_pNext = new wxBitmap(tool_next); - m_pPlay = new wxBitmap(tool_play); - m_pPause = new wxBitmap(tool_pause); - m_pStep = new wxBitmap(tool_step); - m_pStop = new wxBitmap(tool_stop); - m_pInfo = new wxBitmap(tool_info); - m_pConfig = new wxBitmap(tool_config); - m_pSW2D = new wxBitmap(tool_sw_2d); - m_pSW3D = new wxBitmap(tool_sw_3d); - - m_pToolBar->AddTool(GWX_FILE_OPEN, wxT(""), *m_pOpenFile, wxT("Open File")); - m_pToolBar->AddSeparator(); - m_pPrevBut = new wxMenuButton(m_pToolBar, FILE_PREV, *m_pPrev); - m_pPrevBut->SetToolTip(wxT("Previous Location")); - m_pToolBar->AddControl(m_pPrevBut); - m_pNextBut = new wxMenuButton(m_pToolBar, FILE_NEXT, *m_pNext); - m_pNextBut->SetToolTip(wxT("Next Location")); - m_pToolBar->AddControl(m_pNextBut); - - m_pToolBar->AddSeparator(); - m_pToolBar->AddTool(FILE_PLAY, wxT(""), *m_pPlay, wxT("Play/Pause File")); - m_pToolBar->AddTool(FILE_STEP, wxT(""), *m_pStep, wxT("Step-by-Step Mode")); - m_pToolBar->AddTool(FILE_STOP, wxT(""), *m_pStop, wxT("Stop File")); - m_pToolBar->AddSeparator(); - m_pToolBar->AddTool(FILE_PROPERTIES, wxT(""), *m_pInfo, wxT("Show File Information")); - m_pToolBar->AddSeparator(); - m_pToolBar->AddTool(VIEW_OPTIONS, wxT(""), *m_pConfig, wxT("GPAC Configuration")); - m_pToolBar->AddTool(SWITCH_RENDER, wxT(""), *m_pSW3D, wxT("Switch 2D/3D Renderers")); - - m_pToolBar->Realize(); - - m_Address = new wxMyComboBox(this, ID_ADDRESS, wxT(""), wxPoint(50, 0), wxSize(80, 20)); - wxStaticText *add_text = new wxStaticText(this, -1, wxT("URL"), wxPoint(0, 0), wxSize(40, 20)); - add_text->SetBackgroundColour(foreCol); - - m_pAddBar = new wxBoxSizer(wxHORIZONTAL); - m_pAddBar->Add(add_text, 0, wxALIGN_TOP); - m_pAddBar->Add(m_Address, 2, wxALIGN_CENTER|wxEXPAND|wxADJUST_MINSIZE); - m_pAddBar->SetMinSize(80, 32); - m_pAddBar->Layout(); - - m_pProg = new wxSlider(this, ID_SLIDER, 0, 0, 1000, wxPoint(0, 22), wxSize(80, 22), wxSL_HORIZONTAL|wxSUNKEN_BORDER); - m_pProg->Enable(0); - m_pProg->Show(); - m_pProg->SetBackgroundColour(foreCol); - - m_pView = new wxWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER); - m_pView->SetBackgroundColour(wxColour(wxT("BLACK"))); -#ifdef __WXGTK__ - m_pVisual = new wxWindow(m_pView, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER); - m_pVisual->SetBackgroundColour(wxColour(wxT("BLACK"))); -#endif - - m_pPlayList = new wxPlaylist(this); - m_pPlayList->SetIcon(wxIcon(osmo4)); - m_pPlayList->Hide(); - Raise(); - Show(); - - m_connected = 0; - if (!LoadTerminal()) { - Close(TRUE); - return; - } - - - - if (m_bExternalView) SetWindowStyle(wxDEFAULT_FRAME_STYLE & ~(wxMAXIMIZE_BOX | wxRESIZE_BORDER)); - DoLayout(320, 240); - UpdateRenderSwitch(); - - const char *sOpt = gf_cfg_get_key(m_user.config, "General", "ConsoleOff"); - m_console_off = (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0; - sOpt = gf_cfg_get_key(m_user.config, "General", "Loop"); - m_loop = (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0; - sOpt = gf_cfg_get_key(m_user.config, "General", "LookForSubtitles"); - m_lookforsubs = (sOpt && !stricmp(sOpt, "yes")) ? 1 : 0; - gf_term_set_option(m_term, GF_OPT_AUDIO_VOLUME, 100); - - ReloadURLs(); - Raise(); - m_pStatusbar->SetStatusText(wxT("Ready"), 2); - m_LastStatusTime = 0; - - m_pPrevBut->Refresh(); - m_pNextBut->Refresh(); - - wxOsmo4App &app = wxGetApp(); - if (app.argc>1) { - m_pPlayList->QueueURL(wxString(app.argv[1])); - m_pPlayList->RefreshList(); - m_pPlayList->PlayNext(); - } else { - char sPL[GF_MAX_PATH]; - strcpy((char *) sPL, szAppPath); -#ifdef WIN32 - strcat(sPL, "gpac_pl.m3u"); -#else - strcat(sPL, ".gpac_pl.m3u"); -#endif - m_pPlayList->OpenPlaylist(wxString(sPL, wxConvUTF8) ); - const char *sOpt = gf_cfg_get_key(m_user.config, "General", "PLEntry"); - if (sOpt) { - m_pPlayList->m_cur_entry = atoi(sOpt); - if (m_pPlayList->m_cur_entry>=(s32)gf_list_count(m_pPlayList->m_entries)) - m_pPlayList->m_cur_entry = -1; - } - - sOpt = gf_cfg_get_key(m_user.config, "General", "StartupFile"); - if (sOpt) { - gf_term_connect(m_term, sOpt); - m_bStartupFile = 1; - } - } - - sOpt = gf_cfg_get_key(m_user.config, "Audio", "DriverName"); - - if (!strcmp(sOpt, "No Audio Output Available")) { - ::wxLogMessage(wxT("WARNING: no audio output availble - make sure no other program is locking the sound card")); - SetStatus(wxT("No audio ouput available")); - - } else { - SetStatus(wxT("Ready")); - } -} - -wxOsmo4Frame::~wxOsmo4Frame() -{ - vp_list = NULL; - sel_menu = NULL; - - if (m_user.modules) gf_modules_del(m_user.modules); - gf_sys_close(); - if (m_user.config) gf_cfg_del(m_user.config); - - if (m_chapters_start) gf_free(m_chapters_start); - if (m_pView) delete m_pView; - - //m_pToolBar->RemoveTool(FILE_PREV); - //m_pToolBar->RemoveTool(FILE_NEXT); - - delete m_pPrevBut; - delete m_pNextBut; - delete m_pPlayList; - delete m_pTimer; - delete m_pOpenFile; - delete m_pPrev; - delete m_pNext; - delete m_pPlay; - delete m_pPause; - delete m_pStep; - delete m_pStop; - delete m_pInfo; - delete m_pConfig; - delete m_pSW2D; - delete m_pSW3D; -} - - -BEGIN_EVENT_TABLE(wxOsmo4Frame, wxFrame) - EVT_CLOSE(wxOsmo4Frame::OnCloseApp) - EVT_MENU(GWX_FILE_OPEN, wxOsmo4Frame::OnFileOpen) - EVT_MENU(GWX_FILE_OPEN_URL, wxOsmo4Frame::OnFileOpenURL) - EVT_MENU(FILE_RELOAD_CONFIG, wxOsmo4Frame::OnFileReloadConfig) - EVT_MENU(FILE_RELOAD, wxOsmo4Frame::OnFileReload) - EVT_MENU(FILE_PROPERTIES, wxOsmo4Frame::OnFileProperties) - EVT_MENU(FILE_QUIT, wxOsmo4Frame::OnFileQuit) - EVT_MENU(VIEW_FULLSCREEN, wxOsmo4Frame::OnFullScreen) - EVT_MENU(VIEW_OPTIONS, wxOsmo4Frame::OnOptions) - EVT_MENU(VIEW_AR_KEEP, wxOsmo4Frame::OnViewARKeep) - EVT_MENU(VIEW_AR_FILL, wxOsmo4Frame::OnViewARFill) - EVT_MENU(VIEW_AR_169, wxOsmo4Frame::OnViewAR169) - EVT_MENU(VIEW_AR_43, wxOsmo4Frame::OnViewAR43) - EVT_MENU(VIEW_ORIGINAL, wxOsmo4Frame::OnViewOriginal) - EVT_MENU(VIEW_PLAYLIST, wxOsmo4Frame::OnPlaylist) - EVT_UPDATE_UI(VIEW_PLAYLIST, wxOsmo4Frame::OnUpdatePlayList) - EVT_MENU(FILE_COPY, wxOsmo4Frame::OnFileCopy) - EVT_UPDATE_UI(FILE_COPY, wxOsmo4Frame::OnUpdateFileCopy) - EVT_MENU(FILE_PASTE, wxOsmo4Frame::OnFilePaste) - EVT_UPDATE_UI(FILE_PASTE, wxOsmo4Frame::OnUpdateFilePaste) - - EVT_MENU(ID_CLEAR_NAV, wxOsmo4Frame::OnClearNav) - EVT_UPDATE_UI(ID_STREAM_MENU, wxOsmo4Frame::OnUpdateStreamMenu) - EVT_UPDATE_UI(ID_CHAPTER_MENU, wxOsmo4Frame::OnUpdateChapterMenu) - EVT_MENU(ID_ADD_SUB, wxOsmo4Frame::OnAddSub) - - EVT_MENU(ID_MCACHE_ENABLE, wxOsmo4Frame::OnCacheEnable) - EVT_UPDATE_UI(ID_MCACHE_ENABLE, wxOsmo4Frame::OnUpdateCacheEnable) - EVT_MENU(ID_MCACHE_STOP, wxOsmo4Frame::OnCacheStop) - EVT_MENU(ID_MCACHE_ABORT, wxOsmo4Frame::OnCacheAbort) - EVT_UPDATE_UI(ID_MCACHE_STOP, wxOsmo4Frame::OnUpdateCacheAbort) - EVT_UPDATE_UI(ID_MCACHE_ABORT, wxOsmo4Frame::OnUpdateCacheAbort) - - - EVT_MENU(APP_SHORTCUTS, wxOsmo4Frame::OnShortcuts) - EVT_MENU(APP_NAV_KEYS, wxOsmo4Frame::OnNavInfo) - EVT_MENU(APP_ABOUT, wxOsmo4Frame::OnAbout) - EVT_GPACEVENT(wxOsmo4Frame::OnGPACEvent) - EVT_TIMER(ID_CTRL_TIMER, wxOsmo4Frame::OnTimer) - EVT_COMMAND_SCROLL(ID_SLIDER, wxOsmo4Frame::OnSlide) - EVT_MENU(VIEW_LOGS, wxOsmo4Frame::OnLogs) - EVT_MENU(VIEW_RTI, wxOsmo4Frame::OnRTI) - - EVT_MENUBUTTON_OPEN(FILE_PREV, wxOsmo4Frame::OnFilePrevOpen) - EVT_MENUBUTTON_OPEN(FILE_NEXT, wxOsmo4Frame::OnFileNextOpen) - EVT_MENU(FILE_PREV, wxOsmo4Frame::OnNavPrev) - EVT_UPDATE_UI(FILE_PREV, wxOsmo4Frame::OnUpdateNavPrev) - EVT_MENU_RANGE(ID_NAV_PREV_0, ID_NAV_PREV_9, wxOsmo4Frame::OnNavPrevMenu) - EVT_MENU(FILE_NEXT, wxOsmo4Frame::OnNavNext) - EVT_UPDATE_UI(FILE_NEXT, wxOsmo4Frame::OnUpdateNavNext) - EVT_MENU_RANGE(ID_NAV_NEXT_0, ID_NAV_NEXT_9, wxOsmo4Frame::OnNavNextMenu) - - EVT_TOOL(FILE_PLAY, wxOsmo4Frame::OnFilePlay) - EVT_TOOL(FILE_STEP, wxOsmo4Frame::OnFileStep) - EVT_TOOL(FILE_STOP, wxOsmo4Frame::OnFileStop) - EVT_TOOL(SWITCH_RENDER, wxOsmo4Frame::OnRenderSwitch) - - EVT_COMBOBOX(ID_ADDRESS, wxOsmo4Frame::OnURLSelect) - - EVT_MENU_RANGE(ID_SELSTREAM_0, ID_SELSTREAM_9, wxOsmo4Frame::OnStreamSel) - EVT_UPDATE_UI_RANGE(ID_SELSTREAM_0, ID_SELSTREAM_9, wxOsmo4Frame::OnUpdateStreamSel) - - EVT_MENU_RANGE(ID_SETCHAP_FIRST, ID_SETCHAP_LAST, wxOsmo4Frame::OnChapterSel) - EVT_UPDATE_UI_RANGE(ID_SETCHAP_FIRST, ID_SETCHAP_LAST, wxOsmo4Frame::OnUpdateChapterSel) - - EVT_MENU_RANGE(ID_VIEWPOINT_FIRST, ID_VIEWPOINT_LAST, wxOsmo4Frame::OnViewport) - EVT_UPDATE_UI_RANGE(ID_VIEWPOINT_FIRST, ID_VIEWPOINT_LAST, wxOsmo4Frame::OnUpdateViewport) - - EVT_MENU_RANGE(ID_NAVIGATE_NONE, ID_NAVIGATE_GAME, wxOsmo4Frame::OnNavigate) - EVT_UPDATE_UI_RANGE(ID_NAVIGATE_NONE, ID_NAVIGATE_GAME, wxOsmo4Frame::OnUpdateNavigation) - EVT_MENU(ID_NAVIGATE_RESET, wxOsmo4Frame::OnNavigateReset) - - EVT_MENU_RANGE(ID_COLLIDE_NONE, ID_COLLIDE_DISP, wxOsmo4Frame::OnCollide) - EVT_UPDATE_UI_RANGE(ID_COLLIDE_NONE, ID_COLLIDE_DISP, wxOsmo4Frame::OnUpdateCollide) - - EVT_MENU(ID_HEADLIGHT, wxOsmo4Frame::OnHeadlight) - EVT_UPDATE_UI(ID_HEADLIGHT, wxOsmo4Frame::OnUpdateHeadlight) - EVT_MENU(ID_GRAVITY, wxOsmo4Frame::OnGravity) - EVT_UPDATE_UI(ID_GRAVITY, wxOsmo4Frame::OnUpdateGravity) - - EVT_UPDATE_UI(FILE_PROPERTIES, wxOsmo4Frame::OnUpdateNeedsConnect) - EVT_UPDATE_UI(FILE_RELOAD, wxOsmo4Frame::OnUpdateNeedsConnect) - EVT_UPDATE_UI(FILE_PLAY, wxOsmo4Frame::OnUpdatePlay) - EVT_UPDATE_UI(FILE_STOP, wxOsmo4Frame::OnUpdateNeedsConnect) - EVT_UPDATE_UI(FILE_STEP, wxOsmo4Frame::OnUpdateNeedsConnect) - EVT_UPDATE_UI(VIEW_ORIGINAL, wxOsmo4Frame::OnUpdateNeedsConnect) - EVT_UPDATE_UI(VIEW_FULLSCREEN, wxOsmo4Frame::OnUpdateFullScreen) - EVT_UPDATE_UI(VIEW_AR_KEEP, wxOsmo4Frame::OnUpdateAR) - EVT_UPDATE_UI(VIEW_AR_FILL, wxOsmo4Frame::OnUpdateAR) - EVT_UPDATE_UI(VIEW_AR_169, wxOsmo4Frame::OnUpdateAR) - EVT_UPDATE_UI(VIEW_AR_43, wxOsmo4Frame::OnUpdateAR) - - EVT_SIZE(wxOsmo4Frame::OnSize) -END_EVENT_TABLE() - -void wxOsmo4Frame::DoLayout(u32 v_width, u32 v_height) -{ - wxPoint pos; - if (!m_Address || !m_pProg) return; - - int t_h = m_pToolBar->GetSize().y; - int a_h = m_pAddBar->GetSize().y; - int p_h = m_pProg->GetSize().y; - - if (m_bExternalView) { - if (v_width && v_height) { - m_orig_width = v_width; - m_orig_height = v_height; - } - SetClientSize(320, a_h+p_h+t_h); - m_pAddBar->SetDimension(0,0, 320, a_h); - m_pProg->SetSize(0, t_h+a_h, 320, p_h, 0); - return; - } - - if (v_width && v_height) { - m_orig_width = v_width; - m_orig_height = v_height; - v_height += a_h + p_h + t_h; - SetClientSize(v_width, v_height); - m_pView->SetSize(0, a_h+t_h, v_width, v_height, 0); - m_pAddBar->SetDimension(0, t_h, v_width, a_h); - m_pProg->SetSize(0, v_height - p_h, v_width, p_h, 0); - } - wxSize s = GetClientSize(); - s.y -= a_h + p_h + t_h; - if (m_pView) { - m_pView->SetSize(0, a_h+t_h, s.x, s.y, 0); - m_pAddBar->SetDimension(0, 0, s.x, a_h); - m_pAddBar->SetDimension(0, 0, s.x, a_h); - m_pAddBar->Layout(); - m_pProg->SetSize(0, s.y+t_h+a_h, s.x, p_h, 0); - if (m_term) gf_term_set_size(m_term, s.x, s.y); - } -} - -void wxOsmo4Frame::OnSize(wxSizeEvent &event) -{ - DoLayout(); -} - -void wxOsmo4Frame::OnCloseApp(wxCloseEvent &WXUNUSED(event)) -{ - if (m_term) gf_term_del(m_term); - m_term = NULL; - Destroy(); -} - - -wxString wxOsmo4Frame::GetFileFilter() -{ - u32 keyCount, i; - wxString sFiles, sSupportedFiles, sExts; - - /*force MP4 and 3GP files at beginning to make sure they are selected (Win32 bug with too large filters)*/ - sSupportedFiles = wxT("All Known Files|*.m3u;*.pls;*.mp4;*.3gp;*.3g2"); - sExts = wxT(""); - sFiles = wxT(""); - keyCount = gf_cfg_get_key_count(m_user.config, "MimeTypes"); - for (i=0; i=0) continue; - /*if same extensions for # mime types skip (don't polluate the file list)*/ - if (sExts.Find(wxString(szKeyList, wxConvUTF8) )>=0) continue; - - sExts += wxString(szKeyList, wxConvUTF8); - sExts += wxT(" "); - sFiles += wxString(sDesc, wxConvUTF8); - sFiles += wxT("|"); - - wxString sOpt = wxString(szKeyList, wxConvUTF8); - while (1) { - wxString ext = sOpt.BeforeFirst(' '); - if (ext.Find('.')<0) { - if (first) first = 0; - else sFiles += wxT(";"); - sFiles += wxT("*."); - sFiles += ext; - wxString sext = ext; - sext += wxT(";"); - if (sSupportedFiles.Find(sext)<0) { - sSupportedFiles += wxT(";*."); - sSupportedFiles += ext; - } - } - if (sOpt==ext) break; - wxString rem = ext + wxT(" "); - sOpt.Replace(rem, wxT(""), TRUE); - } - sFiles += wxT("|"); - } - sSupportedFiles += wxT("|"); - sSupportedFiles += sFiles; - sSupportedFiles += wxT("M3U Playlists|*.m3u|ShoutCast Playlists|*.pls|All Files|*.*||"); - return sSupportedFiles; -} - -void wxOsmo4Frame::OnFileOpen(wxCommandEvent & WXUNUSED(event)) -{ - wxFileDialog dlg(this, wxT("Select file(s)"), wxT(""), wxT(""), GetFileFilter(), wxOPEN | wxMULTIPLE | wxCHANGE_DIR /*| wxHIDE_READONLY*/); - - if (dlg.ShowModal() != wxID_OK) return; - - wxArrayString stra; - dlg.GetPaths(stra); - if (stra.GetCount() == 1) { - m_pPlayList->Truncate(); - } else { - m_pPlayList->Clear(); - } - for (u32 i=0; iQueueURL(stra[i]); - - m_pPlayList->RefreshList(); - m_pPlayList->PlayNext(); -} - -void wxOsmo4Frame::OnFileOpenURL(wxCommandEvent & WXUNUSED(event)) -{ - OpenURLDlg dlg(this, m_user.config); - if (dlg.ShowModal()==wxID_OK) { - m_pPlayList->Truncate(); - m_pPlayList->QueueURL(dlg.m_urlVal); - m_pPlayList->RefreshList(); - m_pPlayList->PlayNext(); - } -} - -void wxOsmo4Frame::OnFileProperties(wxCommandEvent & WXUNUSED(event)) -{ - wxFileProps dlg(this); - dlg.SetIcon(wxIcon(osmo4)); - dlg.ShowModal(); -} - -void wxOsmo4Frame::OnFileReload(wxCommandEvent & WXUNUSED(event)) -{ - gf_term_disconnect(m_term); - m_connected = 0; - DoConnect(); -} - -void wxOsmo4Frame::OnFileReloadConfig(wxCommandEvent & WXUNUSED(event)) -{ - gf_term_set_option(m_term, GF_OPT_RELOAD_CONFIG, 1); -} - -void wxOsmo4Frame::OnFileQuit(wxCommandEvent & WXUNUSED(event)) -{ - Close(FALSE); -} - -void wxOsmo4Frame::OnViewOriginal(wxCommandEvent & WXUNUSED(event)) -{ - if (!m_bExternalView) { - DoLayout(m_orig_width, m_orig_height); - } else { - gf_term_set_option(m_term, GF_OPT_ORIGINAL_VIEW, 1); - } -} - -void wxOsmo4Frame::OnOptions(wxCommandEvent & WXUNUSED(event)) -{ - wxGPACControl dlg(this); - dlg.SetIcon(wxIcon(osmo4)); - dlg.ShowModal(); -} - -void wxOsmo4Frame::DoConnect() -{ - //if (m_connected) { gf_term_disconnect(m_term); m_connected = 0; } - - wxString url = m_pPlayList->GetURL(); - m_Address->SetValue(url); -#ifdef __WXGTK__ - m_pVisual->SetFocus(); -#else - m_pView->SetFocus(); -#endif - wxString txt = wxT("Osmo4 - "); - txt += m_pPlayList->GetDisplayName(); - SetTitle(txt); - m_bStartupFile = 0; - gf_term_connect(m_term, url.mb_str(wxConvUTF8)); -} - -void wxOsmo4Frame::OnLogs(wxCommandEvent & WXUNUSED(event)) -{ - m_pLogs->Show(); -} - -void wxOsmo4Frame::OnUpdateNeedsConnect(wxUpdateUIEvent &event) -{ - event.Enable(m_connected ? 1 : 0); -} - -void wxOsmo4Frame::OnUpdatePlay(wxUpdateUIEvent &event) -{ - event.Enable( (m_connected || m_pPlayList->HasValidEntries()) ? 1 : 0); -} - -void wxOsmo4Frame::OnUpdateFullScreen(wxUpdateUIEvent &event) -{ - if (m_connected) { - event.Enable(1); - event.Check(gf_term_get_option(m_term, GF_OPT_FULLSCREEN) ? 1 : 0); - } else { - event.Enable(0); - } -} - -void wxOsmo4Frame::OnFullScreen(wxCommandEvent & WXUNUSED(event)) -{ - Bool isFS = gf_term_get_option(m_term, GF_OPT_FULLSCREEN) ? 1 : 0; - gf_term_set_option(m_term, GF_OPT_FULLSCREEN, isFS ? 0 : 1); -} - -void wxOsmo4Frame::OnViewARKeep(wxCommandEvent & WXUNUSED(event)) -{ - gf_term_set_option(m_term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_KEEP); -} -void wxOsmo4Frame::OnViewARFill(wxCommandEvent & WXUNUSED(event)) -{ - gf_term_set_option(m_term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_FILL_SCREEN); -} -void wxOsmo4Frame::OnViewAR169(wxCommandEvent & WXUNUSED(event)) -{ - gf_term_set_option(m_term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_16_9); -} -void wxOsmo4Frame::OnViewAR43(wxCommandEvent & WXUNUSED(event)) -{ - gf_term_set_option(m_term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_4_3); -} - -void wxOsmo4Frame::OnUpdateAR(wxUpdateUIEvent &event) -{ - if (!m_connected) { - event.Enable(0); - return; - } - event.Enable(1); - u32 val = gf_term_get_option(m_term, GF_OPT_ASPECT_RATIO); - if ((event.GetId() == VIEW_AR_FILL) && (val==GF_ASPECT_RATIO_FILL_SCREEN)) - event.Check(1); - else if ((event.GetId() == VIEW_AR_KEEP) && (val==GF_ASPECT_RATIO_KEEP)) - event.Check(1); - else if ((event.GetId() == VIEW_AR_169) && (val==GF_ASPECT_RATIO_16_9)) - event.Check(1); - else if ((event.GetId() == VIEW_AR_43) && (val==GF_ASPECT_RATIO_4_3)) - event.Check(1); - else event.Check(0); -} - -void wxOsmo4Frame::OnShortcuts(wxCommandEvent & WXUNUSED(event)) -{ - wxMessageDialog dlg(this, - wxT("Shortcuts with focus on main frame:\n") - wxT("Open File: Ctrl + O\n") - wxT("Show File Information: Ctrl + I\n") - wxT("Reload File: Ctrl + R\n") - wxT("Pause/Resume File: Ctrl + P\n") - wxT("Step by Step: Ctrl + S\n") - wxT("Fullscreen On/Off: Alt + Return\n") - wxT("View Playlist: Ctrl + L\n") - wxT("Aspect Ratio Normal: Ctrl + 1\n") - wxT("Aspect Ratio Fill: Ctrl + 2\n") - wxT("Aspect Ratio 4/3: Ctrl + 3\n") - wxT("Aspect Ratio 16/9: Ctrl + 4\n") - wxT("\n") - wxT("Shortcuts with focus on video frame:\n") - wxT("Seek +5% into presentation: Alt + right arrow\n") - wxT("Seek -5% into presentation: Alt + left arrow\n") - wxT("Seek +1min into presentation: Alt + up arrow\n") - wxT("Seek -1min into presentation: Alt + down arrow\n") - wxT("Next Playlist Entry: Ctrl + right arrow\n") - wxT("Prev Playlist Entry: Ctrl + left arrow\n") - - , wxT("Shortcuts Available on Osmo4") - , wxOK); - - dlg.ShowModal(); -} - -void wxOsmo4Frame::OnNavInfo(wxCommandEvent & WXUNUSED(event)) -{ - wxMessageDialog dlg(this, - wxT("* Walk & Fly modes:\n") - wxT("\tH move: H pan - V move: Z-translate - V move+CTRL or Wheel: V pan - Right Click (Walk only): Jump\n") - wxT("\tleft/right: H pan - left/right+CTRL: H translate - up/down: Z-translate - up/down+CTRL: V pan\n") - wxT("* Pan mode:\n") - wxT("\tH move: H pan - V move: V pan - V move+CTRL or Wheel: Z-translate\n") - wxT("\tleft/right: H pan - left/right+CTRL: H translate - up/down: V pan - up/down+CTRL: Z-translate\n") - wxT("* Slide mode:\n") - wxT("\tH move: H translate - V move: V translate - V move+CTRL or Wheel: Z-translate\n") - wxT("\tleft/right: H translate - left/right+CTRL: H pan - up/down: V translate - up/down+CTRL: Z-translate\n") - wxT("* Examine & Orbit mode:\n") - wxT("\tH move: Y-Axis rotate - H move+CTRL: No move - V move: X-Axis rotate - V move+CTRL or Wheel: Z-translate\n") - wxT("\tleft/right: Y-Axis rotate - left/right+CTRL: H translate - up/down: X-Axis rotate - up/down+CTRL: Y-translate\n") - wxT("* VR mode:\n") - wxT("\tH move: H pan - V move: V pan - V move+CTRL or Wheel: Camera Zoom\n") - wxT("\tleft/right: H pan - up/down: V pan - up/down+CTRL: Camera Zoom\n") - wxT("* Game mode (press END to escape):\n") - wxT("\tH move: H pan - V move: V pan\n") - wxT("\tleft/right: H translate - up/down: Z-translate\n") - wxT("\n") - wxT("* All 3D modes: CTRL+PGUP/PGDOWN will zoom in/out camera (field of view) \n") - wxT("\n") - wxT("*Slide Mode in 2D:\n") - wxT("\tH move: H translate - V move: V translate - V move+CTRL: zoom\n") - wxT("\tleft/right: H translate - up/down: V translate - up/down+CTRL: zoom\n") - wxT("*Examine Mode in 2D (3D renderer only):\n") - wxT("\tH move: Y-Axis rotate - V move: X-Axis rotate\n") - wxT("\tleft/right: Y-Axis rotate - up/down: X-Axis rotate\n") - wxT("\n") - wxT("HOME: reset navigation to last viewpoint (2D or 3D navigation)\n") - wxT("SHIFT key in all modes: fast movement\n") - - , wxT("3D navigation keys (\'H\'orizontal and \'V\'ertical) used in GPAC") - , wxOK ); - dlg.ShowModal(); -} - - -/*open file dlg*/ -class AboutDlg : public wxDialog { -public: - AboutDlg(wxWindow *parent); - -private: - wxStaticText *m_info; - wxButton *m_close; - void OnClose(wxCommandEvent& event); - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE(AboutDlg, wxDialog) - EVT_BUTTON(ID_ABOUT_CLOSE, AboutDlg::OnClose) -END_EVENT_TABLE() - -AboutDlg::AboutDlg(wxWindow *parent) - : wxDialog(parent, -1, wxString(wxT("GPAC/Osmo4 V ")wxT(GPAC_FULL_VERSION))) -{ - SetSize(220, 320); - Centre(); - wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - - m_info = new wxStaticText(this, -1, wxT("http://gpac.sourceforge.net"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE); - sizer->Add(m_info, 1, wxEXPAND|wxADJUST_MINSIZE, 0); - m_close = new wxButton(this, ID_ABOUT_CLOSE, wxT("Close"), wxDefaultPosition, wxSize(120, 20)); - sizer->Add(m_close, 0, wxEXPAND, 0); - - SetIcon(wxIcon(osmo4)); - m_info->SetLabel( - wxT("Osmo4 Player\n") - wxT("GPAC Multimedia Framework\n") - wxT("\n") - wxT("This program is gf_free software and may\n") - wxT("be distributed according to the terms\n") - wxT("of the GNU Lesser General Public License\n") - wxT("\n") - wxT("Copyright (c) Jean Le Feuvre 2000-2005\n") - wxT("(c) ENST 2005-200X\n") - wxT("All Rights Reserved\n") - wxT("http://gpac.sourceforge.net\n") - wxT("\n") - wxT(" ** With Many Thanks To ** \n\n") - wxT("Mozilla SpiderMonkey (JavaScript)\n") - wxT("The FreeType Project\n") - wxT("The PNG Group, The I.J.G.\n") - wxT("FFMPEG, FAAD, XVID, MAD\n") - ); - - SetSizer(sizer); - sizer->Fit(this); -} -void AboutDlg::OnClose(wxCommandEvent& WXUNUSED(event)) -{ - Close(FALSE); -} - -void wxOsmo4Frame::OnAbout(wxCommandEvent & WXUNUSED(event)) -{ - AboutDlg dlg(this); - dlg.ShowModal(); -} - - -void wxOsmo4Frame::OnGPACEvent(wxGPACEvent &event) -{ - wxString cmd; - wxCommandEvent evt; - if (!m_term) return; - - switch (event.gpac_evt.type) { - case GF_EVENT_NAVIGATE: - if (gf_term_is_supported_url(m_term, event.to_url.mb_str(wxConvUTF8), 1, 0)) { - char *str = gf_url_concatenate(m_pPlayList->GetURL().mb_str(wxConvUTF8), event.to_url.mb_str(wxConvUTF8)); - if (str) { - m_pPlayList->Truncate(); - m_pPlayList->QueueURL(wxString(str, wxConvUTF8)); - m_pPlayList->RefreshList(); - gf_free(str); - m_pPlayList->PlayNext(); - } - return; - } - cmd = get_pref_browser(m_user.config); - if (cmd.IsEmpty()){ - cmd += wxT(" "); - cmd += event.to_url; - wxExecute(cmd); - } else { -#ifdef wxLaunchDefaultBrowser - wxLaunchDefaultBrowser(event.to_url); -#endif - } - break; - case GF_EVENT_QUIT: - Close(TRUE); - break; - case GF_EVENT_SET_CAPTION: - SetTitle(event.to_url); - break; - case GF_EVENT_CONNECT: - BuildStreamList(0); - ConnectAcknowledged(event.gpac_evt.connect.is_connected); - break; - case GF_EVENT_KEYDOWN: - if (!(event.gpac_evt.key.flags & GF_KEY_MOD_CTRL)) return; - switch (event.gpac_evt.key.key_code) { - case GF_KEY_R: - gf_term_set_option(m_term, GF_OPT_REFRESH, 1); - break; - case GF_KEY_P: - OnFilePlay(evt); - break; - case GF_KEY_S: - OnFileStep(evt); - break; - } - break; - case GF_EVENT_SCENE_SIZE: - m_orig_width = event.gpac_evt.size.width; - m_orig_height = event.gpac_evt.size.height; - case GF_EVENT_SIZE: - if (! gf_term_get_option(m_term, GF_OPT_FULLSCREEN)) { - DoLayout(event.gpac_evt.size.width, event.gpac_evt.size.height); - } - break; - case GF_EVENT_VIEWPOINTS: - BuildViewList(); - break; - case GF_EVENT_STREAMLIST: - BuildStreamList(0); - break; - } -} - - -static wxString format_time(u32 duration, u32 timescale) -{ - u32 h, m, s; - Float time = duration; - time /= timescale; - time *= 1000; - h = (u32) (time / 1000 / 3600); - m = (u32) (time / 1000 / 60 - h*60); - s = (u32) (time / 1000 - h*3600 - m*60); - return wxString::Format(wxT("%02d:%02d:%02d"), h, m, s); -} - -void wxOsmo4Frame::SetStatus(wxString str) -{ - //m_pStatusbar->SetStatusText(str, 2); - m_LastStatusTime = gf_sys_clock(); -} - -#define RTI_REFRESH_MS 500 -void wxOsmo4Frame::OnRTI(wxCommandEvent & event) -{ - m_bViewRTI = event.IsChecked(); - if (m_bViewRTI) { - if (!m_pTimer->IsRunning()) m_pTimer->Start(RTI_REFRESH_MS, 0); - } else if (!m_connected && m_pTimer->IsRunning()) { - m_LastStatusTime = 0; - m_pStatusbar->SetStatusText(wxT("Ready"), 2); - m_pTimer->Stop(); - } -} - -void wxOsmo4Frame::OnTimer(wxTimerEvent& WXUNUSED(event)) -{ - wxString str; - u32 now; - if (m_LastStatusTime) { - now = gf_sys_clock(); - if (now > 1000+m_LastStatusTime) { - m_LastStatusTime = 0; - m_pStatusbar->SetStatusText(wxT("Ready"), 2); - } - } - - if (m_bViewRTI) { - GF_SystemRTInfo rti; - if (!gf_sys_get_rti(RTI_REFRESH_MS, &rti, 0)) return; - if (rti.gpac_memory) rti.process_memory = rti.gpac_memory; - - str = wxString::Format(wxT("CPU %02d (%02d) - Mem %d kB" ), - rti.total_cpu_usage, rti.process_cpu_usage, rti.gpac_memory/1024); - - m_pStatusbar->SetStatusText(str, 2); - } - if (!m_connected) return; - - now = gf_term_get_time_in_ms(m_term); - if (!now) return; - - if (!m_duration) { - str = format_time(now, 1000); - m_pStatusbar->SetStatusText(str); - str = wxString::Format(wxT("FPS %.2f"), gf_term_get_framerate(m_term, 0)); - m_pStatusbar->SetStatusText(str, 1); - return; - } -#ifdef __WXGTK__ - if (m_bGrabbed) { - u32 now = gf_sys_clock() - m_last_grab_time; - if (now>200) { - m_bGrabbed = 0; - Double res = (Double) m_last_grab_pos; - res /= 1000; - res *= m_duration; - if (gf_term_get_option(m_term, GF_OPT_PLAY_STATE)==GF_STATE_PAUSED) { - gf_term_set_option(m_term, GF_OPT_PLAY_STATE, GF_STATE_PLAYING); - m_bToReset = 0; - } - gf_term_play_from_time(m_term, (u32) res, 0); - return; - } - } -#endif - - if (!m_bGrabbed) { - if ((now >= m_duration + 500) && gf_term_get_option(m_term, GF_OPT_IS_FINISHED)) { - m_pPlayList->PlayNext(); - } else { - Double val = now * 1000; - val /= m_duration; - m_pProg->SetValue((val<=1000) ? (u32) val : 1000); - - if (0) { - str = format_time(m_duration-now, 1000); - } else { - str = format_time(now, 1000); - } - m_pStatusbar->SetStatusText(str); - str = wxString::Format(wxT("FPS %.2f"), gf_term_get_framerate(m_term, 0)); - m_pStatusbar->SetStatusText(str, 1); - } - } -} - -void wxOsmo4Frame::ConnectAcknowledged(Bool bOk) -{ - if (bOk) { - m_pTimer->Start(RTI_REFRESH_MS, 0); - m_connected = 1; - m_bToReset = 0; - UpdatePlay(); - BuildChapterList(0); - } else { - BuildChapterList(1); - if (!m_connected) { - UpdatePlay(); - m_pTimer->Stop(); - //m_pProg->Enable(0); - } - } -} - -void wxOsmo4Frame::OnFilePlay(wxCommandEvent & WXUNUSED(event)) -{ - wxCommandEvent evt; - if (m_connected) { - if (gf_term_get_option(m_term, GF_OPT_PLAY_STATE)==GF_STATE_PAUSED) { - gf_term_set_option(m_term, GF_OPT_PLAY_STATE, GF_STATE_PLAYING); - if (m_bToReset) { - m_pTimer->Start(100, 0); - gf_term_play_from_time(m_term, 0, 0); - } - m_bToReset = 0; - UpdatePlay(); - } else { - gf_term_set_option(m_term, GF_OPT_PLAY_STATE, GF_STATE_PAUSED); - UpdatePlay(); - } - } else { - m_pPlayList->Play(); - } -} - -void wxOsmo4Frame::OnFileStep(wxCommandEvent & WXUNUSED(event)) -{ - wxCommandEvent evt; - gf_term_set_option(m_term, GF_OPT_PLAY_STATE, GF_STATE_STEP_PAUSE); - UpdatePlay(); -} - -void wxOsmo4Frame::OnFileStop(wxCommandEvent &WXUNUSED(event)) -{ - Stop(); -} - -void wxOsmo4Frame::Stop() -{ - if (gf_term_get_option(m_term, GF_OPT_PLAY_STATE)==GF_STATE_PLAYING) { - gf_term_set_option(m_term, GF_OPT_PLAY_STATE, GF_STATE_PAUSED); - } - m_bToReset = 1; - m_pTimer->Stop(); - m_pProg->SetValue(0); - UpdatePlay(); -} - -void wxOsmo4Frame::OnSlide(wxScrollEvent &event) -{ - if (!m_duration) return; - - /*wxSlider on GTK is buggy, so track a release timeout*/ -#ifdef __WXGTK__ - m_last_grab_time = gf_sys_clock(); - m_bGrabbed = 1; - m_last_grab_pos = event.GetPosition(); - Double now = (Double) m_last_grab_pos; - now /= 1000; - now *= m_duration; - wxString str = format_time((u32) (now), 1000); - m_pStatusbar->SetStatusText(str); - if (!m_pTimer->IsRunning()) m_pTimer->Start(100, 0); -#else - s32 type = event.GetEventType(); - if (type == wxEVT_SCROLL_THUMBTRACK) { - m_bGrabbed = 1; - Double now = (Double) event.GetPosition(); - now /= 1000; - now *= m_duration; - wxString str = format_time((u32) (now), 1000); - m_pStatusbar->SetStatusText(str); - } - else if (m_bGrabbed){ - m_bGrabbed = 0; - Double res = (Double) m_pProg->GetValue(); - res /= 1000; - res *= m_duration; - if (gf_term_get_option(m_term, GF_OPT_PLAY_STATE)==GF_STATE_PAUSED) { - gf_term_set_option(m_term, GF_OPT_PLAY_STATE, GF_STATE_PLAYING); - m_bToReset = 0; - if (!m_pTimer->IsRunning()) m_pTimer->Start(100, 0); - } - gf_term_play_from_time(m_term, (u32) res, 0); - } -#endif -} - - -void wxOsmo4Frame::BuildViewList() -{ - if (!vp_list || !m_connected) return; - - while (vp_list->GetMenuItemCount()) { - wxMenuItem* it = vp_list->FindItemByPosition(0); - vp_list->Delete(it); - } - - s32 id = ID_VIEWPOINT_FIRST; - nb_viewpoints = 0; - while (1) { - const char *szName; - Bool bound; - GF_Err e = gf_term_get_viewpoint(m_term, nb_viewpoints+1, &szName, &bound); - if (e) break; - if (szName) { - vp_list->AppendCheckItem(id+nb_viewpoints, wxString(szName, wxConvUTF8) ); - } else { - vp_list->AppendCheckItem(id+nb_viewpoints, wxString::Format(wxT("Viewpoint #%d"), nb_viewpoints+1) ); - } - nb_viewpoints++; - } -} - -void wxOsmo4Frame::OnViewport(wxCommandEvent & event) -{ - u32 ID = event.GetId() - ID_VIEWPOINT_FIRST; - gf_term_set_viewpoint(m_term, ID+1, NULL); -} - -void wxOsmo4Frame::OnUpdateViewport(wxUpdateUIEvent & event) -{ - u32 ID = event.GetId() - ID_VIEWPOINT_FIRST; - const char *szName; - Bool bound; - gf_term_get_viewpoint(m_term, ID+1, &szName, &bound); - event.Enable(1); - if (bound) event.Check(1); -} - -void wxOsmo4Frame::OnNavigate(wxCommandEvent & event) -{ - switch (event.GetId()) { - case ID_NAVIGATE_NONE: gf_term_set_option(m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_NONE); break; - case ID_NAVIGATE_WALK: gf_term_set_option(m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_WALK); break; - case ID_NAVIGATE_FLY: gf_term_set_option(m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_FLY); break; - case ID_NAVIGATE_EXAMINE: gf_term_set_option(m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_EXAMINE); break; - case ID_NAVIGATE_PAN: gf_term_set_option(m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_PAN); break; - case ID_NAVIGATE_SLIDE: gf_term_set_option(m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_SLIDE); break; - case ID_NAVIGATE_ORBIT: gf_term_set_option(m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_ORBIT); break; - case ID_NAVIGATE_GAME: gf_term_set_option(m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_GAME); break; - } -} -void wxOsmo4Frame::OnNavigateReset(wxCommandEvent & WXUNUSED(event)) -{ - gf_term_set_option(m_term, GF_OPT_NAVIGATION_TYPE, 0); -} -void wxOsmo4Frame::OnUpdateNavigation(wxUpdateUIEvent & event) -{ - u32 ID = event.GetId(); - event.Enable(0); - if (!m_connected) return; - u32 type = gf_term_get_option(m_term, GF_OPT_NAVIGATION_TYPE); - bool enable = type ? 1 : 0; - - u32 mode = gf_term_get_option(m_term, GF_OPT_NAVIGATION); - /*common 2D/3D modes*/ - if (ID==ID_NAVIGATE_NONE) { event.Enable(enable); event.Check(mode ? 0 : 1); } - else if (ID==ID_NAVIGATE_EXAMINE) { event.Enable(enable); event.Check((mode==GF_NAVIGATE_EXAMINE) ? 1 : 0); } - else if (ID==ID_NAVIGATE_SLIDE) { event.Enable(enable); event.Check((mode==GF_NAVIGATE_SLIDE) ? 1 : 0); } - - if (type==GF_NAVIGATE_TYPE_2D) return; - event.Enable(enable); - if (ID==ID_NAVIGATE_WALK) event.Check((mode==GF_NAVIGATE_WALK) ? 1 : 0); - else if (ID==ID_NAVIGATE_FLY) event.Check((mode==GF_NAVIGATE_FLY) ? 1 : 0); - else if (ID==ID_NAVIGATE_PAN) event.Check((mode==GF_NAVIGATE_PAN) ? 1 : 0); - else if (ID==ID_NAVIGATE_ORBIT) event.Check((mode==GF_NAVIGATE_ORBIT) ? 1 : 0); - else if (ID==ID_NAVIGATE_GAME) event.Check((mode==GF_NAVIGATE_GAME) ? 1 : 0); -} - -void wxOsmo4Frame::OnRenderSwitch(wxCommandEvent &WXUNUSED(event)) -{ - const char *opt = gf_cfg_get_key(m_user.config, "Compositor", "ForceOpenGL"); - Bool use_gl = (opt && !stricmp(opt, "yes")) ? 1 : 0; - gf_cfg_set_key(m_user.config, "Compositor", "ForceOpenGL", use_gl ? "no" : "yes"); - - gf_term_set_option(m_term, GF_OPT_USE_OPENGL, !use_gl); - - UpdateRenderSwitch(); -} - -void wxOsmo4Frame::UpdateRenderSwitch() -{ - const char *opt = gf_cfg_get_key(m_user.config, "Compositor", "ForceOpenGL"); - m_pToolBar->RemoveTool(SWITCH_RENDER); - if (opt && !stricmp(opt, "yes")) - m_pToolBar->InsertTool(12, SWITCH_RENDER, *m_pSW2D, wxNullBitmap, FALSE, NULL, wxT("2D Rasterizer")); - else - m_pToolBar->InsertTool(12, SWITCH_RENDER, *m_pSW3D, wxNullBitmap, FALSE, NULL, wxT("OpenGL Rendering")); - -#ifdef WIN32 - /*there's a display bug with the menubtn, remove and reinsert*/ - m_pToolBar->RemoveTool(FILE_PREV); - m_pToolBar->RemoveTool(FILE_NEXT); - m_pToolBar->InsertControl(2, m_pPrevBut); - m_pToolBar->InsertControl(3, m_pNextBut); -#endif - m_pToolBar->Realize(); -} - -void wxOsmo4Frame::UpdatePlay() -{ - m_pToolBar->RemoveTool(FILE_PLAY); - if (m_connected) { - if (gf_term_get_option(m_term, GF_OPT_PLAY_STATE)==GF_STATE_PAUSED) - m_pToolBar->InsertTool(5, FILE_PLAY, *m_pPlay, wxNullBitmap, FALSE, NULL, wxT("Pause File")); - else - m_pToolBar->InsertTool(5, FILE_PLAY, *m_pPause, wxNullBitmap, FALSE, NULL, wxT("Play File")); - } else { - m_pToolBar->InsertTool(5, FILE_PLAY, *m_pPlay, wxNullBitmap, FALSE, NULL, wxT("Pause File")); - } - -#ifdef WIN32 - /*there's a display bug with the menubtn, remove and reinsert*/ - m_pToolBar->RemoveTool(FILE_PREV); - m_pToolBar->RemoveTool(FILE_NEXT); - m_pToolBar->InsertControl(2, m_pPrevBut); - m_pToolBar->InsertControl(3, m_pNextBut); -#endif - m_pToolBar->Realize(); -} - -void wxOsmo4Frame::OnCollide(wxCommandEvent & event) -{ - u32 ID = event.GetId(); - if (ID==ID_COLLIDE_NONE) gf_term_set_option(m_term, GF_OPT_COLLISION, GF_COLLISION_NONE); - else if (ID==ID_COLLIDE_REG) gf_term_set_option(m_term, GF_OPT_COLLISION, GF_COLLISION_NORMAL); - else if (ID==ID_COLLIDE_DISP) gf_term_set_option(m_term, GF_OPT_COLLISION, GF_COLLISION_DISPLACEMENT); -} -void wxOsmo4Frame::OnUpdateCollide(wxUpdateUIEvent & event) -{ - u32 ID = event.GetId(); - event.Enable(0); - if (!m_connected) return; - event.Enable(1); - u32 mode = gf_term_get_option(m_term, GF_OPT_COLLISION); - if (ID==ID_COLLIDE_NONE) { event.Check((mode==GF_COLLISION_NONE) ? 1 : 0); } - else if (ID==ID_COLLIDE_REG) { event.Check((mode==GF_COLLISION_NORMAL) ? 1 : 0); } - else if (ID==ID_COLLIDE_DISP) { event.Check((mode==GF_COLLISION_DISPLACEMENT) ? 1 : 0); } -} - -void wxOsmo4Frame::OnHeadlight(wxCommandEvent &WXUNUSED(event)) -{ - Bool val = !gf_term_get_option(m_term, GF_OPT_HEADLIGHT); - gf_term_set_option(m_term, GF_OPT_HEADLIGHT, val); -} -void wxOsmo4Frame::OnUpdateHeadlight(wxUpdateUIEvent & event) -{ - event.Enable(0); - if (!m_connected) return; - u32 type = gf_term_get_option(m_term, GF_OPT_NAVIGATION_TYPE); - if (type!=GF_NAVIGATE_TYPE_3D) return; - - event.Enable(1); - event.Check(gf_term_get_option(m_term, GF_OPT_HEADLIGHT) ? 1 : 0); -} -void wxOsmo4Frame::OnGravity(wxCommandEvent & WXUNUSED(event)) -{ - Bool val = gf_term_get_option(m_term, GF_OPT_GRAVITY) ? 0 : 1; - gf_term_set_option(m_term, GF_OPT_GRAVITY, val); -} -void wxOsmo4Frame::OnUpdateGravity(wxUpdateUIEvent & event) -{ - event.Enable(0); - if (!m_connected) return; - u32 type = gf_term_get_option(m_term, GF_OPT_NAVIGATION_TYPE); - if (type!=GF_NAVIGATE_TYPE_3D) return; - type = gf_term_get_option(m_term, GF_OPT_NAVIGATION); - if (type != GF_NAVIGATE_WALK) return; - event.Enable(1); - event.Check(gf_term_get_option(m_term, GF_OPT_GRAVITY) ? 1 : 0); -} - - -BEGIN_EVENT_TABLE(wxMyComboBox, wxComboBox) - EVT_KEY_UP(wxMyComboBox::OnKeyUp) -END_EVENT_TABLE() - -void wxMyComboBox::OnKeyUp(wxKeyEvent &event) -{ - if (event.GetKeyCode()==WXK_RETURN) { - event.Skip(); - wxCommandEvent evt; - evt.SetEventType(wxEVT_COMMAND_COMBOBOX_SELECTED); - evt.SetEventObject(this); - evt.SetId(GetId()); - GetParent()->AddPendingEvent(evt); - } -} - - -void wxOsmo4Frame::ReloadURLs() -{ - const char *sOpt; - u32 i=0; - - m_Address->Clear(); - while (1) { - sOpt = gf_cfg_get_key_name(m_user.config, "RecentFiles", i); - if (!sOpt) break; - m_Address->Append(wxString(sOpt, wxConvUTF8) ); - i++; - } -} - -void wxOsmo4Frame::SelectionReady() -{ - wxString urlVal = m_Address->GetValue(); - if (urlVal.Find(wxT("://"))>0) { - UpdateLastFiles(m_user.config, urlVal.mb_str(wxConvUTF8)); - ReloadURLs(); - } - m_pPlayList->Truncate(); - m_pPlayList->QueueURL(urlVal); - m_pPlayList->RefreshList(); - m_pPlayList->PlayNext(); -} - -void wxOsmo4Frame::OnURLSelect(wxCommandEvent &WXUNUSED(event)) -{ - SelectionReady(); -} - -void wxOsmo4Frame::OnPlaylist(wxCommandEvent &WXUNUSED(event)) -{ - assert(m_pPlayList); - m_pPlayList->Show(m_pPlayList->IsShown() ? 0 : 1); -} - -void wxOsmo4Frame::OnUpdatePlayList(wxUpdateUIEvent & event) -{ - event.Enable(1); - event.Check(m_pPlayList->IsShown() ? 1 : 0); -} - -void wxOsmo4Frame::OnFilePrevOpen(wxNotifyEvent & event) -{ - u32 count = gf_list_count(m_pPlayList->m_entries); - u32 start = m_pPlayList->m_cur_entry - 1; - wxMenu *popup = new wxMenu(); - - for (u32 i=0; i<10; i++) { - if (i > start) break; - if (start - i >= count) break; - PLEntry *ple = (PLEntry *) gf_list_get(m_pPlayList->m_entries, start - i); - popup->Append(ID_NAV_PREV_0 + i, wxString(ple->m_disp_name, wxConvUTF8) ); - } - m_pPrevBut->AssignMenu(popup); -} - -void wxOsmo4Frame::OnFileNextOpen(wxNotifyEvent & event) -{ - u32 count = gf_list_count(m_pPlayList->m_entries); - wxMenu *popup = new wxMenu(); - u32 start = m_pPlayList->m_cur_entry + 1; - for (u32 i=0; i<10; i++) { - if (start + i >= count) break; - PLEntry *ple = (PLEntry *) gf_list_get(m_pPlayList->m_entries, start + i); - popup->Append(ID_NAV_NEXT_0 + i, wxString(ple->m_disp_name, wxConvUTF8) ); - } - m_pNextBut->AssignMenu(popup); -} - -void wxOsmo4Frame::OnNavPrev(wxCommandEvent &WXUNUSED(event)) -{ - if (m_pPlayList->m_cur_entry<=0) return; - m_pPlayList->PlayPrev(); -} -void wxOsmo4Frame::OnUpdateNavPrev(wxUpdateUIEvent & event) -{ - if (m_pPlayList->m_cur_entry<=0) event.Enable(0); - else event.Enable(TRUE); -} -void wxOsmo4Frame::OnNavPrevMenu(wxCommandEvent &event) -{ - u32 ID = event.GetId() - ID_NAV_PREV_0; - s32 prev = m_pPlayList->m_cur_entry - ID; - if (prev>=0) { - m_pPlayList->m_cur_entry = prev; - m_pPlayList->PlayPrev(); - } -} -void wxOsmo4Frame::OnNavNext(wxCommandEvent &WXUNUSED(event)) -{ - /*don't play if last could trigger playlist loop*/ - if ((m_pPlayList->m_cur_entry<0) || (gf_list_count(m_pPlayList->m_entries) == 1 + (u32) m_pPlayList->m_cur_entry)) return; - m_pPlayList->PlayNext(); -} -void wxOsmo4Frame::OnUpdateNavNext(wxUpdateUIEvent & event) -{ - if (m_pPlayList->m_cur_entry<0) event.Enable(0); - else if ((u32) m_pPlayList->m_cur_entry + 1 == gf_list_count(m_pPlayList->m_entries) ) event.Enable(0); - else event.Enable(1); -} - -void wxOsmo4Frame::OnNavNextMenu(wxCommandEvent &event) -{ - u32 ID = event.GetId() - ID_NAV_NEXT_0; - s32 next = m_pPlayList->m_cur_entry + ID; - if (next < (s32) gf_list_count(m_pPlayList->m_entries) ) { - m_pPlayList->m_cur_entry = next; - m_pPlayList->PlayNext(); - } -} - -void wxOsmo4Frame::OnClearNav(wxCommandEvent &WXUNUSED(event)) -{ - m_pPlayList->ClearButPlaying(); -} - - -void wxOsmo4Frame::BuildStreamList(Bool reset_only) -{ - u32 nb_subs; - wxMenu *pMenu; - - pMenu = sel_menu->FindItemByPosition(0)->GetSubMenu(); - while (pMenu->GetMenuItemCount()) { - wxMenuItem* it = pMenu->FindItemByPosition(0); - pMenu->Delete(it); - } - pMenu = sel_menu->FindItemByPosition(1)->GetSubMenu(); - while (pMenu->GetMenuItemCount()) { - wxMenuItem* it = pMenu->FindItemByPosition(0); - pMenu->Delete(it); - } - pMenu = sel_menu->FindItemByPosition(2)->GetSubMenu(); - while (pMenu->GetMenuItemCount()) { - wxMenuItem* it = pMenu->FindItemByPosition(0); - pMenu->Delete(it); - } - - if (reset_only) { - m_bFirstStreamListBuild = 1; - return; - } - - if (!gf_term_get_option(m_term, GF_OPT_CAN_SELECT_STREAMS)) return; - - nb_subs = 0; - GF_ObjectManager *root_od = gf_term_get_root_object(m_term); - if (!root_od) return; - u32 count = gf_term_get_object_count(m_term, root_od); - - for (u32 i=0; iFindItemByPosition(0)->GetSubMenu(); - if (!info.owns_service) sprintf(szLabel, "Audio #"LLU, (u64)pMenu->GetMenuItemCount() + 1); - pMenu->AppendCheckItem(ID_SELSTREAM_0 +i, wxString(szLabel, wxConvUTF8)); - break; - case GF_STREAM_VISUAL: - pMenu = sel_menu->FindItemByPosition(1)->GetSubMenu(); - if (!info.owns_service) sprintf(szLabel, "Video #"LLU, (u64)pMenu->GetMenuItemCount() + 1); - pMenu->AppendCheckItem(ID_SELSTREAM_0 +i, wxString(szLabel, wxConvUTF8)); - break; - case GF_STREAM_TEXT: - nb_subs ++; - pMenu = sel_menu->FindItemByPosition(2)->GetSubMenu(); - if (!info.owns_service) sprintf(szLabel, "Subtitle #"LLU, (u64)pMenu->GetMenuItemCount() + 1); - pMenu->AppendCheckItem(ID_SELSTREAM_0 +i, wxString(szLabel, wxConvUTF8)); - break; - } - } - if (m_bFirstStreamListBuild) { - m_bFirstStreamListBuild = 0; - if (!nb_subs && m_lookforsubs) LookForSubtitles(); - } -} - -void wxOsmo4Frame::OnStreamSel(wxCommandEvent & event) -{ - GF_ObjectManager *root_od = gf_term_get_root_object(m_term); - if (!root_od) return; - u32 ID = event.GetId() - ID_SELSTREAM_0; - GF_ObjectManager *odm = gf_term_get_object(m_term, root_od, ID); - gf_term_select_object(m_term, odm); -} - -void wxOsmo4Frame::OnUpdateStreamSel(wxUpdateUIEvent & event) -{ - GF_ObjectManager *root_od = gf_term_get_root_object(m_term); - if (!root_od) return; - u32 ID = event.GetId() - ID_SELSTREAM_0; - - GF_ObjectManager *odm = gf_term_get_object(m_term, root_od, ID); - if (!odm) return; - - GF_MediaInfo info; - gf_term_get_object_info(m_term, odm, &info); - event.Enable(1); - event.Check(info.status ? 1 : 0); -} - -void wxOsmo4Frame::OnUpdateStreamMenu(wxUpdateUIEvent & event) -{ - if (!m_connected || !gf_term_get_option(m_term, GF_OPT_CAN_SELECT_STREAMS)) { - event.Enable(0); - } else { - event.Enable(1); - } -} - -void wxOsmo4Frame::OnAddSub(wxCommandEvent &WXUNUSED(event)) -{ - wxFileDialog dlg(this, wxT("Add Subtitle"), wxT(""), wxT(""), wxT("All Subtitles|*.srt;*.ttxt|SRT Subtitles|*.srt|3GPP TimedText|*.ttxt|"), wxOPEN | wxCHANGE_DIR /* | wxHIDE_READONLY*/); - - if (dlg.ShowModal() == wxID_OK) { - AddSubtitle(dlg.GetPath().mb_str(wxConvUTF8), 1); - } - -} - -void wxOsmo4Frame::AddSubtitle(const char *fileName, Bool auto_play) -{ - gf_term_add_object(m_term, fileName, auto_play); -} - -static Bool subs_enum_dir_item(void *cbck, char *item_name, char *item_path) -{ - wxOsmo4Frame *_this = (wxOsmo4Frame*)cbck; - _this->AddSubtitle(item_path, 0); - return 0; -} - -void wxOsmo4Frame::LookForSubtitles() -{ - char dir[GF_MAX_PATH]; - const char *url = m_pPlayList->GetURL().mb_str(wxConvUTF8); - strcpy(dir, url); - char *sep = strrchr(dir, '\\'); - if (!sep) strcpy(dir, ::wxGetCwd().mb_str(wxConvUTF8)); - else sep[0] = 0; - - gf_enum_directory(dir, 0, subs_enum_dir_item, this, "ttxt;srt"); -} - -void wxOsmo4Frame::OnCacheEnable(wxCommandEvent &WXUNUSED(event)) -{ - u32 state = gf_term_get_option(m_term, GF_OPT_MEDIA_CACHE); - if (state==GF_MEDIA_CACHE_DISABLED) { - gf_term_set_option(m_term, GF_OPT_MEDIA_CACHE, GF_MEDIA_CACHE_ENABLED); - } else if (state==GF_MEDIA_CACHE_DISABLED) { - gf_term_set_option(m_term, GF_OPT_MEDIA_CACHE, GF_MEDIA_CACHE_DISABLED); - } -} - -void wxOsmo4Frame::OnCacheStop(wxCommandEvent &WXUNUSED(event)) -{ - gf_term_set_option(m_term, GF_OPT_MEDIA_CACHE, GF_MEDIA_CACHE_DISABLED); -} - -void wxOsmo4Frame::OnCacheAbort(wxCommandEvent &WXUNUSED(event)) -{ - gf_term_set_option(m_term, GF_OPT_MEDIA_CACHE, GF_MEDIA_CACHE_DISCARD); -} - -void wxOsmo4Frame::OnUpdateCacheEnable(wxUpdateUIEvent & event) -{ - u32 state = gf_term_get_option(m_term, GF_OPT_MEDIA_CACHE); - switch (state) { - case GF_MEDIA_CACHE_ENABLED: - event.Enable(1); - event.SetText(wxT("Enabled")); - break; - case GF_MEDIA_CACHE_RUNNING: - event.SetText(wxT("Running")); - event.Enable(0); - break; - case GF_MEDIA_CACHE_DISABLED: - event.SetText(wxT("Disabled")); - break; - } -} - -void wxOsmo4Frame::OnUpdateCacheAbort(wxUpdateUIEvent & event) -{ - u32 state = gf_term_get_option(m_term, GF_OPT_MEDIA_CACHE); - event.Enable( (state==GF_MEDIA_CACHE_RUNNING) ? 1 : 0); -} - - - -void wxOsmo4Frame::BuildChapterList(Bool reset_only) -{ - GF_MediaInfo odi; - - while (chap_menu->GetMenuItemCount()) { - wxMenuItem* it = chap_menu->FindItemByPosition(0); - chap_menu->Delete(it); - } - if (m_chapters_start) gf_free(m_chapters_start); - m_chapters_start = NULL; - m_num_chapters = 0; - if (reset_only) return; - - GF_ObjectManager *root_od = gf_term_get_root_object(m_term); - if (!root_od) return; - if (gf_term_get_object_info(m_term, root_od, &odi) != GF_OK) return; - - u32 count = gf_list_count(odi.od->OCIDescriptors); - m_num_chapters = 0; - for (u32 i=0; iOCIDescriptors, i); - if (seg->tag != GF_ODF_SEGMENT_TAG) continue; - - if (seg->SegmentName && strlen((const char *)seg->SegmentName)) { - strcpy(szLabel, (const char *) seg->SegmentName); - } else { - sprintf(szLabel, "Chapter %02d", m_num_chapters+1); - } - chap_menu->AppendCheckItem(ID_SETCHAP_FIRST + m_num_chapters, wxString(szLabel, wxConvUTF8)); - - m_chapters_start = (Double *) gf_realloc(m_chapters_start, sizeof(Double)*(m_num_chapters+1)); - m_chapters_start[m_num_chapters] = seg->startTime; - m_num_chapters++; - } - - /*get any service info*/ - NetInfoCommand com; - if (!m_bStartupFile && gf_term_get_service_info(m_term, root_od, &com) == GF_OK) { - wxString title = wxT(""); - if (com.track_info) { title.Format(wxT("%02d "), (u32) (com.track_info>>16) ); } - if (com.artist) { title.Append(wxString(com.artist, wxConvUTF8)); title += wxT(" "); } - if (com.name) { title.Append(wxString(com.name, wxConvUTF8)); title += wxT(" "); } - if (com.album) { title += wxT("("); title.Append(wxString(com.album, wxConvUTF8)); title += wxT(")"); } - - if (title.length()) SetTitle(title); - } - -} - -void wxOsmo4Frame::OnChapterSel(wxCommandEvent & event) -{ - GF_ObjectManager *root_od = gf_term_get_root_object(m_term); - if (!root_od) return; - u32 ID = event.GetId() - ID_SETCHAP_FIRST; - gf_term_play_from_time(m_term, (u32) (1000*m_chapters_start[ID]), 0); -} - -void wxOsmo4Frame::OnUpdateChapterSel(wxUpdateUIEvent & event) -{ - Double now; - Bool is_current; - u32 ID = event.GetId() - ID_SETCHAP_FIRST; - - now = gf_term_get_time_in_ms(m_term); - now /= 1000; - - is_current = 0; - if (m_chapters_start[ID]<=now) { - if (ID+1now) is_current = 1; - } else { - is_current = 1; - } - } - event.Enable(1); - event.Check(is_current ? 1 : 0); -} - -void wxOsmo4Frame::OnUpdateChapterMenu(wxUpdateUIEvent & event) -{ - if (!m_connected || !m_num_chapters) { - event.Enable(0); - } else { - event.Enable(1); - } -} - -void wxOsmo4Frame::OnFileCopy(wxCommandEvent &event) -{ - const char *text = gf_term_get_text_selection(m_term, 0); - if (!text) return; - if (!wxTheClipboard->Open()) return; - - wxTheClipboard->SetData( new wxTextDataObject( wxString(text, wxConvUTF8)) ); - wxTheClipboard->Close(); -} - -void wxOsmo4Frame::OnUpdateFileCopy(wxUpdateUIEvent &event) -{ - if (gf_term_get_text_selection(m_term, 1)!=NULL) { - event.Enable(1); - } else { - event.Enable(0); - } -} - -void wxOsmo4Frame::OnFilePaste(wxCommandEvent &event) -{ - if (!wxTheClipboard->Open()) return; - if (wxTheClipboard->IsSupported( wxDF_TEXT )) { - wxTextDataObject data; - wxTheClipboard->GetData(data); - gf_term_paste_text(m_term, data.GetText().mb_str(wxConvUTF8), 0); - } - wxTheClipboard->Close(); -} - -void wxOsmo4Frame::OnUpdateFilePaste(wxUpdateUIEvent &event) -{ - Bool ok = 0; - if (wxTheClipboard->Open()) { - if (wxTheClipboard->IsSupported( wxDF_TEXT )) { - if (gf_term_paste_text(m_term, NULL, 1)==GF_OK) { - ok = 1; - } - } - wxTheClipboard->Close(); - } - event.Enable(ok ? 1 : 0); -} - diff --git a/applications/osmo4_wx/wxOsmo4.h b/applications/osmo4_wx/wxOsmo4.h deleted file mode 100644 index 6c2b463..0000000 --- a/applications/osmo4_wx/wxOsmo4.h +++ /dev/null @@ -1,390 +0,0 @@ -/* - * GPAC - Multimedia Framework C SDK - * - * Copyright (c) Jean Le Feuvre 2000-2005 - * All rights reserved - * - * This file is part of GPAC / Osmo4 wxWidgets GUI - * - * GPAC is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * GPAC is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - */ - -#ifndef _WXOSMO4_H -#define _WXOSMO4_H - -/* -we need to force X to work in sync mode when we use embedded view... -include first to avoid Bool type redef between X11 and gpac -*/ -#ifdef __WXGTK__ -#include -#endif - -#include "wx/wxprec.h" - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -#include -#include -#include -#include "menubtn.h" - -/*include gpac AFTER wx in case we override malloc/realloc/free for mem tracking*/ -#include -#include - -class wxOsmo4App : public wxApp -{ -public: - virtual bool OnInit(); -}; - -DECLARE_APP(wxOsmo4App) - -class wxOsmo4Frame; -class wxPlaylist; - -class GPACLogs : public wxLogWindow { -public: - GPACLogs(wxFrame *parent) : wxLogWindow(parent, wxT("GPAC Logs"), FALSE, FALSE) { - m_pMain = (wxOsmo4Frame *) parent; - } - virtual bool OnFrameClose(wxFrame *frame); - -private: - wxOsmo4Frame *m_pMain; -}; - -#define MAX_VIEWPOINTS 50 - -// Menu commands -enum -{ - GWX_FILE_OPEN = wxID_HIGHEST, - GWX_FILE_OPEN_URL, - FILE_RELOAD, - FILE_RELOAD_CONFIG, - FILE_PLAY, - FILE_STEP, - FILE_STOP, - FILE_PREV, - FILE_NEXT, - FILE_PROPERTIES, - FILE_COPY, - FILE_PASTE, - TERM_RELOAD, - FILE_QUIT, - VIEW_FULLSCREEN, - VIEW_ORIGINAL, - VIEW_AR_KEEP, - VIEW_AR_FILL, - VIEW_AR_43, - VIEW_AR_169, - VIEW_OPTIONS, - VIEW_LOGS, - VIEW_RTI, - VIEW_PLAYLIST, - SWITCH_RENDER, - APP_SHORTCUTS, - APP_NAV_KEYS, - APP_ABOUT, - ID_ADDRESS, - ID_URL_GO, - ID_ABOUT_CLOSE, - ID_CLEAR_NAV, - ID_STREAM_MENU, - ID_CHAPTER_MENU, - ID_ADD_SUB, - - ID_MCACHE_ENABLE, - ID_MCACHE_STOP, - ID_MCACHE_ABORT, - - ID_CTRL_TIMER, - ID_SLIDER, - - ID_TREE_VIEW, - ID_OD_TIMER, - ID_VIEW_SG, - ID_VIEW_WI, - ID_VIEW_SEL, - - - ID_HEADLIGHT, - ID_NAVIGATE_NONE, - ID_NAVIGATE_WALK, - ID_NAVIGATE_FLY, - ID_NAVIGATE_EXAMINE, - ID_NAVIGATE_SLIDE, - ID_NAVIGATE_PAN, - ID_NAVIGATE_ORBIT, - ID_NAVIGATE_GAME, - ID_NAVIGATE_RESET, - - ID_COLLIDE_NONE, - ID_COLLIDE_REG, - ID_COLLIDE_DISP, - ID_GRAVITY, - - ID_PL_OPEN, - ID_PL_SAVE, - ID_PL_ADD_FILE, - ID_PL_ADD_URL, - ID_PL_ADD_DIR, - ID_PL_ADD_DIR_REC, - ID_PL_REM_FILE, - ID_PL_REM_ALL, - ID_PL_REM_DEAD, - ID_PL_UP, - ID_PL_DOWN, - ID_PL_RANDOMIZE, - ID_PL_REVERSE, - ID_PL_SEL_REV, - ID_PL_SORT_TITLE, - ID_PL_SORT_FILE, - ID_PL_SORT_DUR, - ID_PL_PLAY, - - - /*reserve IDs for viewpoint menu*/ - ID_VIEWPOINT_FIRST, - ID_VIEWPOINT_LAST = ID_VIEWPOINT_FIRST + MAX_VIEWPOINTS, - - /*reserve IDs for navigation menus*/ - ID_NAV_PREV_0, - ID_NAV_PREV_9 = ID_NAV_PREV_0 + 10, - ID_NAV_NEXT_0, - ID_NAV_NEXT_9 = ID_NAV_NEXT_0 + 10, - /*reserve IDs for stream selection menus*/ - ID_SELSTREAM_0, - ID_SELSTREAM_9 = ID_SELSTREAM_0 + 10, - - /*reserve IDs for chapter selection menus*/ - ID_SETCHAP_FIRST, - ID_SETCHAP_LAST = ID_SELSTREAM_0 + 200, -}; - -wxString get_pref_browser(GF_Config *cfg); - -class wxGPACEvent : public wxEvent -{ -public: - wxGPACEvent( wxWindow* win = (wxWindow*) NULL ); - void CopyObject( wxObject& obj ) const; - virtual wxEvent *Clone() const; - - wxString to_url; - GF_Event gpac_evt; - - DECLARE_DYNAMIC_CLASS(wxGPACEvent) -}; -typedef void (wxEvtHandler::*GPACEventFunction)(wxGPACEvent&); -DEFINE_EVENT_TYPE(GPAC_EVENT) - -#define EVT_GPACEVENT(func) DECLARE_EVENT_TABLE_ENTRY(GPAC_EVENT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (GPACEventFunction) & func, (wxObject*) NULL), - -class OpenURLDlg : public wxDialog { -public: - OpenURLDlg(wxWindow *parent, GF_Config *cfg); - wxString m_urlVal; -private: - wxButton *m_go; - wxComboBox *m_url; - GF_Config *m_cfg; - void OnGo(wxCommandEvent& event); - DECLARE_EVENT_TABLE() -}; - -class wxMyComboBox : public wxComboBox -{ -public: - wxMyComboBox(wxWindow* parent, wxWindowID id, const wxString& value = wxT(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize) - : wxComboBox(parent, id, value, pos, size, 0, NULL, wxCB_DROPDOWN) - {} - -private: - DECLARE_EVENT_TABLE() - - void OnKeyUp(wxKeyEvent &event); -}; - -class wxOsmo4Frame : public wxFrame { -public: - wxOsmo4Frame(); - virtual ~wxOsmo4Frame(); - - char szAppPath[GF_MAX_PATH]; - - u32 m_duration; - wxString the_next_url; - GF_Terminal *m_term; - GF_User m_user; - Bool m_connected, m_can_seek, m_console_off, m_loop, m_lookforsubs; - - void DoConnect(); - - void ConnectAcknowledged(Bool bOk); - void SetStatus(wxString str); - - void OnFilePlay(wxCommandEvent &event); - void OnFileStep(wxCommandEvent &event); - void OnFileStop(wxCommandEvent &event); - wxString GetFileFilter(); - - void BuildViewList(); - void BuildStreamList(Bool reset_only); - void BuildChapterList(Bool reset_only); - - void AddSubtitle(const char *fileName, Bool auto_play); - - wxWindow *m_pView; - -#ifdef __WXGTK__ - u32 m_last_grab_time, m_last_grab_pos; - wxWindow *m_pVisual; -#endif - wxSlider *m_pProg; - wxPlaylist *m_pPlayList; - - void DoLayout(u32 v_width = 0, u32 v_height = 0); - s32 m_last_prog; - - FILE *m_logs; - u32 m_log_level, m_log_tools; - u32 m_LastStatusTime; - -protected: - -private: - DECLARE_EVENT_TABLE() - - void OnCloseApp(wxCloseEvent &event); - void OnSize(wxSizeEvent &event); - - void OnFileOpen(wxCommandEvent &event); - void OnFileOpenURL(wxCommandEvent &event); - void OnFileReload(wxCommandEvent &event); - void OnFileReloadConfig(wxCommandEvent & event); - void OnFileProperties(wxCommandEvent &event); - void OnFileQuit(wxCommandEvent &event); - void OnFullScreen(wxCommandEvent &event); - void OnOptions(wxCommandEvent &event); - void OnViewARKeep(wxCommandEvent &event); - void OnViewARFill(wxCommandEvent &event); - void OnViewAR169(wxCommandEvent &event); - void OnViewAR43(wxCommandEvent &event); - void OnViewOriginal(wxCommandEvent &event); - void OnPlaylist(wxCommandEvent &event); - void OnShortcuts(wxCommandEvent &event); - void OnNavInfo(wxCommandEvent &event); - void OnAddSub(wxCommandEvent &event); - void OnAbout(wxCommandEvent &event); - Bool LoadTerminal(); - void OnGPACEvent(wxGPACEvent &event); - void OnTimer(wxTimerEvent& event); - void OnSlide(wxScrollEvent &event); - void OnRelease(wxScrollEvent &event); - void OnLogs(wxCommandEvent & event); - void OnRTI(wxCommandEvent & event); - void OnUpdatePlay(wxUpdateUIEvent &event); - void OnUpdateNeedsConnect(wxUpdateUIEvent &event); - void OnUpdateFullScreen(wxUpdateUIEvent &event); - void OnUpdateAR(wxUpdateUIEvent &event); - void OnViewport(wxCommandEvent & event); - void OnUpdateViewport(wxUpdateUIEvent & event); - void OnNavigate(wxCommandEvent & event); - void OnNavigateReset(wxCommandEvent & event); - void OnUpdateNavigation(wxUpdateUIEvent & event); - void OnRenderSwitch(wxCommandEvent &event); - void OnCollide(wxCommandEvent & event); - void OnUpdateCollide(wxUpdateUIEvent & event); - void OnHeadlight(wxCommandEvent & event); - void OnUpdateHeadlight(wxUpdateUIEvent & event); - void OnGravity(wxCommandEvent & event); - void OnUpdateGravity(wxUpdateUIEvent & event); - void OnURLSelect(wxCommandEvent &event); - void OnUpdatePlayList(wxUpdateUIEvent & event); - void OnFilePrevOpen(wxNotifyEvent & event); - void OnFileNextOpen(wxNotifyEvent & event); - void OnNavPrev(wxCommandEvent &event); - void OnUpdateNavPrev(wxUpdateUIEvent & event); - void OnNavPrevMenu(wxCommandEvent &event); - void OnNavNext(wxCommandEvent &event); - void OnUpdateNavNext(wxUpdateUIEvent & event); - void OnNavNextMenu(wxCommandEvent &event); - void OnClearNav(wxCommandEvent &event); - void OnStreamSel(wxCommandEvent &event); - void OnUpdateStreamSel(wxUpdateUIEvent & event); - void OnUpdateStreamMenu(wxUpdateUIEvent & event); - void OnChapterSel(wxCommandEvent &event); - void OnUpdateChapterSel(wxUpdateUIEvent & event); - void OnUpdateChapterMenu(wxUpdateUIEvent & event); - - void SelectionReady(); - void ReloadURLs(); - void LookForSubtitles(); - - void OnCacheEnable(wxCommandEvent &event); - void OnCacheStop(wxCommandEvent &event); - void OnCacheAbort(wxCommandEvent &event); - void OnUpdateCacheEnable(wxUpdateUIEvent & event); - void OnUpdateCacheAbort(wxUpdateUIEvent & event); - - void OnFileCopy(wxCommandEvent &event); - void OnUpdateFileCopy(wxUpdateUIEvent &event); - void OnFilePaste(wxCommandEvent &event); - void OnUpdateFilePaste(wxUpdateUIEvent &event); - - - void CheckVideoOut(); - - wxMenuBar* m_pMenubar; - wxStatusBar* m_pStatusbar; - wxTimer *m_pTimer; - GPACLogs *m_pLogs; - wxBoxSizer *m_pAddBar; - - Bool m_bGrabbed, m_bToReset, m_bFirstStreamListBuild; - wxBitmap *m_pOpenFile, *m_pPrev, *m_pNext, *m_pPlay, *m_pPause, *m_pStep, *m_pStop, *m_pInfo, *m_pConfig, *m_pSW2D, *m_pSW3D; - wxMenuButton *m_pPrevBut, *m_pNextBut; - wxToolBar *m_pToolBar; - wxMyComboBox *m_Address; - - wxMenu *vp_list; - wxMenu *sel_menu; - wxMenu *chap_menu; - void Stop(); - - s32 nb_viewpoints; - - void UpdateRenderSwitch(); - void UpdatePlay(); - - u32 m_orig_width, m_orig_height; - - u32 m_num_chapters; - Double *m_chapters_start; - Bool m_bExternalView, m_bViewRTI, m_bStartupFile; - - void ShowViewWindow(Bool do_show); -}; - - -#endif //_WXOSMO4_H - diff --git a/applications/osmo4_wx/wxOsmo4.rc b/applications/osmo4_wx/wxOsmo4.rc deleted file mode 100644 index 3e839b8..0000000 --- a/applications/osmo4_wx/wxOsmo4.rc +++ /dev/null @@ -1,72 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// French (France) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) -#ifdef _WIN32 -LANGUAGE LANG_FRENCH, SUBLANG_FRENCH -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_OSMO_ICON ICON DISCARDABLE "../../doc/osmo4.ico" -#endif // French (France) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/applications/v4studio/V4CommandPanel.cpp b/applications/v4studio/V4CommandPanel.cpp deleted file mode 100644 index 9bd1703..0000000 --- a/applications/v4studio/V4CommandPanel.cpp +++ /dev/null @@ -1,601 +0,0 @@ -/* - V4CommandPanel.cpp - - Panel allowing to choose an action for a given frame in the time line - -*/ - -#include "safe_include.h" - -#include "V4CommandPanel.h" -#include "V4StudioFrame.h" - -#include "V4Node.h" - - - -// !! order matters !!, index will become the command id -// when command has no string, it is not available -// see v4_scenegraph_vrml.h -wxString cmdNames[] = { wxT(""), // GF_SG_SCENE_REPLACE - wxT("Replace Node"), // GF_SG_NODE_REPLACE - wxT("Replace Field"), // GF_SG_FIELD_REPLACE - wxT(""), // GF_SG_INDEXED_REPLACE - wxT(""), // GF_SG_ROUTE_REPLACE - wxT("Delete Node"), // GF_SG_NODE_DELETE - wxT(""), // GF_SG_INDEXED_DELETE - wxT(""), // GF_SG_ROUTE_DELETE - wxT("Insert Node"), // GF_SG_NODE_INSERT - wxT("") // GF_SG_INDEXED_INSERT - // TODO : to complete - }; - - -// Events table -BEGIN_EVENT_TABLE(V4CommandPanel, wxPanel) - EVT_PAINT(V4CommandPanel::OnPaint) - EVT_COMBOBOX(cmbCommandID, V4CommandPanel::OnCommandCombo) - EVT_COMBOBOX(cmbFieldID, V4CommandPanel::OnFieldCombo) - EVT_BUTTON(CreateID, V4CommandPanel::OnCreateCommand) -END_EVENT_TABLE() - - - -// Constructor -V4CommandPanel::V4CommandPanel(V4StudioFrame * parent_) - : wxPanel(parent_, -1), - // tabs - tabs(this, -1), - tabView(&tabs, -1), - tabAdd(&tabs, -1), - - // add Page - cmbCommands(&tabAdd, cmbCommandID, ""), - lblCommands(&tabAdd, -1, "Action :"), - cmbNodes(&tabAdd, -1, ""), - lblNodes(&tabAdd, -1, "Node :"), - cmbFields(&tabAdd ,cmbFieldID, ""), - lblFields(&tabAdd, -1, "Field :"), - txtField(&tabAdd, -1, ""), - btnCreate(&tabAdd, CreateID, "Create"), - - // view Page - cmbListCommands(&tabView, -1), - txtDesc(&tabView, -1), - btnDelete(&tabView, -1, "Delete") -{ - parent = parent_; - - // disposition - - // global - sizerTabs = new wxBoxSizer(wxHORIZONTAL); - sizerTabs->Add(&tabs, 1, wxEXPAND); - - tabs.AddPage(&tabView, "View"); - tabs.AddPage(&tabAdd, "Add"); - - - // Add Page - sizerAdd = new wxBoxSizer(wxVERTICAL); // up = combobox, middle = differs with the command, bottom = buttons - - sizerU = new wxBoxSizer(wxHORIZONTAL); // up - sizerM = new wxBoxSizer(wxVERTICAL); // middle - sizerD = new wxBoxSizer(wxHORIZONTAL); // bottom - - szSelectNode = new wxBoxSizer(wxHORIZONTAL); - szSelectField = new wxBoxSizer(wxHORIZONTAL); - szTxtField = new wxBoxSizer(wxHORIZONTAL); - - sizerAdd->Add(sizerU, 1, wxEXPAND); - sizerAdd->Add(sizerM, 3, wxEXPAND); - sizerAdd->Add(sizerD, 1, wxEXPAND); - - sizerU->Add(&lblCommands, 1, wxEXPAND | wxALL, 5); - sizerU->Add(&cmbCommands, 3, wxEXPAND | wxALL, 2); - - szSelectField->Add(&lblFields, 1, wxEXPAND | wxALL, 5); - szSelectField->Add(&cmbFields, 2, wxEXPAND | wxALL, 2); - - szSelectNode->Add(&lblNodes, 1, wxEXPAND | wxALL, 5); - szSelectNode->Add(&cmbNodes, 2, wxEXPAND | wxALL, 2); - - szTxtField->Add(&txtField, 1, wxEXPAND | wxALL, 5); - - sizerD->Add(&btnCreate, 1, wxEXPAND | wxALL, 3); - - tabAdd.SetSizer(sizerAdd); - - - - // View Page - sizerView = new wxBoxSizer(wxVERTICAL); - sizerUp = new wxBoxSizer(wxHORIZONTAL); - sizerDown = new wxBoxSizer(wxHORIZONTAL); - - sizerView->Add(sizerUp, 0, wxEXPAND); - sizerView->Add(sizerDown, 4, wxEXPAND); - - sizerUp->Add(&cmbListCommands, 2, wxEXPAND | wxALL, 2); - sizerUp->Add(&btnDelete, 1, wxEXPAND | wxALL, 2); - - sizerDown->Add(&txtDesc, 1, wxEXPAND); - - tabView.SetSizer(sizerView); - - - - // global - SetSizer(sizerTabs); - - //Layout(); - - ShowFieldSizer(false); - ShowNodeSizer(false); - txtField.Show(false); -} - -// Destructor -V4CommandPanel::~V4CommandPanel() { - delete szSelectNode; - delete szSelectField; - delete szTxtField; -}; - -/************************/ -/* Events */ -/************************/ - -// OnPaint event -void V4CommandPanel::OnPaint(wxPaintEvent& event) { - wxPaintDC dc(this); - - dc.BeginDrawing(); - - // draws a seperator line on the left border - int w,h; - this->GetSize(&w, &h); - dc.DrawLine(0, 0, 0, h); - - dc.EndDrawing(); -} - - -// OnCommandCombo -- command combo box selection has changed -void V4CommandPanel::OnCommandCombo(wxCommandEvent &event) { - // retrieves the command id - u32 command = (u32) cmbCommands.GetClientData(cmbCommands.GetSelection()); - - // retrieves the current node - GF_Node * node = GetCurrentNode(); - - if (! IsCommandValidForNode(command, node)) { - cmbCommands.SetSelection(-1); - command = (u32) -1; - } - - // shows or hides components - switch (command) { - case GF_SG_FIELD_REPLACE: { - ShowNodeSizer(false); - ShowFieldSizer(true); - break; - } - - case GF_SG_NODE_REPLACE: - case GF_SG_NODE_INSERT: { - ShowFieldSizer(false); - ShowNodeSizer(true); - break; - } - - case GF_SG_NODE_DELETE: - default : { - ShowFieldSizer(false); - ShowNodeSizer(false); - } - } -} - - -// OnFieldCombo -- field combo box selection has changed -void V4CommandPanel::OnFieldCombo(wxCommandEvent &event) { - - // if no selection exits - u32 sel = cmbFields.GetSelection(); - if (sel == wxNOT_FOUND) return; - - - // gets selected node in the timeline - GF_Node * node = GetCurrentNode(); - if (!node) return; - - GF_FieldInfo field; - gf_node_get_field(node, sel, &field); - - // show or hides elements depending on the type of the field we will modify - if ( (field.fieldType == GF_SG_VRML_SFNODE) || (field.fieldType == GF_SG_VRML_MFNODE) ) { - sizerM->Detach(szTxtField); - txtField.Show(false); - ShowNodeSizer(true); - } else { - sizerM->Detach(szTxtField); - sizerM->Add(szTxtField, 2, wxEXPAND); - txtField.Show(true); - } - -} - - -// OnCreateCommand -- creates a command with the option from the UI -void V4CommandPanel::OnCreateCommand(wxCommandEvent &event) { - - // verifies that there is a valid command value on cmbCommands - u32 sel = cmbCommands.GetSelection(); - if (sel == wxNOT_FOUND) return; - - // gets data from the UI - u32 tag = (u32) cmbCommands.GetClientData(sel); - GF_Node * node = GetCurrentNode(); - - // Creates the new command - REQUIRES registering the node - GF_Command * c = gf_sg_command_new(parent->GetV4SceneManager()->GetSceneGraph(), tag); - gf_node_register(node, NULL); - c->node = node; // !! the node have to be registered if command is validated - - bool succeed = false;; - - // performs various initialization depending on the command tag - switch (tag) { - case GF_SG_NODE_REPLACE: { - // TODO : not implemented yet because il would even replace the nodes in the dictionnary - break; - } - - case GF_SG_FIELD_REPLACE: { - // verifies that a valid field is selected - u32 selF = cmbFields.GetSelection(); - if (selF == wxNOT_FOUND) break; - - // gets the field - GF_FieldInfo field; - gf_node_get_field(node, (u32)cmbFields.GetClientData(selF), &field); - - GF_CommandField * cmdField = gf_sg_command_field_new(c); // if failure, will be freed with freeing the command - cmdField->fieldIndex = field.fieldIndex; - cmdField->fieldType = field.fieldType; - - // fills the GF_CommandField structures with data depending on the field type - switch (field.fieldType) { - case GF_SG_VRML_SFNODE: { - // get the node we will use as a replacement - u32 selN = cmbNodes.GetSelection(); - if (selN == wxNOT_FOUND) break; - - cmdField->new_node = (GF_Node *) cmbNodes.GetClientData(selN); - // TODO : why is the 2nd line necessary ? - cmdField->field_ptr = &cmdField->new_node; - - succeed = true; - break; - } - - case GF_SG_VRML_MFNODE: { - break; - } - - // field is not a node field - default: { - - wxString s = txtField.GetValue(); - if (s.IsEmpty()) break; - - GF_FieldInfo dummy; - dummy.far_ptr = gf_sg_vrml_field_pointer_new(field.fieldType); - dummy.fieldType = field.fieldType; - parent->GetFieldView()->SetFieldValue(dummy, &s, 0); // TODO : check the zero - - cmdField->field_ptr = dummy.far_ptr; - - succeed = true; - - break; - } - - } - - break; - } - - case GF_SG_NODE_INSERT: { - break; - } - - case GF_SG_NODE_DELETE: { - break; - } - } - - if (!succeed) { - gf_sg_command_del(c); - return; - } - - - V4SceneManager * sm = parent->GetV4SceneManager(); - - // The command is created, now searching for an AU to put it in - GF_StreamContext * ctx = sm->GetBifsStream(); - u32 count = gf_list_count (ctx->AUs); - GF_AUContext * au = NULL; - - for (u32 i = 0; i < count; i++) { - au = (GF_AUContext *) gf_list_get(ctx->AUs, i); - // V4Studio only uses timing - // TODO : FPS is defined in V4SceneGraph.h, should change and become a property somewhere - // TODO : units is a constant - if ( au->timing == sm->GetUnits() / sm->GetFrameRate() * frame ) break; - au = NULL; - } - - // creates new AU at the right time if none found - if (!au) au = gf_sm_stream_au_new(ctx, sm->GetUnits() / sm->GetFrameRate() * frame, 0, false); - - // adds command to AU and to the cell - gf_list_add(au->commands, (void *) c); - parent->GetTimeLine()->AddCommand(c); - - //gf_sg_command_apply(parent->GetV4Scene()->GetSceneGraph(), c, 0); - - -/* - // checks whether there is already a command for this object - GF_List * chain = parent->timeLine->GetCommands(); - - // if we can fuse the two commands together, we do it - if (gf_list_count(chain) > 0) { - GF_Command * old; - old = (GF_Command *) gf_list_get(chain, gf_list_count(chain) - 1); - if ( (old->tag = - } -*/ - - -} - - -/************************/ -/* Refresh */ -/************************/ - -// refresh -- refresh the node and the command combo boxes -void V4CommandPanel::Refresh(u32 frame_) { - - frame = frame_; - - // update the GUI - // cmbCommands updates in turns cmbNodes and/or cmbFields - RefreshCommands(); - - // update the list of the existing command for the cell currently selected - RefreshListCommands(); -} - - -// RefreshListCommands -- -void V4CommandPanel::RefreshListCommands() { - // retrieves pointer to the node - GF_Node * node = GetCurrentNode(); - if (!node) return; - - cmbListCommands.Clear(); - - GF_Command * c; - int i=0; - - while ( c = parent->GetTimeLine()->GetCommand(i) ) { - cmbListCommands.Append(wxString(cmdNames[c->tag]), (void *) i); - i++; - } -} - - -// RefreshCommands -- lists the available commands for the selected node -void V4CommandPanel::RefreshCommands() { - - // retrieves pointer to the node - GF_Node * node = GetCurrentNode(); - if (!node) return; - - u32 oldSel = cmbCommands.GetSelection(); - - // deletes all items from the combo box - cmbCommands.Clear(); - - // Prints the different possible commands, associates them with their id - for (int i=0; iGetV4SceneManager()->pools.pool(gf_node_get_tag(node)); - - // fills the combo box - PopulateNodes(pool, node); - - break; - } - - case GF_SG_FIELD_REPLACE: { - // checks if the field combo box has a valid selection - u32 index = cmbFields.GetSelection(); - if ( index == wxNOT_FOUND ) break; - - // get the field selected - GF_FieldInfo field; - gf_node_get_field(node, index, &field); - - // if field is not a node field then exits - if ( (field.fieldType != GF_SG_VRML_SFNODE) && (field.fieldType != GF_SG_VRML_MFNODE) ) break; - - // get the pool corresponding to that field - V4NodePool &pool = parent->GetV4SceneManager()->pools.poolFromFieldName(field.name); - - // fills the combo box - PopulateNodes(pool, node); - - break; - } - - case GF_SG_NODE_INSERT: { - // we add a child, that is to say we can add any generic node, we use "shape" to find that pool - V4NodePool &pool = parent->GetV4SceneManager()->pools.pool(TAG_MPEG4_Shape); - - // fills the combo box - PopulateNodes(pool, node); - - break; - } - - default: { - return; - } - } - -} - - -// RefreshFields -- lists the fields this nodes has -void V4CommandPanel::RefreshFields() { - - // retrieves pointer to the node - GF_Node * node = GetCurrentNode(); - if (!node) return; - - // clears the combo box - cmbFields.Clear(); - - int count = gf_node_get_field_count(node); - GF_FieldInfo field; - - for (u32 i = 0; i < count; i++) { - gf_node_get_field(node, i, &field); - cmbFields.Append(field.name, (void *) i); - } - - // TODO : are there some nodes with no fields ? - cmbFields.SetSelection(0); - - OnFieldCombo(wxCommandEvent()); - -} - - -// ShowNodeSizer -- shows or hides controls in the szSelectNode sizer -void V4CommandPanel::ShowNodeSizer(bool show) { - cmbNodes.Show(show); - lblNodes.Show(show); - - // always detaches to avoid accumulation of objects - sizerM->Detach(szSelectNode); - - if (show) { - sizerM->Add(szSelectNode, 1, wxEXPAND); - RefreshNodes(); - } - - tabAdd.Layout(); -} - - - -// ShowFieldSizer -- shows or hides controls in the szSelectField sizer -void V4CommandPanel::ShowFieldSizer(bool show) { - cmbFields.Show(show); - lblFields.Show(show); - txtField.Show(false); // always hide, RefreshField may bring it back - - // always detaches to avoid accumulation of objects - sizerM->Detach(szSelectField); - sizerM->Detach(szTxtField); - - if (show) { - // here order matters, RefreshFields may add szSelectNode, so we have to had ourselves before that - sizerM->Add(szSelectField, 1, wxEXPAND); - RefreshFields(); - } - - tabAdd.Layout(); -} - - -/************************/ -/* Utils */ -/************************/ - -// IsCommandValidForNode -- tells if we can apply this command to that node -bool V4CommandPanel::IsCommandValidForNode(u32 command, GF_Node * node) { - switch (command) { - case GF_SG_FIELD_REPLACE: - case GF_SG_NODE_DELETE: - case GF_SG_NODE_REPLACE: { - return true; - break; - } - - case GF_SG_NODE_INSERT: { - // to insert a child, node must have a GF_SG_VRML_MFNODE field, other children are not "inserted" - return parent->GetV4SceneManager()->pools.NodeHasField(node, GF_SG_VRML_MFNODE); - break; - } - - } - - return false; -} - - -// GetCurrentNode -- returns the node currently selected in the timeline -GF_Node * V4CommandPanel::GetCurrentNode() { - u32 id = parent->GetTimeLine()->GetSelectedID(); - if (!id) return NULL; - - return gf_sg_find_node(parent->GetV4SceneManager()->GetSceneGraph(), id); -} - - - -// PopulateNodes -- fills the cmdNodes with nodes from pool, do not add the specified node if found -void V4CommandPanel::PopulateNodes(V4NodePool& pool, GF_Node * node) { - for (u32 i = 0; i != pool.GetNodesCount(); i++) - if (pool.at(i).GetNode() != node) - cmbNodes.Append(pool.at(i).GetName(), (void *) pool.at(i).GetNode()); -} \ No newline at end of file diff --git a/applications/v4studio/V4CommandPanel.h b/applications/v4studio/V4CommandPanel.h deleted file mode 100644 index 1f169e1..0000000 --- a/applications/v4studio/V4CommandPanel.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - V4CommandPanel.h - - Header file for CommandPanel, the control alloing to create commands from the timeline -*/ - -#ifndef _V4CommandPanel_h_ -#define _V4CommandPanel_h_ - -#include "safe_include.h" -#include -#include - -// list of all commands -#include - - -#define cmbCommandID wxID_HIGHEST+1 -#define cmbFieldID wxID_HIGHEST+2 -#define CreateID wxID_HIGHEST+3 - - -class V4StudioFrame; -class V4NodePool; - - -class V4CommandPanel : public wxPanel { - public: - // Constructor Destructor - V4CommandPanel(V4StudioFrame * parent); - ~V4CommandPanel(); - - // Update - void Refresh(u32 frame); - - private: - - u32 frame; - - // controls - - wxNotebook tabs; - wxPanel tabView; - wxPanel tabAdd; - - // add page - wxComboBox cmbCommands; - wxStaticText lblCommands; - - wxComboBox cmbNodes; - wxStaticText lblNodes; - - wxComboBox cmbFields; - wxStaticText lblFields; - - wxButton btnCreate; - - wxTextCtrl txtField; - - - // view page - wxComboBox cmbListCommands; - wxTextCtrl txtDesc; - wxButton btnDelete; - - //sizers - // global - wxBoxSizer * sizerTabs; - // Add page - wxBoxSizer * sizerAdd, * sizerU, * sizerM, * sizerD, * szSelectNode, * szSelectField, * szTxtField; - // View page - wxBoxSizer * sizerView, * sizerUp, * sizerDown; - - - // UI -- show or hides part of the control - void ShowNodeSizer(bool show); - void ShowFieldSizer(bool show); - - // Refreshing of various comboboxes - void RefreshCommands(); - void RefreshNodes(); - void RefreshFields(); - void RefreshListCommands(); - - // fills the cmdNodes with nodes from pool, do not add the specified node if found - void PopulateNodes(V4NodePool& pool, GF_Node * node); - - // events - DECLARE_EVENT_TABLE() - void OnPaint(wxPaintEvent& event); - void OnCommandCombo(wxCommandEvent &event); - void OnFieldCombo(wxCommandEvent &event); - void OnCreateCommand(wxCommandEvent &event); - - bool IsCommandValidForNode(u32 command, GF_Node * node); // tells if we can apply this command to that node - GF_Node * GetCurrentNode(); // returns the node currently selected in the timeline - - // All the component of the V4Studio Main Frame have a pointer to that Main Frame, called parent. - V4StudioFrame * parent; - -}; - -#endif \ No newline at end of file diff --git a/applications/v4studio/V4FieldList.cpp b/applications/v4studio/V4FieldList.cpp deleted file mode 100644 index f6b1e50..0000000 --- a/applications/v4studio/V4FieldList.cpp +++ /dev/null @@ -1,452 +0,0 @@ -#include "safe_include.h" - -// For compilers that supports precompilation , includes "wx/wx.h" -#include "wx/wxprec.h" - -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include -#include - -#include "V4FieldList.h" - -#include "V4StudioFrame.h" - -BEGIN_EVENT_TABLE(V4FieldList, wxGrid) - EVT_GRID_CELL_CHANGE(V4FieldList::OnCellChanged) - EVT_GRID_CELL_LEFT_CLICK(V4FieldList::OnCellLeftClick) - EVT_GRID_CELL_RIGHT_CLICK(V4FieldList::OnCellRightClick) - EVT_GRID_CELL_LEFT_DCLICK(V4FieldList::OnCellLeftDClick) -END_EVENT_TABLE() - -class Position { -public : - Position(u32 fi, s32 fp) : fieldIndex(fi), fieldPosition(fp) {} - u32 fieldIndex; - s32 fieldPosition; -}; - -V4FieldList::V4FieldList(wxWindow *parent_, wxSize size) : wxGrid(parent_, -1, wxDefaultPosition, size) { - positions = gf_list_new(); - CreateGrid(0,0); - SetRowLabelSize(0); - SetColLabelSize(20); - SetColLabelValue(0, wxString(" ")); - SetColLabelValue(1, wxString("Field Name")); - SetColLabelValue(2, wxString("Field Value")); - InsertCols(0,3); - AutoSizeColumns(true); - EnableGridLines(true); - - parent = (V4StudioFrame *) parent_; -} - -V4FieldList::~V4FieldList() -{ - s32 i; - for (i=gf_list_count(positions)-1; i>=0; i--) { - Position *p = (Position *)gf_list_get(positions, i); - delete p; - p = NULL; - gf_list_rem(positions, i); - } - gf_list_del(positions); -} - -void V4FieldList::Create() -{ - GF_Node *node = m_pNode; - - if (!node) return; - - DeleteCols(0,3); - u32 nbRows = GetNumberRows(); - if (nbRows) DeleteRows(0,nbRows); - InsertCols(0,3); - - s32 i; - for (i=gf_list_count(positions)-1; i>=0; i--) { - Position *p = (Position *)gf_list_get(positions, i); - delete p; - p = NULL; - gf_list_rem(positions, i); - } - - u32 pos = 0; // counts rows added - - // adds a row to modify DefName - InsertRows(pos, 1); - SetCellValue(pos, 1, wxString("Name")); - const char * defName = gf_node_get_name(node); - if (defName) SetCellValue(pos, 2, wxString(defName)); - gf_list_add(positions, new Position(-1, -1)); - // enables modifying the DefName - for (i=0; i<2; i++) SetReadOnly(pos, i, TRUE); - SetReadOnly(pos, 2, FALSE); - pos++; - - // adds all fields - GF_FieldInfo field; - u32 count = gf_node_get_field_count(node); - u32 j; - - for (j=0; jc_str(), "%f %f %f", &(((SFColor *)ptr)->red), &(((SFColor *)ptr)->green), &(((SFColor *)ptr)->blue)); - break; - case GF_SG_VRML_SFVEC2F: - sscanf(value->c_str(), "%f %f", &(((SFVec2f *)ptr)->x), &(((SFVec2f *)ptr)->y)); - break; - case GF_SG_VRML_SFFLOAT: - sscanf(value->c_str(), "%f", (SFFloat *)ptr); - break; - case GF_SG_VRML_SFINT32: - sscanf(value->c_str(), "%d", (SFInt32 *)ptr); - break; - case GF_SG_VRML_SFBOOL: - if (!stricmp(value->c_str(), "true")) *((SFBool *)ptr) = 1; - else *((SFBool *)ptr) = 0; - break; - case GF_SG_VRML_SFSTRING: - if (((SFString *)ptr)->buffer) gf_free(((SFString *)ptr)->buffer); - ((SFString *)ptr)->buffer = gf_strdup(value->c_str()); - break; - default: - break; - } -} - -void V4FieldList::GetFieldValue(GF_FieldInfo f, wxString *s, int pos) -{ - void *ptr = NULL; - s32 type = -1; - if (gf_sg_vrml_is_sf_field(f.fieldType)) { - type = f.fieldType; - ptr = f.far_ptr; - } else { - if (pos < 0) return; - gf_sg_vrml_mf_get_item(f.far_ptr, f.fieldType, &ptr, pos); - type = gf_sg_vrml_get_sf_type(f.fieldType); - } - switch (type) { - case GF_SG_VRML_SFBOOL: - if (*(SFBool *)ptr == 0) s->Printf("false"); - else s->Printf("true"); - break; - case GF_SG_VRML_SFINT32: - s->Printf("%d", *(SFInt32 *)ptr); - break; - case GF_SG_VRML_SFCOLOR: - s->Printf("%.2f %.2f %.2f", ((SFColor *)ptr)->red, ((SFColor *)ptr)->green, ((SFColor *)ptr)->blue); - break; - case GF_SG_VRML_SFVEC2F: - s->Printf("%.2f %.2f", ((SFVec2f *)ptr)->x, ((SFVec2f *)ptr)->y); - break; - case GF_SG_VRML_SFFLOAT: - s->Printf("%.2f", *(SFFloat *)ptr); - break; - case GF_SG_VRML_SFSTRING: - s->Printf("%s", ((SFString *)ptr)->buffer); - break; - case GF_SG_VRML_SFSCRIPT: - s->Printf("%s", ((SFScript *)ptr)->script_text); - break; - default: - break; - } - gf_node_dirty_set(m_pNode, 0, 1); -} - -// OnCellChanged -- user has validated the changes made to a field, updates the node with the new value -void V4FieldList::OnCellChanged(wxGridEvent &evt) -{ - u32 row; - GF_FieldInfo field; - wxString value; - - if (!m_pNode || evt.GetCol() == 0) { - evt.Skip(); - return; - } - - row = evt.GetRow(); - value = GetCellValue(row, 2); - Position *pSelected = (Position *)gf_list_get(positions, row); - if (!pSelected) { - evt.Skip(); - return; - } - - // defName requires special treatment - if (pSelected->fieldIndex == (u32) -1) { - u32 id = gf_node_get_id(m_pNode); - if (!id) id = gf_sg_get_next_available_node_id(parent->GetV4SceneManager()->GetSceneGraph()); - gf_node_set_id(m_pNode, id, value.c_str()); - parent->GetV4SceneManager()->pools.Add(m_pNode); - } else { - // modifies any kind of field - gf_node_get_field(m_pNode, pSelected->fieldIndex, &field); - if (gf_sg_vrml_is_sf_field(field.fieldType)) { - SetFieldValue(field, &value, -1); - } else { - if (pSelected->fieldPosition >= 0) { - SetFieldValue(field, &value, pSelected->fieldPosition); - } else { - GenMFField *mf = (GenMFField *)field.far_ptr; - void *ptr; - gf_sg_vrml_mf_insert(mf, field.fieldType, &ptr, mf->count); - SetFieldValue(field, &value, mf->count-1); - SetCellValue(row, 2, ""); - wxString sign = GetCellValue(row, 0); - switch (sign.GetChar(0)) { - case '-': - { - u32 insertPosition = row+mf->count+1; - InsertRows(insertPosition-1, 1); - gf_list_insert(positions, new Position(pSelected->fieldIndex, mf->count-1), insertPosition); - wxString tmp; - tmp << '['; tmp << (mf->count-1); tmp << ']'; - SetCellValue(insertPosition-1, 1, tmp); - wxString buf; - GetFieldValue(field, &buf, mf->count-1); - SetCellValue(insertPosition-1, 2, buf); - } - break; - case '+': - break; - case ' ': - SetCellValue(row, 0, "+"); - break; - } - } - } - } - gf_node_dirty_set(m_pNode, 0, 1); - V4StudioFrame *parent = (V4StudioFrame *)this->GetParent(); - parent->Update(); -} - -void V4FieldList::SetLog(wxString s) -{ - V4StudioFrame *parent = (V4StudioFrame *)this->GetParent(); - parent->GetStatusBar()->SetStatusText(s); -} - -void V4FieldList::SetCellFieldValue(GF_FieldInfo field, u32 pos) -{ - wxString buf; - if (gf_sg_vrml_is_sf_field(field.fieldType)) { - SetCellValue(pos,1,wxString(field.name)); - GetFieldValue(field, &buf, -1); - SetCellValue(pos,2,buf); - } else { - GenMFField *mf = (GenMFField *)field.far_ptr; - if (mf->count > 0 ) { - SetCellValue(pos,0,"+"); - } else { - SetCellValue(pos,0," "); - } - SetCellValue(pos,1,field.name); - } -} - -// OnCellLeftClick -- draws columns for multivalued fields -void V4FieldList::OnCellLeftClick(wxGridEvent &evt) -{ - u32 col = evt.GetCol(); - u32 row = evt.GetRow(); - GF_FieldInfo field; - GF_Node *node = m_pNode; - - if (col != 0) { - evt.Skip(); - return; - } - - Position *pSelected = (Position *)gf_list_get(positions, row); - if (!pSelected) { - evt.Skip(); - return; - } - - gf_node_get_field(node, pSelected->fieldIndex, &field); - if (gf_sg_vrml_is_sf_field(field.fieldType) || field.fieldType == GF_SG_VRML_MFNODE) { - evt.Skip(); - return; - } - - wxString value = GetCellValue(row, col); - char c = value.GetChar(0); - GenMFField *mf = (GenMFField *)field.far_ptr; - if (c == ' ') { - evt.Skip(); - return; - } else if (c == '+') { - value.SetChar(0, '-'); - SetCellValue(row,0,value); - InsertRows(row+1, mf->count); - for (u32 j = 0; jcount; j++) { - Position *p = new Position(pSelected->fieldIndex, j); - gf_list_insert(positions, p, row+1+j); - wxString tmp; - tmp << '['; tmp << j; tmp << ']'; - SetCellValue(row+1+j, 1, tmp); - wxString buf; - GetFieldValue(field, &buf, j); - SetCellValue(row+1+j, 2, buf); - } - } else if (c == '-') { - value.SetChar(0, '+'); - SetCellValue(row,0,value); - DeleteRows(row+1, mf->count); - for (s32 j = mf->count-1; j>=0; j--) { - Position *p = (Position *)gf_list_get(positions,row+1+j); - delete p; - p = NULL; - gf_list_rem(positions, row+1+j); - } - } - evt.Skip(); -} - -void V4FieldList::OnCellRightClick(wxGridEvent &evt) -{ - int row = evt.GetRow(); - GF_FieldInfo field; - GF_Node *node = m_pNode; - - Position *pSelected = (Position *)gf_list_get(positions,row); - if (!pSelected) { - evt.Skip(); - return; - } - - gf_node_get_field(node, pSelected->fieldIndex, &field); - if (gf_sg_vrml_is_sf_field(field.fieldType)) { - evt.Skip(); - return; - } - - GenMFField *mf = (GenMFField *)field.far_ptr; - if (pSelected->fieldPosition == -1) { - evt.Skip(); - return; - } - - InsertRows(row, 1); - gf_list_insert(positions, new Position(pSelected->fieldIndex, pSelected->fieldPosition), row); - void *ptr; - gf_sg_vrml_mf_insert(mf, field.fieldType, &ptr, pSelected->fieldPosition); - SetCellValue(row, 2, ""); - for (u32 i=pSelected->fieldPosition; icount; i++) { - wxString tmp; - tmp << '['; tmp << i; tmp << ']'; - SetCellValue(row+i, 1, tmp); - } -} - -// OnCellLeftDClick -- Edit a given field -void V4FieldList::OnCellLeftDClick(wxGridEvent &evt) -{ - int row = evt.GetRow(); - GF_FieldInfo field; - GF_Node *node = m_pNode; - - Position *pSelected = (Position *)gf_list_get(positions,row); - if (!pSelected) { - evt.Skip(); - return; - } - - // editing the DEF name is NOT modifying a field - // we just need to modify the string itself - if (pSelected->fieldIndex == (u32) -1) { - evt.Skip(); - return; - } - - gf_node_get_field(node, pSelected->fieldIndex, &field); - u32 type; - void *ptr; - if (gf_sg_vrml_is_sf_field(field.fieldType)) { - type = field.fieldType; - ptr = field.far_ptr; - } else { - if (pSelected->fieldPosition < 0) { - evt.Skip(); - return; - } - gf_sg_vrml_mf_get_item(field.far_ptr, field.fieldType, &ptr, pSelected->fieldPosition); - type = gf_sg_vrml_get_sf_type(field.fieldType); - } - - if (type== GF_SG_VRML_SFCOLOR) { - wxColourDialog cd(this); - if (cd.ShowModal() == wxID_OK) - { - wxColourData retData = cd.GetColourData(); - wxColour col = retData.GetColour(); - ((SFColor *)ptr)->red = col.Red()/255.0f; - ((SFColor *)ptr)->green = col.Green()/255.0f; - ((SFColor *)ptr)->blue = col.Blue()/255.0f; - } else { - return; - } - } else if (!stricmp(field.name,"family")) { - wxFontDialog fd(this); - if (fd.ShowModal() == wxID_OK) { - wxFontData retData = fd.GetFontData(); - wxFont font = retData.GetChosenFont(); - wxString name = font.GetFaceName(); - if (((SFString *)ptr)->buffer) gf_free(((SFString *)ptr)->buffer); - ((SFString *)ptr)->buffer = gf_strdup(name.c_str()); - } else { - return; - } - - } else { - evt.Skip(); - return; - } - V4StudioFrame *parent = (V4StudioFrame *)this->GetParent(); - parent->Update(); -} diff --git a/applications/v4studio/V4FieldList.h b/applications/v4studio/V4FieldList.h deleted file mode 100644 index d4142c5..0000000 --- a/applications/v4studio/V4FieldList.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef _V4_FIELD_LIST_H -#define _V4_FIELD_LIST_H - -#include "safe_include.h" -#include - -#include - - -class V4StudioFrame; - - -class V4FieldList: public wxGrid { - -public: - V4FieldList(wxWindow *parent, wxSize size); - ~V4FieldList(); - - void SetNode(GF_Node *node) { m_pNode = node; } - - void Create(); - void GetFieldValue(GF_FieldInfo f, wxString *s, int pos); - void SetFieldValue(GF_FieldInfo f, wxString *s, int pos); - - void OnCellChanged(wxGridEvent &evt); - void OnCellLeftClick(wxGridEvent &evt); - void OnCellRightClick(wxGridEvent &evt); - void OnCellLeftDClick(wxGridEvent &evt); -protected: - DECLARE_EVENT_TABLE() - -private: - void SetLog(wxString s); - - void InsertOneFieldRow(u32 position, GF_FieldInfo field); - - void SetCellFieldValue(GF_FieldInfo field, u32 pos); - - GF_Node * m_pNode; - GF_List *positions; - - // All the component of the V4Studio Main Frame have a pointer to that Main Frame, called parent. - V4StudioFrame * parent; - -}; - -#endif diff --git a/applications/v4studio/V4Node.cpp b/applications/v4studio/V4Node.cpp deleted file mode 100644 index 75ca8f9..0000000 --- a/applications/v4studio/V4Node.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - V4Node.cpp - - Implements V4Node class -*/ - -#include "V4Node.h" -#include - - -// Constructor -V4Node::V4Node(const u32 _NodeID, GF_Node * _node) : NodeID(_NodeID), node(_node) { - _ASSERT(_node); // no NULL node -} - - -// GetID -- -u32 V4Node::GetID() const { - return NodeID; -} - - -// GetNode -- -GF_Node * V4Node::GetNode() const { - return node; -} - - -// IsAliveAt -- check all aparitions -bool V4Node::IsAliveAt(const u32 frame) { - std::list::iterator i; - - for (i = lifeSpan.begin(); i != lifeSpan.end(); i++) - if ( ((*i).from >= frame) && ((*i).to <= frame) ) return true; - - return false; -} - - -// Appear -void V4Node::Appear(const u32 startFrame, const u32 stopFrame) { - // TODO : - return; -} - - -// Disappear -void V4Node::Disappear(const u32 startFrame, const u32 stopFrame) { - // TODO : - return; -} - - -// GetName -- -wxString V4Node::GetName() { - return wxString(gf_node_get_name(node)); -} \ No newline at end of file diff --git a/applications/v4studio/V4Node.h b/applications/v4studio/V4Node.h deleted file mode 100644 index 815bbf2..0000000 --- a/applications/v4studio/V4Node.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - V4Node.h - - Represents a node with additionnal attributes for V4Studio, such as lifespan -*/ - -#ifndef _V4Node_ -#define _V4Node_ - -#include "safe_include.h" -#include // GF_Node structure - -#include - -#include - - -struct segment { - u32 from, to; -}; - - -class V4Node { - public: - // constructor destructor - V4Node(const u32 NodeID, GF_Node * node=NULL); // node may be modified, don't use const GF_Node * - - // accesses to members - u32 GetID() const; - GF_Node * GetNode() const; - - - // computes whether the node is alive at the given frame - bool IsAliveAt(const u32 frame); - - // Add an apparition, inclusive - void Appear(const u32 startFrame, const u32 stopFrame); - - // Remove frames from lifeSpan, inclusive - void Disappear(const u32 startFrame, const u32 stopFrame); - - - // (to save workspace) tells whether the node should appear on the timeline - bool isOnTimeLine; - - // retrieves the node _DEF_ name (node has a Node ID) - wxString GetName(); - - - - private: - // various accesses to the node - u32 NodeID; - GF_Node * node; - - // timeLine - std::list lifeSpan; // each element of the list is one use of this node, first value is start frame, second is end frame, inclusive - -}; - -#endif \ No newline at end of file diff --git a/applications/v4studio/V4NodePool.cpp b/applications/v4studio/V4NodePool.cpp deleted file mode 100644 index f78f6fc..0000000 --- a/applications/v4studio/V4NodePool.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - V4NodePool.cpp - -*/ -#include "safe_include.h" -#include - -#include "V4NodePool.h" - - -// FindNode -- search for a node with the specified NodeID or pointer -u32 V4NodePool::FindNode(const u32 NodeID, const GF_Node * node) { - - if ( (NodeID == 0) && (node == NULL) ) return (u32) -1; - - for (int i = 0; i < Nodes.size(); i++) - if ( (NodeID == Nodes.at(i).GetID()) || (node == Nodes.at(i).GetNode()) ) return i; - - return (u32) -1; -} - - -// AddNode -- -V4Node& V4NodePool::AddNode(GF_Node * _node) { - // checks that the node is not already in the pool - u32 id = gf_node_get_id(_node); - u32 i = FindNode(id); - if (i != (u32) -1) return Nodes.at(i); - - // add a new entry into the pool - V4Node node(id, _node); - Nodes.push_back(node); - count++; - return Nodes.back(); -} - - -// DeleteNode -- Deletes a node from the pool -void V4NodePool::DeleteNode(const u32 _NodeID, const GF_Node * _node) { - u32 i = FindNode(_NodeID, _node); - std::vector::iterator iter = Nodes.begin(); - - for (u32 j=0; j -#include "V4Node.h" - -using namespace std; - -class V4NodePool { - - public: - - // Constructor - V4NodePool() { count = 0; } - - // Adds a node to the pool - V4Node& AddNode(GF_Node * node=NULL); // node may be modified, don't use const GF_Node * - - // Deletes a node from the pool - void DeleteNode(const u32 NodeID, const GF_Node * node=NULL); - - // retrieves a node from the pool - V4Node& GetV4Node(const u32 NodeID, const GF_Node * node=NULL); - - // returns the numbre of nodes - u32 GetNodesCount() const; - - // returns the nth element in the vector - V4Node& at(u32 n); - - // clear the pool - void Clear(); - - // returns count - u32 GetCount() const; - - - private: - vector Nodes; - - // find the V4Node with the specified attributes - u32 FindNode(const u32 NodeID, const GF_Node * node=NULL); - - // counts the nodes added to that pool (used in autonaming nodes) - u32 count; - -}; - -#endif \ No newline at end of file diff --git a/applications/v4studio/V4NodePools.cpp b/applications/v4studio/V4NodePools.cpp deleted file mode 100644 index 2168dba..0000000 --- a/applications/v4studio/V4NodePools.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - V4NodePools.cpp - - Implements V4NodePools class - -*/ - -#include "V4NodePools.h" -#include "V4NodePool.h" - -V4NodePool dummy; - -// Constructor -V4NodePools::V4NodePools() { - pools.resize(DICT_LAST); - unPooled = 0; -} - - -// pool -- returns the pool of object for the given tag -V4NodePool& V4NodePools::pool(const u32 tag) -{ - u32 n = poolN(tag); - if ((u32) -1 == n) return dummy; - return pools.at(n); -} - - -// pool -- returns the NUMBER of the pool for the given tag -u32 V4NodePools::poolN(const u32 tag) { - - switch (tag) { - - // objects that can be children of a switch - case TAG_MPEG4_OrderedGroup: - case TAG_MPEG4_Shape: { - return DICT_GEN; - break; - } - - // objects that can be a geometry - case TAG_MPEG4_Rectangle: - case TAG_MPEG4_IndexedFaceSet2D: - case TAG_MPEG4_Circle: { - return DICT_GEOMETRY; - break; - } - - // objects that can be an appearance - case TAG_MPEG4_Appearance: { - return DICT_APPEARANCE; - break; - } - - // objects that can be a texture - case TAG_MPEG4_MovieTexture: - case TAG_MPEG4_ImageTexture: { - return DICT_TEXTURE; - break; - } - - // objects that can be a material - case TAG_MPEG4_Material2D: { - return DICT_MATERIAL; - break; - } - - } - - return (u32) -1; -} - - -// poolNFromFieldName -- Get the correct pool from a field name -V4NodePool& V4NodePools::poolFromFieldName(const char * name) { - - if (!strcmp("appearance", name)) return pools.at(DICT_APPEARANCE); - if (!strcmp("geometry", name)) return pools.at(DICT_GEOMETRY); - if (!strcmp("material", name)) return pools.at(DICT_MATERIAL); - if (!strcmp("texture", name)) return pools.at(DICT_TEXTURE); - - // throws an exception if not found - return dummy; -} - - -// Clear -- clears all the pool -void V4NodePools::Clear() { - for (u32 i = 0; i < pools.size(); i++) - pools.at(i).Clear(); -} - - -// Add -- Adds a node to the correct pool -void V4NodePools::Add(GF_Node * node) { - u32 tag = gf_node_get_tag(node); - if (poolN(tag) == (u32) -1) return; - pool(tag).AddNode(node); -} - - -// NodeHasField -- tells if nodes as field of the given type -bool V4NodePools::NodeHasField(GF_Node * node, u32 fieldType) { - u32 count = gf_node_get_field_count(node); - GF_FieldInfo field; - - // cycles through all fields and checks field type - for (u32 i = 0; i < count; i++) { - gf_node_get_field(node, i, &field); - if (field.fieldType == fieldType) return true; - } - - return false; -} - - -// returns the total number of nodes created for that type of node -u32 V4NodePools::GetCount(const u32 tag) { - if (poolN(tag) == (u32) -1) return unPooled++; - return pool(tag).GetCount(); -} \ No newline at end of file diff --git a/applications/v4studio/V4NodePools.h b/applications/v4studio/V4NodePools.h deleted file mode 100644 index a9f0107..0000000 --- a/applications/v4studio/V4NodePools.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - V4NodePools - - List all the Node pools for each possible node tag - -*/ - -#include "safe_include.h" -#include -#include - -#include - -#include "V4NodePool.h" - - -using namespace std; - - -enum { - DICT_GEN = 0, - DICT_GEOMETRY, - DICT_APPEARANCE, - DICT_TEXTURE, - DICT_MATERIAL, - - DICT_LAST // last element, gives the actual number of pool -}; - - -class V4NodePools { - - public: - // Constructor - V4NodePools(); - - // gets the correct pool from the given tag - V4NodePool& pool(const u32 tag); - V4NodePool& poolFromFieldName(const char * name); - u32 poolN(const u32 tag); - - // clears all the pools - void Clear(); - - // Adds a node to the correct pool - void Add(GF_Node * node); - - // tells if nodes as field of the given type - bool NodeHasField(GF_Node * node, u32 fieldType); - - // returns the total number of nodes created for that type of node - u32 GetCount(const u32 tag); - - - private: - vector pools; - unsigned int unPooled; - -}; \ No newline at end of file diff --git a/applications/v4studio/V4SceneGraph.cpp b/applications/v4studio/V4SceneGraph.cpp deleted file mode 100644 index 05558ac..0000000 --- a/applications/v4studio/V4SceneGraph.cpp +++ /dev/null @@ -1,304 +0,0 @@ -#include "V4SceneGraph.h" -#include "V4StudioFrame.h" - -#include -#include -#include - -#include "V4Service.h" - -V4SceneGraph::V4SceneGraph(V4StudioFrame *parent) : frame(parent) -{ - m_pSm = NULL; - m_pSg = NULL; - m_pSr = NULL; - m_pIs = NULL; - m_pOriginal_mp4 = NULL; - m_bEncodeNames = 0; - m_term = parent->GetGPACPanel()->m_term; -} - -V4SceneGraph::~V4SceneGraph() -{ - // TODO : pquoi fallait il commenter cette ligne ? - //if (m_pSm) gf_sm_del(m_pSm); - if (m_pOriginal_mp4) gf_free(m_pOriginal_mp4); - if (m_pService) delete m_pService; -} - -void V4SceneGraph::SetSceneSize(int w, int h) -{ - gf_sg_set_scene_size_info(m_pSg, w,h, 1); - /*reassign scene graph to update scene size in renderer*/ - gf_sr_set_scene(m_pSr, m_pSg); -} - -void V4SceneGraph::GetSceneSize(wxSize &size) -{ - gf_sg_get_scene_size_info(m_pSg, (u32 *)&(size.x), (u32 *)&(size.y)); -} - -GF_Node *V4SceneGraph::SetTopNode(u32 tag) -{ - GF_Node * root = NewNode(tag); - gf_sg_set_root_node(m_pSg, root); - return (GF_Node *)root; -} - - -GF_Node *V4SceneGraph::NewNode(u32 tag) -{ - GF_Node *n = gf_node_new(m_pSg, tag); - if (!n) return NULL; - gf_node_init(n); - return n; -} - -void V4SceneGraph::SaveFile(const char *path) -{ - char rad_name[5000]; - strcpy(rad_name, "dump"); - gf_sm_dump(m_pSm, rad_name, 0); - GF_ISOFile *mp4 = gf_isom_open(path, GF_ISOM_WRITE_EDIT, NULL); - m_pSm->max_node_id = gf_sg_get_max_node_id(m_pSm->scene_graph); - gf_sm_encode_to_file(m_pSm, mp4, "c:\\log.txt", NULL, GF_SM_LOAD_MPEG4_STRICT, 0); - gf_isom_close(mp4); -} - -void V4SceneGraph::LoadNew() -{ - if (m_pSm) { - gf_sr_set_scene(m_pSr, NULL); - gf_sm_del(m_pSm); - m_pSm = NULL; - gf_sg_del(m_pSg); - m_pSg = NULL; - } - if (m_pOriginal_mp4) gf_free(m_pOriginal_mp4); - m_pOriginal_mp4 = NULL; - - m_pIs = gf_is_new(NULL); - m_pSg = m_pIs->graph; - gf_sg_set_init_callback(m_pSg, v4s_node_init, this); - gf_sr_set_scene(m_pSr, m_pSg); - - m_pSm = gf_sm_new(m_pSg); - /* Create a BIFS stream with one AU with on ReplaceScene */ - GF_StreamContext *sc = gf_sm_stream_new(m_pSm, 1, GF_STREAM_SCENE, 0); - GF_AUContext *au = gf_sm_stream_au_new(sc, 0, 0, 1); - GF_Command *command = gf_sg_command_new(m_pSg, GF_SG_SCENE_REPLACE); - gf_list_add(au->commands, command); - - // reinitializes the node pool - frame->pools.Clear(); -} - -void V4SceneGraph::LoadFileOld(const char *path) -{ - m_pService = new V4Service(path); - gf_term_attach_service(m_term, m_pService->m_pNetClient); - m_pIs = m_term->root_scene; - m_pSg = m_pIs->graph; - gf_term_play_from_time(m_term, 0); - while(!m_pIs->graph_attached) {} - // CreateDictionnary crashes because the root node in m_pSg is not set. - CreateDictionnary(); -} - -void V4SceneGraph::LoadFile(const char *path) -{ - GF_SceneLoader load; - if (m_pSm) { - gf_sr_set_scene(m_pSr, NULL); - gf_sm_del(m_pSm); - gf_sg_del(m_pSg); - } - - // initializes a new scene - // We need an GF_InlineScene, a SceneManager and an GF_ObjectManager - m_pIs = gf_is_new(NULL); - m_pSg = m_pIs->graph; - m_pSm = gf_sm_new(m_pSg); - - m_pIs->root_od = gf_odm_new(); - - m_pIs->root_od->parentscene = NULL; - m_pIs->root_od->subscene = m_pIs; - m_pIs->root_od->term = m_term; - - m_term->root_scene = m_pIs; - - // TODO : what's the use of this ? - if (m_pOriginal_mp4) gf_free(m_pOriginal_mp4); - m_pOriginal_mp4 = NULL; - - /* Loading of a file (BT, MP4 ...) and modification of the SceneManager */ - memset(&load, 0, sizeof(GF_SceneLoader)); - load.fileName = path; - load.ctx = m_pSm; - load.cbk = this; - if (strstr(path, ".mp4") || strstr(path, ".MP4") ) load.isom = gf_isom_open(path, GF_ISOM_OPEN_READ, NULL); - gf_sm_load_init(&load); - gf_sm_load_run(&load); - gf_sm_load_done(&load); - if (load.isom) gf_isom_delete(load.isom); - - /* SceneManager should be initialized and filled correctly */ - - gf_sg_set_scene_size_info(m_pSg, m_pSm->scene_width, m_pSm->scene_height, m_pSm->is_pixel_metrics); - - // TODO : replace with GetBifsStream - GF_StreamContext *sc = (GF_StreamContext *) gf_list_get(m_pSm->streams,0); - - if (sc->streamType == 3) { - GF_AUContext *au = (GF_AUContext *) gf_list_get(sc->AUs,0); - GF_Command *c = (GF_Command *) gf_list_get(au->commands,0); - gf_sg_command_apply(m_pSg, c, 0); - /* This is a patch to solve the save pb: - When ApplyCommand is made on a Scene Replace Command - The command node is set to NULL - When we save a BIFS stream whose first command is of this kind, - the file saver thinks the bifs commands should come from an NHNT file - This is a temporary patch */ - if (c->tag == GF_SG_SCENE_REPLACE) { c->node = m_pSg->RootNode; } - } - gf_sr_set_scene(m_pSr, m_pSg); - - // retrieves all the node from the tree and adds them to the node pool - GF_Node * root = gf_sg_get_root_node(m_pSg); - CreateDictionnary(); -} - -GF_Node *V4SceneGraph::CopyNode(GF_Node *node, GF_Node *parent, bool copy) -{ - if (copy) return CloneNodeForEditing(m_pSg, node); - u32 nodeID = gf_node_get_id(node); - if (!nodeID) { - nodeID = gf_sg_get_next_available_node_id(m_pSg); - gf_node_set_id(node, nodeID, NULL); - gf_node_register(node, parent); - } - return node; -} - -void V4SceneGraph::LoadCommand(u32 commandNumber) -{ - GF_StreamContext *sc = NULL; - for (u32 i=0; istreams); i++) { - sc = (GF_StreamContext *) gf_list_get(m_pSm->streams, i); - if (sc->streamType == GF_STREAM_SCENE) break; - sc = NULL; - } - assert(sc); - GF_AUContext *au = (GF_AUContext *) gf_list_get(sc->AUs,0); - if (commandNumber < gf_list_count(au->commands)) { - for (u32 j=0; j<=commandNumber; j++) { - GF_Command *c = (GF_Command *) gf_list_get(au->commands, j); - gf_sg_command_apply(m_pSg, c, 0); - } - } -} - - - -extern "C" { - -GF_Node *CloneNodeForEditing(GF_SceneGraph *inScene, GF_Node *orig) //, GF_Node *cloned_parent) -{ - u32 i, j, count; - GF_Node *node, *child, *tmp; - GF_List *list, *list2; - GF_FieldInfo field_orig, field; - - /*this is not a mistake*/ - if (!orig) return NULL; - - /*check for DEF/USE - if (orig->sgprivate->NodeID) { - node = gf_sg_find_node(inScene, orig->sgprivate->NodeID); - //node already created, USE - if (node) { - gf_node_register(node, cloned_parent); - return node; - } - } - */ - /*create a node*/ -/* - if (orig->sgprivate->tag == TAG_MPEG4_ProtoNode) { - proto_node = ((GF_ProtoInstance *)orig)->proto_interface; - //create the instance but don't load the code -c we MUST wait for ISed routes to be cloned before - node = gf_sg_proto_create_node(inScene, proto_node, (GF_ProtoInstance *) orig); - } else { -*/ - node = gf_node_new(inScene, gf_node_get_tag(orig)); -// } - - count = gf_node_get_field_count(orig); - - /*copy each field*/ - for (i=0; isgprivate->NodeID) { - Node_SetID(node, orig->sgprivate->NodeID); - gf_node_register(node, cloned_parent); - }*/ - - /*init node before creating ISed routes so the eventIn handler are in place*/ - if (gf_node_get_tag(node) != TAG_ProtoNode) gf_node_init(node); - - return node; -} - -} - - -// GetBifsStream -- gets the first stream with id = 3 -GF_StreamContext * V4SceneGraph::GetBifsStream() { - GF_StreamContext * ctx = NULL; - u32 count = gf_list_count(m_pSm->streams); - - // cycle trough each stream - while (count--) { - ctx = (GF_StreamContext *) gf_list_get(m_pSm->streams, count); - if (ctx->streamType == 3) break; - } - - if (ctx == NULL) return NULL; - - // if we went through the loop without finding any BIFS stream return null - if (ctx->streamType != 3) return NULL; - - return ctx; -} - - diff --git a/applications/v4studio/V4SceneGraph.h b/applications/v4studio/V4SceneGraph.h deleted file mode 100644 index cc6dc07..0000000 --- a/applications/v4studio/V4SceneGraph.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef _V4SCENEGRAPH_H -#define _V4SCENEGRAPH_H - -#include "safe_include.h" -#include -#include -#include // MPEG4CLIENT - - -#include - - -#define DICTNAME "__V4dictionnary" - - -#define FPS 25 - - -class V4StudioFrame; -class V4Service; - -extern "C" { - GF_Node *CloneNodeForEditing(GF_SceneGraph *inScene, GF_Node *orig); - int GetNextNodeID(GF_SceneGraph *sg); -} - -class V4SceneGraph { -public: - // Constructor / Desctructor - V4SceneGraph(V4StudioFrame *parent); - ~V4SceneGraph(); - - - /* file management functions */ - - void SaveFile(const char * path); - void LoadNew(); - void LoadFile(const char *path); - void LoadFileOld(const char *path); - - - /* Node management functions */ - - GF_Node *NewNode(u32 tag); - GF_Node *CopyNode(GF_Node *node, GF_Node *parent, bool copy); - GF_Node *SetTopNode(u32 tag); // TODO : will destroy dictionnary - - /* Various */ - - void LoadCommand(u32 commandNumber); // ? - GF_StreamContext * GetBifsStream(); // Get the first stream with id = 3 - - - /* access to private members */ - - // SceneSize - void SetSceneSize(int w, int h); - void GetSceneSize(wxSize &size); - - // Renderer (owned by the terminal) - void SetRenderer(GF_Compositor *sr) { m_pSr = sr; } - GF_Compositor *GetSceneCompositor() { return m_pSr; } - - // GF_InlineScene - // TODO : Should be modified ? - LPINLINESCENE GetInlineScene() { return m_pIs; } - - // SceneManager - // TODO : Should be modified ? - GF_SceneManager * GetSceneManager() { return m_pSm; } - - // SceneGraph - GF_SceneGraph *GetSceneGraph() { return m_pSg; } - GF_Node *GetRootNode() { return gf_sg_get_root_node(m_pSg); } - -protected: - - // self created - LPINLINESCENE m_pIs; - GF_SceneGraph * m_pSg; - GF_SceneManager *m_pSm; - GF_Node * dictionnary; - - // from other objects - GF_Compositor *m_pSr; - GF_Terminal *m_term; - V4StudioFrame * frame; - - char *m_pOriginal_mp4; - Bool m_bEncodeNames; - V4Service *m_pService; -}; - -#endif - diff --git a/applications/v4studio/V4SceneManager.cpp b/applications/v4studio/V4SceneManager.cpp deleted file mode 100644 index ea31f89..0000000 --- a/applications/v4studio/V4SceneManager.cpp +++ /dev/null @@ -1,598 +0,0 @@ -#include "V4SceneManager.h" -#include "V4StudioFrame.h" - -#include -#include -#include -#include - - -V4SceneManager::V4SceneManager(V4StudioFrame *parent) : frame(parent) -{ - m_pSm = NULL; - m_pIs = NULL; - units = 1000; // used to calculate AU timings -} - -V4SceneManager::~V4SceneManager() -{ - GF_SceneGraph *tmp = m_pIs->graph; - - /* Deletion of the SceneManager - This is done before deleting the GF_InlineScene in the GF_Terminal in the GPAC Panel - but for that we need to register the root node one more time to avoid the deletion of the scene graph - But this is temporary, this register of the root node should be done at loading time. - */ - if (m_pSm) { - gf_node_register(m_pSm->scene_graph->RootNode, NULL); - gf_sm_del(m_pSm); - m_pSm = NULL; - } - - /* Destruction of the GPAC panel and of the associated service and terminal */ - delete m_gpac_panel; - m_gpac_panel = NULL; - -} - -void V4SceneManager::LoadCommon() -{ - /* Creation and initialization of the structure InlineScene, including the SceneGraph */ - m_pIs = gf_inline_new(NULL); - - /* Creation of the GPAC Panel which includes the creation of the terminal */ - m_gpac_panel = new wxGPACPanel(this, NULL); - - /* Connection of the InlineScene to the terminal */ - GF_Terminal *term = m_gpac_panel->GetMPEG4Terminal(); - term->root_scene = m_pIs; - -/* - gf_sc_set_scene(term->compositor, m_pIs->graph); - m_pIs->graph_attached = 1; -*/ - - /* Creation of a SceneManager to manipulate the scene and streams */ - m_pSm = gf_sm_new(m_pIs->graph); - - /* Creation of main ObjectManager to manipulate the media */ - m_pIs->root_od = gf_odm_new(); - m_pIs->root_od->parentscene = NULL; - m_pIs->root_od->subscene = m_pIs; - m_pIs->root_od->term = term; -} - -void V4SceneManager::LoadNew() -{ - LoadCommon(); - - /* Create a BIFS stream with one AU with one ReplaceScene */ - GF_StreamContext *sc = gf_sm_stream_new(m_pSm, 1, GF_STREAM_SCENE, 0); - GF_AUContext *au = gf_sm_stream_au_new(sc, 0, 0, 1); - GF_Command *command = gf_sg_command_new(m_pIs->graph, GF_SG_SCENE_REPLACE); - gf_list_add(au->commands, command); - - SetLength(50); - SetFrameRate(25); - - // reinitializes the node pool - pools.Clear(); -} - -void V4SceneManager::LoadFile(const char *path) -{ - LoadCommon(); - GF_Terminal *term = m_gpac_panel->GetMPEG4Terminal(); - - /* Loading of a file (BT, MP4 ...) and modification of the SceneManager */ - GF_SceneLoader load; - memset(&load, 0, sizeof(GF_SceneLoader)); - load.fileName = path; - load.ctx = m_pSm; - if (strstr(path, ".mp4") || strstr(path, ".MP4") ) load.isom = gf_isom_open(path, GF_ISOM_OPEN_READ, NULL); - gf_sm_load_init(&load); - gf_sm_load_run(&load); - gf_sm_load_done(&load); - if (load.isom) gf_isom_delete(load.isom); - - /* SceneManager should be initialized and filled correctly */ - - gf_sg_set_scene_size_info(m_pIs->graph, m_pSm->scene_width, m_pSm->scene_height, m_pSm->is_pixel_metrics); - - // TODO : replace with GetBifsStream - GF_StreamContext *sc = (GF_StreamContext *) gf_list_get(m_pSm->streams,0); - - if (sc->streamType == 3) { - GF_AUContext *au = (GF_AUContext *) gf_list_get(sc->AUs,0); - GF_Command *c = (GF_Command *) gf_list_get(au->commands,0); - //gf_sg_command_apply(m_pIs->graph, c, 0); - /* This is a patch to solve the save pb: - When ApplyCommand is made on a Scene Replace Command - The command node is set to NULL - When we save a BIFS stream whose first command is of this kind, - the file saver thinks the bifs commands should come from an NHNT file - This is a temporary patch */ - if (c->tag == GF_SG_SCENE_REPLACE) { c->node = m_pIs->graph->RootNode; } - } - - gf_sc_set_scene(term->compositor, m_pIs->graph); - m_pIs->graph_attached = 1; - - // TODO : read actual values from file - SetLength(50); - SetFrameRate(25); - - // retrieves all the node from the tree and adds them to the node pool - GF_Node * root = gf_sg_get_root_node(m_pIs->graph); -// CreateDictionnary(); -} - -void V4SceneManager::SaveFile(const char *path) -{ - GF_SMEncodeOptions opts; - char rad_name[5000]; - - /* First dump the scene in a BT file */ - strcpy(rad_name, "dump"); - m_pSm->scene_graph->RootNode = NULL; - gf_sm_dump(m_pSm, rad_name, 0); - - /* Then reload properly (overriding the current SceneManager)*/ - GF_SceneLoader load; - memset(&load, 0, sizeof(GF_SceneLoader)); - load.fileName = "dump.bt"; - load.ctx = m_pSm; - gf_sm_load_init(&load); - gf_sm_load_run(&load); - gf_sm_load_done(&load); - - /* Finally encode the file */ - GF_ISOFile *mp4 = gf_isom_open(path, GF_ISOM_WRITE_EDIT, NULL); - m_pSm->max_node_id = gf_sg_get_max_node_id(m_pSm->scene_graph); - memset(&opts, 0, sizeof(opts)); - opts.flags = GF_SM_LOAD_MPEG4_STRICT; - gf_sm_encode_to_file(m_pSm, mp4, &opts); - gf_isom_set_brand_info(mp4, GF_ISOM_BRAND_MP42, 1); - gf_isom_modify_alternate_brand(mp4, GF_ISOM_BRAND_ISOM, 1); - gf_isom_close(mp4); -} - -void V4SceneManager::SetSceneSize(int w, int h) -{ - gf_sg_set_scene_size_info(m_pIs->graph, w,h, 1); - /*reassign scene graph to update scene size in renderer*/ - gf_sc_set_scene(m_gpac_panel->GetMPEG4Terminal()->compositor, m_pIs->graph); - m_pIs->graph_attached = 1; -} - -void V4SceneManager::GetSceneSize(wxSize &size) -{ - gf_sg_get_scene_size_info(m_pIs->graph, (u32 *)&(size.x), (u32 *)&(size.y)); -} - -GF_Node *V4SceneManager::SetTopNode(u32 tag) -{ - GF_Node *root = NewNode(tag); - gf_sg_set_root_node(m_pIs->graph, root); - GF_StreamContext *sc = (GF_StreamContext *) gf_list_get(m_pSm->streams,0); - if (sc->streamType == 3) { - GF_AUContext *au = (GF_AUContext *) gf_list_get(sc->AUs,0); - GF_Command *c = (GF_Command *) gf_list_get(au->commands,0); - /* This is a patch to solve the save pb: - When ApplyCommand is made on a Scene Replace Command - The command node is set to NULL - When we save a BIFS stream whose first command is of this kind, - the file saver thinks the bifs commands should come from an NHNT file - This is a temporary patch */ - if (c->tag == GF_SG_SCENE_REPLACE) { - c->node = m_pIs->graph->RootNode; - gf_node_register(m_pIs->graph->RootNode, NULL); - } - } - return root; -} - -GF_Node *V4SceneManager::NewNode(u32 tag) -{ - GF_Node *n = gf_node_new(m_pIs->graph, tag); - if (!n) return NULL; - gf_node_init(n); - return n; -} - -GF_Node *V4SceneManager::CopyNode(GF_Node *node, GF_Node *parent, bool copy) -{ - if (copy) return CloneNodeForEditing(m_pIs->graph, node); - u32 nodeID = gf_node_get_id(node); - if (!nodeID) { - nodeID = gf_sg_get_next_available_node_id(m_pIs->graph); - gf_node_set_id(node, nodeID, NULL); - gf_node_register(node, parent); - } - return node; -} - -extern "C" { - -GF_Node *CloneNodeForEditing(GF_SceneGraph *inScene, GF_Node *orig) //, GF_Node *cloned_parent) -{ - u32 i, j, count; - GF_Node *node, *child, *tmp; - GF_ChildNodeItem *list, *list2; - GF_FieldInfo field_orig, field; - - /*this is not a mistake*/ - if (!orig) return NULL; - - /*check for DEF/USE - if (orig->sgprivate->NodeID) { - node = gf_sg_find_node(inScene, orig->sgprivate->NodeID); - //node already created, USE - if (node) { - gf_node_register(node, cloned_parent); - return node; - } - } - */ - /*create a node*/ -/* - if (orig->sgprivate->tag == TAG_MPEG4_ProtoNode) { - proto_node = ((GF_ProtoInstance *)orig)->proto_interface; - //create the instance but don't load the code -c we MUST wait for ISed routes to be cloned before - node = gf_sg_proto_create_node(inScene, proto_node, (GF_ProtoInstance *) orig); - } else { -*/ - node = gf_node_new(inScene, gf_node_get_tag(orig)); -// } - - count = gf_node_get_field_count(orig); - - /*copy each field*/ - for (i=0; isgprivate->NodeID) { - Node_SetID(node, orig->sgprivate->NodeID); - gf_node_register(node, cloned_parent); - }*/ - - /*init node before creating ISed routes so the eventIn handler are in place*/ - if (gf_node_get_tag(node) != TAG_ProtoNode) gf_node_init(node); - - return node; -} - -} // extern "C" - - -// GetBifsStream -- gets the first stream with id = 3 -GF_StreamContext * V4SceneManager::GetBifsStream() { - GF_StreamContext * ctx = NULL; - u32 count = gf_list_count(m_pSm->streams); - - // cycle trough each stream - while (count--) { - ctx = (GF_StreamContext *) gf_list_get(m_pSm->streams, count); - if (ctx->streamType == 3) break; - } - - if (ctx == NULL) return NULL; - - // if we went through the loop without finding any BIFS stream return null - if (ctx->streamType != 3) return NULL; - - return ctx; -} - - -// CreateDictionnary -- Create the root node of the dictionnary and populates it -void V4SceneManager::CreateDictionnary() { - GF_Node * root = gf_sg_get_root_node(m_pIs->graph); - dictionnary = NewNode(TAG_MPEG4_Switch); - - // Insert the dictionnary in the scene and gives it a name - gf_node_insert_child(root, dictionnary, 0); - gf_node_register(dictionnary, root); - gf_node_set_id(dictionnary, gf_sg_get_next_available_node_id(m_pIs->graph), DICTNAME); - - // makes the dictionnary invisible - // the number 1 field is the "whichChoice", setting it to -1 makes it display nothing - GF_FieldInfo field; - gf_node_get_field(dictionnary, 1, &field); - frame->GetFieldView()->SetFieldValue(field, &wxString("-1"), -1); // TODO : maybe put the method SetFieldValue somewhere more accessible - - // populates dictionnary with the root node of the scene - AddToDictionnary(root); -} - - -// AddToDictionnary -- adds a node to the dictionnary, increases its reference count, the node must already have an ID -// WARNING : does not add the node to the pool if it has a parent in the dictionnary -void V4SceneManager::AddToDictionnary(GF_Node * node) { - - // checks if nodes has a parent with an id - // if true then there is already a reference to this node - if (HasDefParent(node)) return; - - AddRecursive(node); -} - - -// AddRecursive -- recursively adds items with an ID to the dictionnary -void V4SceneManager::AddRecursive(GF_Node * node, bool parentAdded) { - - // skips empty nodes - if (!node) return; - - // skips the dictionnary - const char * c = gf_node_get_name(node); - if ( (c != NULL) && (!strcmp(c, DICTNAME)) ) return; - - // if node as an id adds it to the dictionnary and the node pool - u32 id = gf_node_get_id(node); - if (id) { - pools.Add(node); - // children of added node are not added to the dictionnary - if (!parentAdded) AddEffective(node); - parentAdded = true; - } - - GF_FieldInfo field; - GF_ChildNodeItem * list; - int count = gf_node_get_field_count(node); - - // tests all fields, if a field is a node then adds it and process its children recursively - for (int i=0; iGetTimeLine()->SetLength(length_); -} \ No newline at end of file diff --git a/applications/v4studio/V4SceneManager.h b/applications/v4studio/V4SceneManager.h deleted file mode 100644 index 3cb4209..0000000 --- a/applications/v4studio/V4SceneManager.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef _V4SceneManager_H -#define _V4SceneManager_H - -#include "safe_include.h" -#include -#include -#include // MPEG4CLIENT -#include "wxGPACPanel.h" -#include "V4NodePools.h" - - -#include - - -#define DICTNAME "__V4dictionnary" - - -class V4StudioFrame; - -extern "C" { - GF_Node *CloneNodeForEditing(GF_SceneGraph *inScene, GF_Node *orig); - int GetNextNodeID(GF_SceneGraph *sg); -} - -class V4SceneManager { -public: - // Constructor / Desctructor - V4SceneManager(V4StudioFrame *parent); - ~V4SceneManager(); - - // reusable nodes, sorted by tag - V4NodePools pools; - - /* file management functions */ - - void SaveFile(const char * path); - - void LoadCommon(); - void LoadNew(); - void LoadFile(const char *path); - - /* Node management functions */ - - GF_Node *NewNode(u32 tag); - GF_Node *CopyNode(GF_Node *node, GF_Node *parent, bool copy); - GF_Node *SetTopNode(u32 tag); // TODO : will destroy dictionnary - - void CreateIDandAddToPool(GF_Node *node); - - /* Dictionnary functions */ - - // adds a node to the dictionnary, increases its reference count, the node must already have an ID - void AddToDictionnary(GF_Node * node); - - // removes a node from the dictionnary = DELETES it's ID - void RemoveFromDictionnary(GF_Node * node); - - GF_Node * GetDictionnary() const; - - - /* Various */ - - void LoadCommand(u32 commandNumber); // ? - GF_StreamContext * GetBifsStream(); // Get the first stream with id = 3 - - - /* access to private members */ - - // SceneSize - void SetSceneSize(int w, int h); - void GetSceneSize(wxSize &size); - - // FrameRate - void SetFrameRate(const u32 framerate_) { frameRate = framerate_; } - u32 GetFrameRate() const { return frameRate; } - - // accesses Length - void SetLength(const u32 length_); - u32 GetLength() const { return length; } - - // accesses units - void SetUnits(u32 units_) { units = units_; } - u32 GetUnits() const { return units; } - - - - GF_Compositor *GetSceneCompositor() { return m_gpac_panel->GetSceneCompositor(); } - - // GF_InlineScene - GF_InlineScene *GetInlineScene() { return m_pIs; } - - // SceneGraph - GF_SceneGraph *GetSceneGraph() { return m_pIs->graph; } - GF_Node *GetRootNode() { return gf_sg_get_root_node(m_pIs->graph); } - - wxGPACPanel *GetGPACPanel() { return m_gpac_panel; } - V4StudioFrame *GetV4StudioFrame() { return frame; } - - // TODO : terminal - private: - - /* dictionnary function */ - - // initializes the dictionnary node - void CreateDictionnary(); - - // Finds all node with an ID from the given node and adds them to the node pool and the dictionnary - void AddRecursive(GF_Node * node, bool parentAdded = false); - - // calls a proper function to add the node according to its type - void AddEffective(GF_Node * node); - - // Create a dummy node of type tag and it to the specified field (or reimplace if the field is single valued) - GF_Node * CreateDummyNode(const u32 tag, GF_Node * parent, const u32 fieldIndex); - - // Sets the first node as a child of the second using the given field - void MakeChild(GF_Node * child, GF_Node * parent, const u32 fieldIndex); - - // Checks is specified node as a parent with an ID - GF_Node * V4SceneManager::HasDefParent(GF_Node * node); - - // adds a node to the dictionnary - void AddGen(GF_Node * node); - void AddGeometry(GF_Node * node); - void AddAppearance(GF_Node * node); - void AddTexture(GF_Node * node); - void AddMaterial(GF_Node * node); - - -protected: - - // self created - LPINLINESCENE m_pIs; - GF_SceneManager *m_pSm; - GF_Node *dictionnary; - wxGPACPanel *m_gpac_panel; - - // from other objects - V4StudioFrame *frame; - - u8 frameRate; - u32 length; // in frames! - u32 units; // = 1000 - -}; - -#endif - diff --git a/applications/v4studio/V4Service.cpp b/applications/v4studio/V4Service.cpp deleted file mode 100644 index 34bf3bc..0000000 --- a/applications/v4studio/V4Service.cpp +++ /dev/null @@ -1,205 +0,0 @@ -#include "V4Service.h" - -#include - -#define V4_PRIVATE_SCENE_OTI 0xFF - -extern "C" { - - -V4Channel *V4Service::V4_GetChannel(V4Service *v4service, LPNETCHANNEL ch) -{ - u32 i; - for (i=0; ichannels); i++) { - V4Channel *v4c = (V4Channel *)gf_list_get(v4service->channels, i); - if (v4c->ch && v4c->ch==ch) return v4c; - } - return NULL; -} - -Bool V4Service::V4_RemoveChannel(V4Service *v4service, LPNETCHANNEL ch) -{ - u32 i; - for (i=0; ichannels); i++) { - V4Channel *v4c = (V4Channel *)gf_list_get(v4service->channels, i); - if (v4c->ch && v4c->ch==ch) { - gf_list_rem(v4service->channels, i); - gf_free(v4c); - return 1; - } - } - return 0; -} - -static Bool V4_CanHandleURL(GF_InputService *plug, const char *url) -{ - return 1; -} - -static GF_Err V4_ConnectService (GF_InputService *plug, GF_ClientService *serv, const char *url) -{ - V4Service *v4serv = (V4Service *)plug->priv; - v4serv->SetService(serv); - gf_term_on_connect(v4serv->GetService(), NULL, GF_OK); - return GF_OK; -} - -static GF_Err V4_CloseService(GF_InputService *plug) -{ - V4Service *v4serv = (V4Service *)plug->priv; - gf_term_on_disconnect(v4serv->GetService(), NULL, GF_OK); - return GF_OK; -} - -static GF_Descriptor *V4_GetServiceDesc(GF_InputService *plug, u32 expect_type, const char *sub_url) -{ - V4Service *v4service= (V4Service *) plug->priv; - GF_ESD *esd; - GF_InitialObjectDescriptor *iod = (GF_InitialObjectDescriptor *) gf_odf_desc_new(GF_ODF_IOD_TAG); - iod->scene_profileAndLevel = 1; - iod->graphics_profileAndLevel = 1; - iod->OD_profileAndLevel = 1; - iod->audio_profileAndLevel = 0xFE; - iod->visual_profileAndLevel = 0xFE; - iod->objectDescriptorID = 1; - - esd = gf_odf_desc_esd_new(0); - esd->slConfig->timestampResolution = 1000; - esd->slConfig->useTimestampsFlag = 1; - esd->ESID = 0xFFFE; - esd->decoderConfig->streamType = GF_STREAM_PRIVATE_SCENE; - esd->decoderConfig->objectTypeIndication = 0x01; //V4_PRIVATE_SCENE_OTI; - if (v4service->GetPath()) { - esd->decoderConfig->decoderSpecificInfo->dataLength = strlen(v4service->GetPath()) + 1; - esd->decoderConfig->decoderSpecificInfo->data = gf_strdup(v4service->GetPath()); - } - gf_list_add(iod->ESDescriptors, esd); - return (GF_Descriptor *)iod; -} - -static GF_Err V4_ConnectChannel(GF_InputService *plug, LPNETCHANNEL channel, const char *url, Bool upstream) -{ - u32 ESID; - V4Service *v4serv = (V4Service *)plug->priv; - - sscanf(url, "ES_ID=%ud", &ESID); - if (!ESID) { - gf_term_on_connect(v4serv->GetService(), channel, GF_STREAM_NOT_FOUND); - } else { - V4Channel *v4c = (V4Channel *)gf_malloc(sizeof(V4Channel)); - memset(v4c, 0, sizeof(V4Channel)); - v4c->ch = channel; - v4c->ESID = ESID; - gf_list_add(v4serv->GetChannels(), v4c); - gf_term_on_connect(v4serv->GetService(), channel, GF_OK); - } - return GF_OK; -} - -static GF_Err V4_DisconnectChannel(GF_InputService *plug, LPNETCHANNEL channel) -{ - V4Service *v4serv = (V4Service *)plug->priv; - Bool had_ch; - - had_ch = v4serv->V4_RemoveChannel(v4serv, channel); - gf_term_on_disconnect(v4serv->GetService(), channel, had_ch ? GF_OK : GF_STREAM_NOT_FOUND); - return GF_OK; -} - -static GF_Err V4_ServiceCommand(GF_InputService *plug, GF_NetworkCommand *com) -{ - V4Service *v4serv = (V4Service *)plug->priv; - V4Channel *v4c; - - if (!com->base.on_channel) return GF_OK; - - v4c = v4serv->V4_GetChannel(v4serv, com->base.on_channel); - if (!v4c) return GF_STREAM_NOT_FOUND; - - switch (com->command_type) { - case GF_NET_CHAN_SET_PULL: return GF_OK; - case GF_NET_CHAN_INTERACTIVE: return GF_OK; - case GF_NET_CHAN_SET_PADDING: return GF_NOT_SUPPORTED; - case GF_NET_CHAN_BUFFER: - com->buffer.max = com->buffer.min = 0; - return GF_OK; - case GF_NET_CHAN_DURATION: - /*this is not made for updates, use undefined duration*/ - com->duration.duration = 0; - return GF_OK; - case GF_NET_CHAN_PLAY: - v4c->start = (u32) (1000 * com->play.start_range); - v4c->end = (u32) (1000 * com->play.end_range); - return GF_OK; - case GF_NET_CHAN_STOP: - return GF_OK; - case GF_NET_CHAN_CONFIG: return GF_OK; - case GF_NET_CHAN_GET_DSI: - com->get_dsi.dsi = NULL; - com->get_dsi.dsi_len = 0; - return GF_OK; - } - return GF_OK; -} - -static GF_Err V4_ChannelGetSLP(GF_InputService *plug, LPNETCHANNEL channel, char **out_data_ptr, u32 *out_data_size, GF_SLHeader *out_sl_hdr, Bool *sl_compressed, GF_Err *out_reception_status, Bool *is_new_data) -{ - V4Channel *v4c; - V4Service *v4serv = (V4Service *)plug->priv; - v4c = v4serv->V4_GetChannel(v4serv, channel); - if (!v4c) return GF_STREAM_NOT_FOUND; - - memset(out_sl_hdr, 0, sizeof(GF_SLHeader)); - out_sl_hdr->compositionTimeStampFlag = 1; - out_sl_hdr->compositionTimeStamp = v4c->start; - out_sl_hdr->accessUnitStartFlag = 1; - *sl_compressed = 0; - *out_reception_status = GF_OK; - *is_new_data = 1; - return GF_OK; return GF_OK; -} - -static GF_Err V4_ChannelReleaseSLP(GF_InputService *plug, LPNETCHANNEL channel) -{ - return GF_OK; -} - -static Bool V4_CanHandleURLInService(GF_InputService *plug, const char *url) -{ - return 0; -} - -} // extern "C" - -V4Service::V4Service(const char *path) -{ - - m_pNetClient = (GF_InputService *)gf_malloc(sizeof(GF_InputService)); - m_pNetClient->priv = this; - - m_pNetClient->CanHandleURL = V4_CanHandleURL; - - m_pNetClient->ConnectService = V4_ConnectService; - m_pNetClient->CloseService = V4_CloseService; - - m_pNetClient->ConnectChannel = V4_ConnectChannel; - m_pNetClient->DisconnectChannel = V4_DisconnectChannel; - - m_pNetClient->GetServiceDescriptor = V4_GetServiceDesc; - m_pNetClient->ServiceCommand = V4_ServiceCommand; - - m_pNetClient->ChannelGetSLP = V4_ChannelGetSLP; - m_pNetClient->ChannelReleaseSLP = V4_ChannelReleaseSLP; - - m_pNetClient->CanHandleURLInService = V4_CanHandleURLInService; - - channels = gf_list_new(); - if (path) m_path = gf_strdup(path); -} - -V4Service::~V4Service() -{ - if (m_path) gf_free(m_path); - gf_list_del(channels); - gf_free(m_pNetClient); -} diff --git a/applications/v4studio/V4Service.h b/applications/v4studio/V4Service.h deleted file mode 100644 index 183a367..0000000 --- a/applications/v4studio/V4Service.h +++ /dev/null @@ -1,42 +0,0 @@ -#include "safe_include.h" -#include - -typedef struct -{ - u32 ESID; - LPNETCHANNEL ch; - u32 start, end; -} V4Channel; - - -class V4Service { -public: - - V4Service(const char*path); - ~V4Service(); - - void SetService(GF_ClientService *s) { m_pService = s; } - GF_ClientService *GetService() { return m_pService; } - - void SetPath(char *path) { m_path = path; } - char *GetPath() { return m_path; } - - GF_List* GetChannels() { return channels; } - V4Channel *V4_GetChannel(V4Service *v4service, LPNETCHANNEL ch); - Bool V4_RemoveChannel(V4Service *v4service, LPNETCHANNEL ch); - - GF_InputService *GetServiceInterface() { return m_pNetClient; } - -protected: - - /* the interface given to the GPAC Core */ - GF_InputService *m_pNetClient; - - /* The actual GPAC Core service returned by the interface */ - GF_ClientService *m_pService; - /* All the channels of the current service */ - GF_List *channels; - - /* The path to the currently load file */ - char *m_path; -}; \ No newline at end of file diff --git a/applications/v4studio/V4StudioApp.cpp b/applications/v4studio/V4StudioApp.cpp deleted file mode 100644 index 32fef26..0000000 --- a/applications/v4studio/V4StudioApp.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "safe_include.h" - -#include "wx/wxprec.h" - -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include "V4StudioApp.h" -#include "V4StudioFrame.h" -#include -//#include - -IMPLEMENT_APP(V4StudioApp) - -bool V4StudioApp::OnInit() -{ - wxFrame *frame = new V4StudioFrame(); - frame->Show(TRUE); - SetTopWindow(frame); - return true; -} - diff --git a/applications/v4studio/V4StudioApp.h b/applications/v4studio/V4StudioApp.h deleted file mode 100644 index fe70266..0000000 --- a/applications/v4studio/V4StudioApp.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _V4STUDIO_APP_H -#define _V4STUDIO_APP_H - -class V4StudioApp : public wxApp -{ -public: - virtual bool OnInit(); -protected: -private: -}; - -DECLARE_APP(V4StudioApp) - -#endif - diff --git a/applications/v4studio/V4StudioFrame.cpp b/applications/v4studio/V4StudioFrame.cpp deleted file mode 100644 index d51a78e..0000000 --- a/applications/v4studio/V4StudioFrame.cpp +++ /dev/null @@ -1,951 +0,0 @@ -#include "safe_include.h" - -#include "wx/wxprec.h" - -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include "V4StudioFrame.h" -#include "wx/xrc/xmlres.h" - - -#include -#include // GF_Terminal -#include - -V4StudioFrame::V4StudioFrame(): - wxFrame((wxFrame *) NULL, -1, "V4Studio", wxPoint(50, 50), wxSize(800, 700)) -{ - - m_pV4sm = NULL; - - m_selection = NULL; - m_parentSelection = NULL; - m_clipboardNode = NULL; - - m_frame = 0; // we start at frame=0 - editDict = false; - - // Creates components and places them on the form - fieldView = new V4FieldList(this, wxSize(100,250)); - treeView = new V4StudioTree(this, wxSize(100,250), fieldView); - timeLine = new V4TimeLine(this); - timeLine->SetSize(500, 100); - cmdPanel = new V4CommandPanel(this); - cmdPanel->SetSize(100, 100); - - /*new m_pFileMenu bar*/ - wxMenuBar *b = new wxMenuBar(); - /*file*/ - m_pFileMenu = new wxMenu(); - m_pFileMenu->Append(MENU_FILE_NEW, "&New\tCtrl+N", "Create a new document"); - m_pFileMenu->Append(MENU_FILE_OPEN, "&Open...\tCtrl+O", "Open an existing document"); - m_pFileMenu->Append(MENU_FILE_SAVE, "&Save\tCtrl+S", "Save the active document"); - m_pFileMenu->Append(MENU_FILE_CLOSE, "&Close\tCtrl+X", "Close the active document"); - m_pFileMenu->AppendSeparator(); - m_pFileMenu->Append(CHANGE_SIZE_DIALOG, "&Size\tCtrl+Z", "Change scene size"); - m_pFileMenu->Append(CHANGE_FRAMERATE, "&FrameRate\tCtrl+F", "Change FrameRate"); - m_pFileMenu->Append(CHANGE_LENGTH, "&Length\tCtrl+L", "Change Length"); - m_pFileMenu->AppendSeparator(); - m_pFileMenu->Append(MENU_FILE_QUIT, "E&xit", "Quit the application; prompts to save documents"); - b->Append(m_pFileMenu, "&File"); - SetMenuBar(b); - - /*file*/ - m_pToolsMenu = new wxMenu(); - m_pToolsMenu->Append(MENU_TOOL_SHOW_LOWLEVEL, "&Low-Level\tCtrl+L", "Shows the low-level toolbar"); - m_pToolsMenu->Append(MENU_TOOL_SHOW_HIGHLEVEL, "&High-Level\tCtrl+H", "Shows the high-level toolbar"); - b->Append(m_pToolsMenu, "&Tools"); - SetMenuBar(b); - - m_pStatusbar = CreateStatusBar(); - - // Main Toolbar - m_pMainToolbar = new wxToolBar(this, -1, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL|wxTB_FLAT); - m_pMainToolbar->AddTool(TOOL_FILE_NEW, _("New"), wxBitmap (wxT("rc\\new.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Open a new file"), wxT("")); - m_pMainToolbar->AddTool(TOOL_FILE_OPEN, _("Open"), wxBitmap (wxT("rc\\open.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Open an existing file (BT/XMT/MP4)"), wxT("")); - m_pMainToolbar->AddTool(TOOL_FILE_SAVE, _("Save"), wxBitmap (wxT("rc\\save.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Save to a file"), wxT("")); - m_pMainToolbar->AddTool(TOOL_FILE_CLOSE, _("Close"), wxBitmap (wxT("rc\\close.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Close the file"), wxT("")); - m_pMainToolbar->AddSeparator(); - m_pMainToolbar->AddTool(TOOL_FILE_PREVIEW, _("Preview"), wxBitmap (wxT("rc\\preview.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Preview in player"), wxT("")); - m_pMainToolbar->AddSeparator(); - m_pMainToolbar->AddTool(TOOL_EDIT_CUT, _("Cut"), wxBitmap (wxT("rc\\cut.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Cut"), wxT("")); - m_pMainToolbar->AddTool(TOOL_EDIT_COPY, _("Copy"), wxBitmap (wxT("rc\\copy.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Copy"), wxT("")); - m_pMainToolbar->AddTool(TOOL_EDIT_PASTE, _("Paste"), wxBitmap (wxT("rc\\paste.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Paste"), wxT("")); - m_pMainToolbar->AddTool(TOOL_EDIT_PASTE_USE, _("PastePlus"), wxBitmap (wxT("rc\\paste_use.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Paste a USE"), wxT("")); - m_pMainToolbar->AddTool(TOOL_EDIT_DELETE, _("Delete"), wxBitmap (wxT("rc\\delete.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Delete"), wxT("")); - m_pMainToolbar->AddSeparator(); - m_pMainToolbar->AddTool(TOOL_EDIT_UNDO, _("Undo"), wxBitmap (wxT("rc\\undo.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Undo"), wxT("")); - m_pMainToolbar->AddTool(TOOL_EDIT_REDO, _("Redo"), wxBitmap (wxT("rc\\redo.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Redo"), wxT("")); - m_pMainToolbar->AddSeparator(); - - m_pMainToolbar->AddSeparator(); - - m_pMainToolbar->AddTool(TOOL_ADD_TO_TL, _("AddToTL"), wxBitmap( wxT("rc\\paste.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Add to timeLine"), wxT("")); - m_pMainToolbar->AddTool(TOOL_NEXT_FRAME, _("NextFrame"), wxBitmap( wxT("rc\\redo.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Next frame"), wxT("")); - m_pMainToolbar->AddTool(TOOL_VIEW_DICT, _("ViewDict"), wxBitmap( wxT("rc\\open.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("View Dictionnary"), wxT("")); - - /* Not Implemented yet */ - m_pMainToolbar->EnableTool(TOOL_FILE_PREVIEW, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_UNDO, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_REDO, false); - m_pMainToolbar->EnableTool(TOOL_NEXT_FRAME, false); - - /* Not available when starting V4Studio */ - /* Nothing to save */ - m_pFileMenu->Enable(MENU_FILE_SAVE, false); - m_pFileMenu->Enable(MENU_FILE_CLOSE, false); - m_pFileMenu->Enable(CHANGE_SIZE_DIALOG, false); - m_pFileMenu->Enable(CHANGE_LENGTH, false); - m_pFileMenu->Enable(CHANGE_FRAMERATE, false); - m_pMainToolbar->EnableTool(TOOL_FILE_SAVE, false); - m_pMainToolbar->EnableTool(TOOL_FILE_CLOSE, false); - - /* Nothing to edit */ - m_pMainToolbar->EnableTool(TOOL_EDIT_CUT, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_COPY, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_PASTE, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_PASTE_USE, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_DELETE, false); - - m_pMainToolbar->EnableTool(TOOL_ADD_TO_TL, false); - m_pMainToolbar->EnableTool(TOOL_VIEW_DICT, false); - m_pMainToolbar->Realize(); - SetToolBar(m_pMainToolbar); - - m_uSelectedNodeToolBar = 0; - // Node Creation Toolbar - m_pLowLevelNodeToolbar = new wxToolBar(this, -1, wxDefaultPosition, wxDefaultSize, wxTB_VERTICAL|wxTB_FLAT); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_ORDEREDGROUP, _("OrderedGroup"), wxBitmap (wxT("rc\\orderedgroup.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create an OrderedGroup"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_LAYER2D, _("Layer2D"), wxBitmap (wxT("rc\\layer2d.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create a Layer2D"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_TRANSFORM2D, _("Transform2D"), wxBitmap (wxT("rc\\t2d.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create a Tranform2D"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_TRANSFORMMATRIX2D, _("TransformMatrix2D"), wxBitmap (wxT("rc\\tm2d.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create a TranformMatrix2D"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_COLOR_TRANSFORM, _("ColorTransform"), wxBitmap (wxT("rc\\colortransform.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create a ColorTransform"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_SHAPE, _("Shape"), wxBitmap (wxT("rc\\shape.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create a Shape"), wxT("")); - m_pLowLevelNodeToolbar->AddSeparator(); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_APPEARANCE, _("Appearance"), wxBitmap (wxT("rc\\appearance.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create an Appearance"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_MATERIAL2D, _("Material2D"), wxBitmap (wxT("rc\\material2d.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create a Material2D"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_LINEPROPS, _("LineProps"), wxBitmap (wxT("rc\\lineproperties.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create a LineProperties"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_LINEAR_GRADIENT, _("LinearGradient"), wxBitmap (wxT("rc\\lg.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create a Linear Gradient"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_RADIAL_GRADIENT, _("RadialGradient"), wxBitmap (wxT("rc\\rg.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create a Radial Gradient"), wxT("")); - m_pLowLevelNodeToolbar->AddSeparator(); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_RECT, _("Rectangle"), wxBitmap (wxT("rc\\rect.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create a Rectangle"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_CIRCLE, _("Circle"), wxBitmap (wxT("rc\\circle.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create a Rectangle"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_IFS2D, _("IndexedFaceSet2D"), wxBitmap (wxT("rc\\ifs2d.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create an IndexedFaceSet2D"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_ILS2D, _("IndexedLineSet2D"), wxBitmap (wxT("rc\\ils2d.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create an IndexedLineSet2D"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_XLINEPROPS, _("XLineProps"), wxBitmap (wxT("rc\\xlineproperties.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create an XLineProperties"), wxT("")); - m_pLowLevelNodeToolbar->AddSeparator(); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_TEXT, _("Text"), wxBitmap (wxT("rc\\text.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create a Text"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_FONTSTYLE, _("FontStyle"), wxBitmap (wxT("rc\\fs.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Create a FontStyle"), wxT("")); - m_pLowLevelNodeToolbar->AddSeparator(); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_BACKGROUND2D, _("Background2D"), wxBitmap (wxT("rc\\image.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Add a Background2D"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_MOVIE, _("Movie"), wxBitmap (wxT("rc\\movie.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Add a Movie"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_IMAGE, _("Image"), wxBitmap (wxT("rc\\image.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Add an Image"), wxT("")); - m_pLowLevelNodeToolbar->AddTool(TOOL_NEW_SOUND, _("Sound"), wxBitmap (wxT("rc\\sound.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Add a Sound"), wxT("")); - m_pLowLevelNodeToolbar->Realize(); - -/* - m_pHighLevelNodeToolbar = new wxToolBar(this, -1, wxDefaultPosition, wxDefaultSize, wxTB_VERTICAL|wxTB_FLAT); - m_pHighLevelNodeToolbar->AddTool(TOOL_NEW_2DSCENE, _("OrderedGroup"), wxBitmap (wxT("rc\\orderedgroup.bmp"), wxBITMAP_TYPE_ANY), wxNullBitmap, wxITEM_NORMAL, _("Creates a 2D scene"), wxT("")); - m_pHighLevelNodeToolbar->Realize(); -*/ - set_properties(); - do_layout(); - UpdateToolBar(); -} - -V4StudioFrame::~V4StudioFrame() -{ -} - - -/* Functions that changes scene parameters */ - -void V4StudioFrame::OnChangeFrameRate(wxCommandEvent &event) { - if (!m_pV4sm) return; - - u32 l = m_pV4sm->GetFrameRate(); - wxString sFR; - sFR.Printf("%d", l); - - wxTextEntryDialog dialog(this, _T("Enter scene framerate"), _T("one positive integer number"), sFR, wxOK | wxCANCEL); - - if (dialog.ShowModal() != wxID_OK) { - dialog.Destroy(); - return; - } - - sscanf(dialog.GetValue(), "%d", &l); - m_pV4sm->SetFrameRate(l); - - dialog.Destroy(); - SceneGraphChanged(); -} - - -void V4StudioFrame::OnChangeLength(wxCommandEvent &event) { - if (!m_pV4sm) return; - u32 l = m_pV4sm->GetLength(); - wxString sLength; - sLength.Printf("%d", l); - - wxTextEntryDialog dialog(this, _T("Enter scene length"), _T("one positive integer number"), sLength, wxOK | wxCANCEL); - - if (dialog.ShowModal() != wxID_OK) { - dialog.Destroy(); - return; - } - - sscanf(dialog.GetValue(), "%d", &l); - m_pV4sm->SetLength(l); - - dialog.Destroy(); - SceneGraphChanged(); -} - -void V4StudioFrame::OnChangeSize(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - u32 w, h; - wxSize sceneSize; - m_pV4sm->GetSceneSize(sceneSize); - w = sceneSize.GetX(); - h = sceneSize.GetY(); - wxString sSize; - sSize.Printf("%d %d", w, h); - wxTextEntryDialog dialog(this, - _T("Enter the scene width and height"), - _T("Please enter two integer numbers"), - sSize, - wxOK | wxCANCEL); - - while (dialog.ShowModal() != wxID_OK && w == 0 && h == 0) {} - sscanf(dialog.GetValue(), "%d %d", &w, &h); - m_pV4sm->SetSceneSize(w,h); - dialog.Destroy(); - SceneGraphChanged(); -} - -// Dispatchs the new scene graph to all the sub components who need it. -void V4StudioFrame::SceneGraphChanged() -{ - m_parentSelection = NULL; - m_selection = (!m_pV4sm ? NULL : m_pV4sm->GetRootNode()); - Layout(); - Update(); -} - -void V4StudioFrame::set_properties() -{ - SetTitle(_("V4Studio")); - wxIcon _icon; - _icon.CopyFromBitmap(wxBitmap(_("rc\\v4.bmp"), wxBITMAP_TYPE_ANY)); - SetIcon(_icon); - SetSize(wxSize(500, 500)); -} - - -void V4StudioFrame::do_layout() -{ - wxBoxSizer * sizer_6 = new wxBoxSizer(wxVERTICAL); // top = treeview + fieldview; bottom = timeline + command panel - wxBoxSizer * sizer_7 = new wxBoxSizer(wxHORIZONTAL); // right = timeline, left = command panel - wxBoxSizer * sizer_8 = new wxBoxSizer(wxHORIZONTAL); // right = treeview; left = fieldview - - sizer_6->Add(sizer_8, 2, wxEXPAND, 0); // height of treeview twice bigger thant height of timeline - sizer_6->Add(sizer_7, 1, wxEXPAND, 0); - - sizer_7->Add(timeLine, 3, wxEXPAND, 0); - sizer_7->Add(cmdPanel, 1, wxEXPAND, 0); - - sizer_8->Add(treeView, 1, wxEXPAND, 0); - sizer_8->Add(fieldView, 1, wxEXPAND, 0); - - wxBoxSizer* sizer_9 = new wxBoxSizer(wxHORIZONTAL); - - sizer_9->Add(m_pLowLevelNodeToolbar, 0, wxEXPAND, 0); -/* - if (m_uSelectedNodeToolBar == 0) sizer_9->Add(m_pLowLevelNodeToolbar, 0, wxEXPAND, 0); - else sizer_9->Add(m_pHighLevelNodeToolbar, 0, wxEXPAND, 0); -*/ - - sizer_9->Add(sizer_6, 1, wxEXPAND, 0); - - SetSizer(sizer_9); - Layout(); - - cmdPanel->Layout(); -} - - -BEGIN_EVENT_TABLE(V4StudioFrame, wxFrame) - // m_pFileMenu events - EVT_MENU(MENU_FILE_NEW, V4StudioFrame::OnNew) - EVT_MENU(MENU_FILE_OPEN, V4StudioFrame::OnFileOpen) - EVT_MENU(MENU_FILE_SAVE, V4StudioFrame::OnSave) - EVT_MENU(MENU_FILE_CLOSE, V4StudioFrame::OnClose) - EVT_MENU(MENU_FILE_QUIT, V4StudioFrame::OnQuit) - EVT_MENU(CHANGE_SIZE_DIALOG, V4StudioFrame::OnChangeSize) - EVT_MENU(CHANGE_FRAMERATE, V4StudioFrame::OnChangeFrameRate) - EVT_MENU(CHANGE_LENGTH, V4StudioFrame::OnChangeLength) - - // m_pToolsMenu events - EVT_MENU(MENU_TOOL_SHOW_LOWLEVEL, V4StudioFrame::OnLowLevelTools) - EVT_MENU(MENU_TOOL_SHOW_HIGHLEVEL, V4StudioFrame::OnHighLevelTools) - - // edit toolbar events - EVT_TOOL(TOOL_FILE_NEW, V4StudioFrame::OnNew) - EVT_TOOL(TOOL_FILE_OPEN, V4StudioFrame::OnFileOpen) - EVT_TOOL(TOOL_FILE_SAVE, V4StudioFrame::OnSave) - EVT_TOOL(TOOL_FILE_CLOSE, V4StudioFrame::OnClose) - EVT_TOOL(TOOL_EDIT_CUT, V4StudioFrame::OnEditCut) - EVT_TOOL(TOOL_EDIT_COPY, V4StudioFrame::OnEditCopy) - EVT_TOOL(TOOL_EDIT_PASTE, V4StudioFrame::OnEditPaste) - EVT_TOOL(TOOL_EDIT_PASTE_USE, V4StudioFrame::OnEditPasteUse) - EVT_TOOL(TOOL_EDIT_DELETE, V4StudioFrame::OnEditDelete) - EVT_TOOL(TOOL_ADD_TO_TL, V4StudioFrame::OnAddToTimeLine) - EVT_TOOL(TOOL_NEXT_FRAME, V4StudioFrame::NextFrame) - EVT_TOOL(TOOL_VIEW_DICT, V4StudioFrame::SwitchView) - - // new toolbar events - EVT_TOOL(TOOL_NEW_ORDEREDGROUP, V4StudioFrame::OnNewOrderedGroup) - EVT_TOOL(TOOL_NEW_LAYER2D, V4StudioFrame::OnNewLayer2D) - EVT_TOOL(TOOL_NEW_TRANSFORM2D, V4StudioFrame::OnNewTransform2D) - EVT_TOOL(TOOL_NEW_TRANSFORMMATRIX2D, V4StudioFrame::OnNewTransformMatrix2D) - EVT_TOOL(TOOL_NEW_COLOR_TRANSFORM, V4StudioFrame::OnNewColorTransform) - EVT_TOOL(TOOL_NEW_SHAPE, V4StudioFrame::OnNewShape) - EVT_TOOL(TOOL_NEW_APPEARANCE, V4StudioFrame::OnNewAppearance) - EVT_TOOL(TOOL_NEW_LINEAR_GRADIENT, V4StudioFrame::OnNewLinearGradient) - EVT_TOOL(TOOL_NEW_RADIAL_GRADIENT, V4StudioFrame::OnNewRadialGradient) - EVT_TOOL(TOOL_NEW_MATERIAL2D, V4StudioFrame::OnNewMaterial2D) - EVT_TOOL(TOOL_NEW_LINEPROPS, V4StudioFrame::OnNewLineProps) - EVT_TOOL(TOOL_NEW_XLINEPROPS, V4StudioFrame::OnNewXLineProps) - EVT_TOOL(TOOL_NEW_RECT, V4StudioFrame::OnNewRect) - EVT_TOOL(TOOL_NEW_CIRCLE, V4StudioFrame::OnNewCircle) - EVT_TOOL(TOOL_NEW_TEXT, V4StudioFrame::OnNewText) - EVT_TOOL(TOOL_NEW_FONTSTYLE, V4StudioFrame::OnNewFontStyle) - EVT_TOOL(TOOL_NEW_SOUND, V4StudioFrame::OnNewSound) - EVT_TOOL(TOOL_NEW_BACKGROUND2D, V4StudioFrame::OnNewBackground2D) - EVT_TOOL(TOOL_NEW_IMAGE, V4StudioFrame::OnNewImageTexture) - EVT_TOOL(TOOL_NEW_MOVIE, V4StudioFrame::OnNewMovieTexture) -END_EVENT_TABLE() - -// Creates New Scene -void V4StudioFrame::OnNew(wxCommandEvent &event) -{ - m_pV4sm = new V4SceneManager(this); - m_pV4sm->LoadNew(); - - m_pMainToolbar->EnableTool(TOOL_ADD_TO_TL, true); - m_pMainToolbar->EnableTool(TOOL_VIEW_DICT, true); - m_pMainToolbar->EnableTool(TOOL_FILE_SAVE, true); - m_pFileMenu->Enable(MENU_FILE_SAVE, true); - m_pMainToolbar->EnableTool(TOOL_FILE_CLOSE, true); - m_pFileMenu->Enable(MENU_FILE_CLOSE, true); - m_pMainToolbar->EnableTool(TOOL_FILE_OPEN, false); - m_pFileMenu->Enable(MENU_FILE_OPEN, false); - m_pMainToolbar->EnableTool(TOOL_FILE_NEW, false); - m_pFileMenu->Enable(MENU_FILE_NEW, false); - m_pFileMenu->Enable(CHANGE_SIZE_DIALOG, true); - m_pFileMenu->Enable(CHANGE_LENGTH, true); - m_pFileMenu->Enable(CHANGE_FRAMERATE, true); - - Layout(); - SetStatusText("New scene", 0); - SceneGraphChanged(); - - OnChangeSize(event); -} - -// Opens an existing file -void V4StudioFrame::OnFileOpen(wxCommandEvent &event) -{ - wxFileDialog *dlg = new wxFileDialog(this, "Open a bt scene", - "", "", "BT Files (*.bt)|*.bt|MP4 Files (*.mp4)|*.mp4|XMT Files (*.xmt)|*.xmt|SWF Files (*.swf)|*.swf|All files (*.*)|*.*", - wxOPEN, wxDefaultPosition); - if ( dlg->ShowModal() == wxID_OK ) { - if (m_pV4sm) delete m_pV4sm; - m_pV4sm = new V4SceneManager(this); - m_pV4sm->LoadFile(dlg->GetPath().c_str()); - - m_pMainToolbar->EnableTool(TOOL_ADD_TO_TL, true); - m_pMainToolbar->EnableTool(TOOL_VIEW_DICT, true); - m_pMainToolbar->EnableTool(TOOL_FILE_SAVE, true); - m_pFileMenu->Enable(MENU_FILE_SAVE, true); - m_pMainToolbar->EnableTool(TOOL_FILE_CLOSE, true); - m_pFileMenu->Enable(MENU_FILE_CLOSE, true); - m_pMainToolbar->EnableTool(TOOL_FILE_OPEN, false); - m_pFileMenu->Enable(MENU_FILE_OPEN, false); - m_pMainToolbar->EnableTool(TOOL_FILE_NEW, false); - m_pFileMenu->Enable(MENU_FILE_NEW, true); - m_pFileMenu->Enable(CHANGE_SIZE_DIALOG, true); - m_pFileMenu->Enable(CHANGE_LENGTH, true); - m_pFileMenu->Enable(CHANGE_FRAMERATE, true); - - Layout(); - SetStatusText(dlg->GetFilename(), 0); - SceneGraphChanged(); - } - dlg->Destroy(); -} - -void V4StudioFrame::OnSave(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - wxFileDialog *dlg = new wxFileDialog(this, "Save the scene to an mp4 file", - "", "", "MPEG-4 Files (*.mp4)|*.mp4|All files (*.*)|*.*", - wxSAVE, wxDefaultPosition); - if ( dlg->ShowModal() == wxID_OK ) - { - m_pV4sm->SaveFile(dlg->GetPath().c_str()); - SetStatusText(dlg->GetFilename(), 0); - } - dlg->Destroy(); -} - -void V4StudioFrame::OnClose(wxCommandEvent &event) -{ - if (m_pV4sm) delete m_pV4sm; - m_pV4sm = NULL; - - m_pMainToolbar->EnableTool(TOOL_ADD_TO_TL, false); - m_pMainToolbar->EnableTool(TOOL_VIEW_DICT, false); - m_pMainToolbar->EnableTool(TOOL_FILE_SAVE, false); - m_pFileMenu->Enable(MENU_FILE_SAVE, false); - m_pMainToolbar->EnableTool(TOOL_FILE_CLOSE, false); - m_pFileMenu->Enable(MENU_FILE_CLOSE, false); - m_pMainToolbar->EnableTool(TOOL_FILE_OPEN, true); - m_pFileMenu->Enable(MENU_FILE_OPEN, true); - m_pMainToolbar->EnableTool(TOOL_FILE_NEW, true); - m_pFileMenu->Enable(MENU_FILE_NEW, true); - m_pFileMenu->Enable(CHANGE_SIZE_DIALOG, false); - m_pFileMenu->Enable(CHANGE_LENGTH, false); - m_pFileMenu->Enable(CHANGE_FRAMERATE, false); - - m_clipboardNode = NULL; - m_clipboardParentNode = NULL; - m_pMainToolbar->EnableTool(TOOL_EDIT_CUT, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_COPY, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_PASTE, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_PASTE_USE, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_DELETE, false); - Layout(); - SceneGraphChanged(); -} - -// Quits application -// TODO : memory leaks ! -void V4StudioFrame::OnQuit(wxCommandEvent &event) -{ - Close(FALSE); -} - -/**********************************************/ -/* Tools Menu methods */ -/**********************************************/ -void V4StudioFrame::OnLowLevelTools(wxCommandEvent &event) -{ - m_uSelectedNodeToolBar = 0; - do_layout(); -} - -void V4StudioFrame::OnHighLevelTools(wxCommandEvent &event) -{ - m_uSelectedNodeToolBar = 1; - do_layout(); -} - -/**********************************************/ -/* Functions to add components to the scene */ -/**********************************************/ -void V4StudioFrame::OnNewOrderedGroup(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *top = m_pV4sm->GetRootNode(); - if (!top) { - top = m_pV4sm->SetTopNode(TAG_MPEG4_OrderedGroup); - m_selection = top; - m_parentSelection = NULL; - } else { - GF_Node *og = m_pV4sm->NewNode(TAG_MPEG4_OrderedGroup); - gf_node_insert_child(m_selection, og, -1); - gf_node_register(og, m_selection); - m_parentSelection = m_selection; - m_selection = og; - } - Update(); -} - -void V4StudioFrame::OnNewLayer2D(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *top = m_pV4sm->GetRootNode(); - if (!top) { - top = m_pV4sm->SetTopNode(TAG_MPEG4_Layer2D); - m_selection = top; - m_parentSelection = NULL; - } else { - GF_Node *l2d = m_pV4sm->NewNode(TAG_MPEG4_Layer2D); - gf_node_insert_child(m_selection, l2d, -1); - gf_node_register(l2d, m_selection); - m_parentSelection = m_selection; - m_selection = l2d; - } - Update(); -} - -void V4StudioFrame::OnNewText(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *text = m_pV4sm->NewNode(TAG_MPEG4_Text); - M_Shape *shape = (M_Shape *)m_selection; - shape->geometry = text; - gf_node_register(text, m_selection); - m_parentSelection = m_selection; - m_selection = text; - Update(); -} - -void V4StudioFrame::OnNewFontStyle(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *fs = m_pV4sm->NewNode(TAG_MPEG4_FontStyle); - M_Text *text = (M_Text *)m_selection; - text->fontStyle = fs; - gf_node_register(fs, m_selection); - m_selection = fs; - m_parentSelection = (GF_Node *)text; - Update(); -} - -void V4StudioFrame::OnNewRect(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *rect = m_pV4sm->NewNode(TAG_MPEG4_Rectangle); - M_Shape *shape = (M_Shape *)m_selection; - shape->geometry = rect; - gf_node_register(rect, m_selection); - m_parentSelection = m_selection; - m_selection = rect; - Update(); -} - -void V4StudioFrame::OnNewCircle(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *circle = m_pV4sm->NewNode(TAG_MPEG4_Circle); - M_Shape *shape = (M_Shape *)m_selection; - shape->geometry = circle; - gf_node_register(circle, m_selection); - ((M_Circle *) circle)->radius = 75; - m_parentSelection = m_selection; - m_selection = circle; - Update(); -} - -void V4StudioFrame::OnNewTransform2D(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *t2d = m_pV4sm->NewNode(TAG_MPEG4_Transform2D); - if (!m_selection) m_selection = m_pV4sm->GetRootNode(); - gf_node_insert_child(m_selection, t2d, -1); - gf_node_register(t2d, m_selection); - m_parentSelection = m_selection; - m_selection = t2d; - Update(); -} - -void V4StudioFrame::OnNewColorTransform(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *ct = m_pV4sm->NewNode(TAG_MPEG4_ColorTransform); - if (!m_selection) m_selection = m_pV4sm->GetRootNode(); - gf_node_insert_child(m_selection, ct, -1); - gf_node_register(ct, m_selection); - m_parentSelection = m_selection; - m_selection = ct; - Update(); -} - -void V4StudioFrame::OnNewTransformMatrix2D(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *tm2d = m_pV4sm->NewNode(TAG_MPEG4_TransformMatrix2D); - if (!m_selection) m_selection = m_pV4sm->GetRootNode(); - gf_node_insert_child(m_selection, tm2d, -1); - gf_node_register(tm2d, m_selection); - m_parentSelection = m_selection; - m_selection = (GF_Node *)tm2d; - Update(); -} - -void V4StudioFrame::OnNewShape(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *shape = m_pV4sm->NewNode(TAG_MPEG4_Shape); - gf_node_insert_child(m_selection, shape, -1); - gf_node_register( shape, m_selection); - m_parentSelection = m_selection; - m_selection = (GF_Node *)shape; - Update(); -} - -void V4StudioFrame::OnNewAppearance(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *app = m_pV4sm->NewNode(TAG_MPEG4_Appearance); - M_Shape *shape = (M_Shape *)m_selection; - shape->appearance = app; - gf_node_register(app, m_selection); - m_parentSelection = m_selection; - m_selection = app; - Update(); -} - -void V4StudioFrame::OnNewLinearGradient(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *lg = m_pV4sm->NewNode(TAG_MPEG4_LinearGradient); - M_Appearance *app = (M_Appearance *)m_selection; - app->texture = lg; - gf_node_register(lg, m_selection); - m_parentSelection = m_selection; - m_selection = (GF_Node *)lg; - Update(); -} - -void V4StudioFrame::OnNewRadialGradient(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *rg = m_pV4sm->NewNode(TAG_MPEG4_RadialGradient); - M_Appearance *app = (M_Appearance *)m_selection; - app->texture = rg; - gf_node_register(rg, m_selection); - m_parentSelection = m_selection; - m_selection = rg; - Update(); -} - - -void V4StudioFrame::OnNewMaterial2D(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *mat2d = m_pV4sm->NewNode(TAG_MPEG4_Material2D); - M_Appearance *app = (M_Appearance *)m_selection; - app->material = mat2d; - gf_node_register(mat2d, m_selection); - m_parentSelection = m_selection; - - m_selection = mat2d; - Update(); -} - -void V4StudioFrame::OnNewLineProps(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *lp = m_pV4sm->NewNode(TAG_MPEG4_LineProperties); - M_Material2D *mat2d= (M_Material2D *)m_selection; - mat2d->lineProps = lp; - gf_node_register(lp, m_selection); - m_parentSelection = m_selection; - m_selection = lp; - Update(); -} - -void V4StudioFrame::OnNewXLineProps(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *lp = m_pV4sm->NewNode(TAG_MPEG4_XLineProperties); - M_Material2D *mat2d= (M_Material2D *)m_selection; - mat2d->lineProps = lp; - gf_node_register(lp, m_selection); - m_parentSelection = m_selection; - m_selection = lp; - Update(); -} - -void V4StudioFrame::OnNewSound(wxCommandEvent &event) -{ -} - -void V4StudioFrame::OnNewBackground2D(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *b2d = m_pV4sm->NewNode(TAG_MPEG4_Background2D); - gf_node_insert_child(m_selection, b2d, -1); - gf_node_register(b2d, m_selection); - m_parentSelection = m_selection; - m_selection = b2d; - Update(); -} - -void V4StudioFrame::OnNewImageTexture(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *it = m_pV4sm->NewNode(TAG_MPEG4_ImageTexture); - M_Appearance *app = (M_Appearance *) m_selection; - app->texture = it; - gf_node_register(it, m_selection); - m_parentSelection = m_selection; - m_selection = it; - Update(); -} - -void V4StudioFrame::OnNewMovieTexture(wxCommandEvent &event) -{ - if (!m_pV4sm) return; - GF_Node *mt = m_pV4sm->NewNode(TAG_MPEG4_MovieTexture); - M_Appearance *app = (M_Appearance *)m_selection; - app->texture = mt; - gf_node_register(mt, m_selection); - m_parentSelection = m_selection; - m_selection = mt; - Update(); -} - -void V4StudioFrame::UpdateSelection(GF_Node *node, GF_Node *parent) -{ - SetSelection(node); - SetParentSelection(parent); - m_pMainToolbar->EnableTool(TOOL_EDIT_CUT, true); - m_pMainToolbar->EnableTool(TOOL_EDIT_COPY, true); - m_pMainToolbar->EnableTool(TOOL_EDIT_DELETE, true); - UpdateToolBar(); - fieldView->SetNode(node); - fieldView->Create(); -} - - -// Update display -void V4StudioFrame::Update() -{ - if (m_pV4sm){ - if (m_pV4sm->GetGPACPanel()) m_pV4sm->GetGPACPanel()->Update(); - treeView->Refresh(m_pV4sm->GetRootNode()); - } else { - treeView->Refresh(NULL); - } - UpdateToolBar(); -} - -void V4StudioFrame::UpdateToolBar() -{ - bool enableGeometry = false, - enableAppearance = false, - enableMaterial = false, - enableGroupNode = false, - enableLineProps = false, - enableFontStyle = false, - enable2DNode = false, - enableTexture = false, - enableTopNode = false, - enableBackground = false; - - // a scene must have been created to enable the controls - if (m_pV4sm && m_pV4sm->GetInlineScene()) { - if (m_selection != NULL) { - u32 tag = gf_node_get_tag(m_selection); - GF_Node * node = m_selection; - enableBackground = true; - switch (tag) { - case TAG_MPEG4_Switch: - case TAG_MPEG4_OrderedGroup: - case TAG_MPEG4_Layer2D: - case TAG_MPEG4_Transform2D: - case TAG_MPEG4_TransformMatrix2D: - case TAG_MPEG4_ColorTransform: - enableGroupNode = true; - enable2DNode = true; - break; - case TAG_MPEG4_Shape: - if (!((M_Shape *)node)->geometry) enableGeometry = true; - if (!((M_Shape *)node)->appearance) enableAppearance = true; - break; - case TAG_MPEG4_Appearance: - if (!((M_Appearance *)node)->material) enableMaterial = true; - if (!((M_Appearance *)node)->texture) enableTexture = true; - break; - case TAG_MPEG4_Material2D: - if (!((M_Material2D *)node)->lineProps) enableLineProps = true; - break; - case TAG_MPEG4_Text: - if (!((M_Text *)node)->fontStyle) enableFontStyle = true; - break; - case TAG_MPEG4_Rectangle: - case TAG_MPEG4_Circle: - case TAG_MPEG4_ImageTexture: - case TAG_MPEG4_MovieTexture: - case TAG_MPEG4_Background2D: - break; - } - } else { - enableTopNode = true; - } - } - - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_ORDEREDGROUP, enableGroupNode || enable2DNode || enableTopNode); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_LAYER2D, enableGroupNode || enable2DNode || enableTopNode); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_TRANSFORM2D, enableGroupNode || enable2DNode); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_COLOR_TRANSFORM, enableGroupNode || enable2DNode); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_TRANSFORMMATRIX2D, enableGroupNode || enable2DNode); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_SHAPE, enable2DNode); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_RECT, enableGeometry); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_CIRCLE, enableGeometry); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_IFS2D, enableGeometry); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_ILS2D, enableGeometry); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_TEXT, enableGeometry); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_MOVIE, enableTexture); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_IMAGE, enableTexture); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_SOUND, enable2DNode); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_APPEARANCE, enableAppearance); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_MATERIAL2D, enableMaterial); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_LINEAR_GRADIENT, enableTexture); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_RADIAL_GRADIENT, enableTexture); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_LINEPROPS, enableLineProps); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_XLINEPROPS, enableLineProps); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_FONTSTYLE, enableFontStyle); - m_pLowLevelNodeToolbar->EnableTool(TOOL_NEW_BACKGROUND2D, enableBackground); -} - -// Cut and paste functions -void V4StudioFrame::OnEditCut(wxCommandEvent &WXUNUSED(event)) -{ - if (!m_selection) return; - - m_clipboardNode = m_selection; - m_clipboardParentNode = m_parentSelection; - gf_node_remove_child(m_parentSelection, m_selection); - m_pMainToolbar->EnableTool(TOOL_EDIT_CUT, true); - m_pMainToolbar->EnableTool(TOOL_EDIT_COPY, true); - m_pMainToolbar->EnableTool(TOOL_EDIT_PASTE, true); - m_pMainToolbar->EnableTool(TOOL_EDIT_PASTE_USE, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_DELETE, false); - - Update(); -} - -void V4StudioFrame::OnEditDelete(wxCommandEvent &WXUNUSED(event)) -{ - if (!m_selection) return; - - gf_node_remove_child(m_parentSelection, m_selection); - m_clipboardNode = NULL; - m_clipboardParentNode = NULL; - m_pMainToolbar->EnableTool(TOOL_EDIT_CUT, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_COPY, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_PASTE, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_PASTE_USE, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_DELETE, false); - - Update(); -} - -void V4StudioFrame::OnEditCopy(wxCommandEvent &WXUNUSED(event)) -{ - if (!m_selection) return; - - m_clipboardNode = m_selection; - m_clipboardParentNode = m_parentSelection; - m_pMainToolbar->EnableTool(TOOL_EDIT_CUT, true); - m_pMainToolbar->EnableTool(TOOL_EDIT_COPY, true); - m_pMainToolbar->EnableTool(TOOL_EDIT_PASTE, true); - m_pMainToolbar->EnableTool(TOOL_EDIT_PASTE_USE, true); - m_pMainToolbar->EnableTool(TOOL_EDIT_DELETE, false); - - Update(); -} - -void V4StudioFrame::OnEditPaste(wxCommandEvent &WXUNUSED(event)) -{ - if (!m_pV4sm) return; - if (m_clipboardNode == NULL) return; - - GF_Node *copy = m_pV4sm->CopyNode(m_clipboardNode, m_parentSelection, true); - gf_node_insert_child(m_selection, copy, -1); - m_pMainToolbar->EnableTool(TOOL_EDIT_CUT, true); - m_pMainToolbar->EnableTool(TOOL_EDIT_COPY, true); - m_pMainToolbar->EnableTool(TOOL_EDIT_PASTE, true); - m_pMainToolbar->EnableTool(TOOL_EDIT_PASTE_USE, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_DELETE, false); - - Update(); -} - -void V4StudioFrame::OnEditPasteUse(wxCommandEvent &WXUNUSED(event)) -{ - if (!m_pV4sm) return; - if (m_clipboardNode == NULL) return; - - GF_Node *copy = m_pV4sm->CopyNode(m_clipboardNode, m_parentSelection, false); - gf_node_register(copy, m_selection); - gf_node_insert_child(m_selection, copy, -1); - m_pMainToolbar->EnableTool(TOOL_EDIT_CUT, true); - m_pMainToolbar->EnableTool(TOOL_EDIT_COPY, true); - m_pMainToolbar->EnableTool(TOOL_EDIT_PASTE, true); - m_pMainToolbar->EnableTool(TOOL_EDIT_PASTE_USE, false); - m_pMainToolbar->EnableTool(TOOL_EDIT_DELETE, false); - - Update(); -} - -// OnAddToTimeLine -- adds a node in the timeline (meaning creating a node ID and adding it to the dictionnary and the pool) -void V4StudioFrame::OnAddToTimeLine(wxCommandEvent &event) { - if (!m_pV4sm) return; - if (!m_selection) return; // don't add nothing - - // if object has no node id then create one - if (! gf_node_get_id(m_selection) ) - m_pV4sm->CreateIDandAddToPool(m_selection); - - // Adds the node to the dictionnary -// m_pV4sm->AddToDictionnary(m_selection); - - // calls timeline function to add the line - char c[50]; - strcpy(c, gf_node_get_name(m_selection)); - timeLine->AddLine( gf_node_get_id(m_selection), wxString(c) ); -} - - -// NextFrame -- goto next frame -void V4StudioFrame::NextFrame(wxCommandEvent &event) { - //gf_term_play_from_time(gpacPanel->GetMPEG4Terminal(), 1000); - m_selection = NULL; - Update(); -} - - -// SwitchView -- switches between scene editing and dictionnary editing -void V4StudioFrame::SwitchView(wxCommandEvent &event) { - SetEditDict(!editDict); -} - - - -/****** Access Functions ******/ - -// changes time to the frame specified, implies playing the scene up to that point -void V4StudioFrame::SetFrame(unsigned long _frame) { - // TODO : - m_frame = _frame; -} - - -// SetEditDict -- edit the dictionnary or not -void V4StudioFrame::SetEditDict(bool _editDict) { - - // does nothing if no scene - if (!m_pV4sm) return; - if ( ! m_pV4sm->GetSceneGraph() ) return; - - editDict = _editDict; - - if (editDict) treeView->Refresh(m_pV4sm->GetDictionnary()); - else treeView->Refresh(m_pV4sm->GetRootNode()); -} - - -// GetEditDict -- Access to edit dict -bool V4StudioFrame::GetEditDict() const { - return editDict; -} diff --git a/applications/v4studio/V4StudioFrame.h b/applications/v4studio/V4StudioFrame.h deleted file mode 100644 index f0c79b0..0000000 --- a/applications/v4studio/V4StudioFrame.h +++ /dev/null @@ -1,211 +0,0 @@ -#ifndef V4STUDIO_FRAME_H -#define V4STUDIO_FRAME_H - -#include "safe_include.h" // include m4_tools.h - -#include -#include -#include - -// UI -#include "V4StudioTree.h" -#include "V4FieldList.h" -#include "V4TimeLine\V4TimeLine.h" -#include "V4CommandPanel.h" - -// Scene data -#include "V4SceneManager.h" - -enum { - // File Menu commands - MENU_FILE_NEW, - MENU_FILE_OPEN, - MENU_FILE_SAVE, - MENU_FILE_CLOSE, - MENU_FILE_QUIT, - - // Tools Menu commands - MENU_TOOL_SHOW_LOWLEVEL, - MENU_TOOL_SHOW_HIGHLEVEL, - - // Generic Toolbar commands - TOOL_FILE_NEW, - TOOL_FILE_OPEN, - TOOL_FILE_SAVE, - TOOL_FILE_CLOSE, - TOOL_FILE_PREVIEW, - TOOL_EDIT_CUT, - TOOL_EDIT_COPY, - TOOL_EDIT_PASTE, - TOOL_EDIT_PASTE_USE, - TOOL_EDIT_DELETE, - TOOL_EDIT_UNDO, - TOOL_EDIT_REDO, - TOOL_FRAME_COMBO, - TOOL_ADD_TO_TL, - TOOL_NEXT_FRAME, - TOOL_VIEW_DICT, - - CHANGE_SIZE_DIALOG, - CHANGE_FRAMERATE, - CHANGE_LENGTH, - - /* High level node creation */ - TOOL_NEW_2DSCENE, - - /* Low level node creations */ - // 2D node Toolbar commands - TOOL_NEW_ORDEREDGROUP, - TOOL_NEW_LAYER2D, - TOOL_NEW_TRANSFORM2D, - TOOL_NEW_TRANSFORMMATRIX2D, - TOOL_NEW_COLOR_TRANSFORM, - TOOL_NEW_SHAPE, - - // Appearance and sub-appearance Toolbar commands - TOOL_NEW_APPEARANCE, - TOOL_NEW_MATERIAL2D, - TOOL_NEW_LINEPROPS, - TOOL_NEW_XLINEPROPS, - TOOL_NEW_FONTSTYLE, - TOOL_NEW_LINEAR_GRADIENT, - TOOL_NEW_RADIAL_GRADIENT, - - // Geometry Toolbar commands - TOOL_NEW_RECT, - TOOL_NEW_CIRCLE, - TOOL_NEW_IFS2D, - TOOL_NEW_ILS2D, - TOOL_NEW_TEXT, - - // Media Toolbar commands - TOOL_NEW_BACKGROUND2D, - TOOL_NEW_MOVIE, - TOOL_NEW_IMAGE, - TOOL_NEW_SOUND -}; - -class V4StudioFrame: public wxFrame { -public: - - // Constructor / Desctructor - V4StudioFrame(); - ~V4StudioFrame(); - - /* generic UI functions */ - - /* File Menu functions */ - void OnNew(wxCommandEvent &event); - void OnFileOpen(wxCommandEvent &event); - void OnSave(wxCommandEvent &event); - void OnClose(wxCommandEvent &event); - void OnQuit(wxCommandEvent &event); - void OnChangeSize(wxCommandEvent &event); - void OnChangeFrameRate(wxCommandEvent &event); - void OnChangeLength(wxCommandEvent &event); - - /* Tools Menu functions */ - void OnLowLevelTools(wxCommandEvent &event); - void OnHighLevelTools(wxCommandEvent &event); - - /* edition toolbar functions */ - void OnEditCut(wxCommandEvent &event); - void OnEditCopy(wxCommandEvent &event); - void OnEditPaste(wxCommandEvent &event); - void OnEditPasteUse(wxCommandEvent &event); - void OnEditDelete(wxCommandEvent &event); - void OnAddToTimeLine(wxCommandEvent &event); - void OnCombo(wxCommandEvent& event); - void NextFrame(wxCommandEvent &event); - void SwitchView(wxCommandEvent &event); - - /* new components toolbar functions */ - void OnNewLayer2D(wxCommandEvent &event); - void OnNewOrderedGroup(wxCommandEvent &event); - void OnNewTransform2D(wxCommandEvent &event); - void OnNewTransformMatrix2D(wxCommandEvent &event); - void OnNewColorTransform(wxCommandEvent &event); - void OnNewShape(wxCommandEvent &event); - void OnNewAppearance(wxCommandEvent &event); - void OnNewMaterial2D(wxCommandEvent &event); - void OnNewLinearGradient(wxCommandEvent &event); - void OnNewRadialGradient(wxCommandEvent &event); - void OnNewLineProps(wxCommandEvent &event); - void OnNewXLineProps(wxCommandEvent &event); - void OnNewText(wxCommandEvent &event); - void OnNewFontStyle(wxCommandEvent &event); - void OnNewRect(wxCommandEvent &event); - void OnNewCircle(wxCommandEvent &event); - void OnNewSound(wxCommandEvent &event); - void OnNewBackground2D(wxCommandEvent &event); - void OnNewImageTexture(wxCommandEvent &event); - void OnNewMovieTexture(wxCommandEvent &event); - - - /* display update functions */ - void Update(); - void UpdateSelection(GF_Node *node, GF_Node *parent); - void SetSelection(GF_Node *node) { m_selection = node; } - void SetParentSelection(GF_Node *node) { m_parentSelection = node; } - void UpdateToolBar(); - void SceneGraphChanged(); - - - /* access to private members */ - - // UI objects - V4FieldList * GetFieldView() { return fieldView; } - V4StudioTree * GetTreeView() { return treeView; } - V4CommandPanel * GetCmdPanel() { return cmdPanel; } - V4TimeLine * GetTimeLine() { return timeLine; } - V4SceneManager * GetV4SceneManager() { return m_pV4sm; } - - // variables - void SetFrame(unsigned long _frame); // changes time to the frame specified, implies playing the scene up to that point - void SetEditDict(bool editDict); // edit the dictionnary or not - bool GetEditDict() const; - - -private: - void set_properties(); - void do_layout(); - -protected: - - DECLARE_EVENT_TABLE() - - // select, cut and paste members - GF_Node *m_selection; - GF_Node *m_parentSelection; - GF_Node *m_clipboardNode; - GF_Node *m_clipboardParentNode; - - // scene data - V4SceneManager *m_pV4sm; - - // UI objects - V4StudioTree *treeView; - V4FieldList *fieldView; - V4TimeLine *timeLine; - V4CommandPanel *cmdPanel; - - wxMenu *m_pFileMenu; - wxMenu *m_pToolsMenu; - wxStatusBar *m_pStatusbar; - // The Main bar that contains the new, load, save, cut, copy ... - wxToolBar *m_pMainToolbar; - - // The tool bar to create all the MPEG-4 nodes - wxToolBar *m_pLowLevelNodeToolbar; - wxToolBar *m_pHighLevelNodeToolbar; - u32 m_uSelectedNodeToolBar; - - // editing states machine - bool editDict; // true if we are editing the dictionnary - unsigned long m_frame; // frame currently selected - -}; - - -#endif - diff --git a/applications/v4studio/V4StudioTree.cpp b/applications/v4studio/V4StudioTree.cpp deleted file mode 100644 index 4e06364..0000000 --- a/applications/v4studio/V4StudioTree.cpp +++ /dev/null @@ -1,386 +0,0 @@ -#include "safe_include.h" - -// For compilers that supports precompilation , includes "wx/wx.h" -#include "wx/wxprec.h" - -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include "V4StudioTree.h" -#include "V4StudioFrame.h" - -#include "V4SceneManager.h" // DICTNAME constant - -#include "wx/image.h" -#include "wx/imaglist.h" -#include "wx/treectrl.h" - -#include - -#include "treeIcon1.xpm" -#include "treeIcon2.xpm" -#include "treeIcon3.xpm" -#include "treeIcon4.xpm" -#include "treeIcon5.xpm" - -#include - - -BEGIN_EVENT_TABLE(V4StudioTree, wxTreeCtrl) - EVT_TREE_SEL_CHANGED(-1, V4StudioTree::OnSelChanged) - EVT_TREE_ITEM_RIGHT_CLICK(-1, V4StudioTree::OnItemRightClick) - EVT_TREE_BEGIN_DRAG(-1, V4StudioTree::OnBeginDrag) - EVT_TREE_END_DRAG(-1, V4StudioTree::OnEndDrag) -END_EVENT_TABLE() - -GF_Err V4StudioTreeItemData::GetField(GF_FieldInfo *f) -{ - if (!f || fieldIndex < 0) return GF_BAD_PARAM; - return gf_node_get_field(parent, fieldIndex, f); -} - -V4StudioTree::V4StudioTree(wxWindow *parent_, wxSize size,V4FieldList *fieldView) : - wxTreeCtrl(parent_, -1, wxDefaultPosition, size, wxTR_DEFAULT_STYLE) -{ - CreateImageList(); - AddRoot("Scene", V4StudioTree::TreeCtrlIcon_Folder, V4StudioTree::TreeCtrlIcon_FolderOpened); - m_transformNode = NULL; - m_selectedNode = NULL; - - parent = (V4StudioFrame *) parent_; -} - - -// Refresh -- redraws the tree starting at the specified node -void V4StudioTree::Refresh(GF_Node * node) -{ - - // check if we have to display the dictionnary or not - if (parent->GetEditDict()) - node = parent->GetV4SceneManager()->GetDictionnary(); - - - wxTreeItemId rootId = GetRootItem(); - CollapseAndReset(rootId); - if (node) { - AddNodesToItem(rootId, node, -1, -1); - Expand(rootId); - } -} - -void V4StudioTree::AddNodesToItem(wxTreeItemId parentItemId, GF_Node * node, s32 fieldIndex, s32 position) -{ - GF_FieldInfo field; - u32 count, i, j; - char *name; - - if (!node) return; - - // displays the name and the defname it exists - u32 s = strlen(gf_node_get_class_name(node)); - - if (gf_node_get_name(node)) { - s += strlen(gf_node_get_name(node)); - name = new char[s+4]; - strcpy(name, gf_node_get_class_name(node)); - strcat(name, " - "); - strcat(name, gf_node_get_name(node)); - } else { - name = new char[s+1]; - strcpy(name, gf_node_get_class_name(node)); - } - - GF_Node * parent = NULL; - - V4StudioTreeItemData *parentItemData = (V4StudioTreeItemData *)GetItemData(parentItemId); - if (parentItemData != NULL) parent = parentItemData->GetNode(); - - V4StudioTreeItemData * currentItemData = new V4StudioTreeItemData(node, parent, fieldIndex, position); - wxTreeItemId nodeItemId; - if (position == -1) nodeItemId = AppendItem(parentItemId, wxString(name), -1, -1, currentItemData); - else nodeItemId = InsertItem(parentItemId, position, wxString(name), -1, -1, currentItemData); - - delete [] name; - name = NULL; - - count = gf_node_get_field_count(node); - for (i=0;iAdd(icons[i]); - else images->Add(wxBitmap(wxBitmap(icons[i]).ConvertToImage().Rescale(size, size))); - } - AssignImageList(images); -} - -void V4StudioTree::OnSelChanged(wxTreeEvent& event) -{ - wxKeyEvent kevt = event.GetKeyEvent(); - - wxTreeItemId itemId = event.GetItem(); - m_selectedItem = itemId; - if (itemId.IsOk()) { - V4StudioTreeItemData *itemData = (V4StudioTreeItemData *)GetItemData(itemId); - if (!itemData) { - event.Skip(); - return; - } - GF_Node *itemNode = itemData->GetNode(); - GF_Node *itemParentNode = itemData->GetNodeParent(); - if (!itemNode) { - event.Skip(); - return; - } - V4StudioFrame *mainFrame = (V4StudioFrame *)GetParent(); - mainFrame->UpdateSelection(itemNode, itemParentNode); - } -} - -void V4StudioTree::SetSelectedItem(GF_Node *node) -{ - if (m_selectedNode == node) return; - wxTreeItemId rootId = GetRootItem(); - wxTreeItemId itemId = FindNodeItem(rootId, node); - m_transformNode = FindTransformNode(itemId); - itemId = GetItemParent(itemId); - if (itemId.IsOk()) { - V4StudioTreeItemData *data = (V4StudioTreeItemData *)GetItemData(itemId); - if (data != NULL) { - V4StudioFrame *mainFrame = (V4StudioFrame *)GetParent(); - GF_Node *itemNode = data->GetNode(); - m_selectedNode = itemNode; - GF_Node *itemParentNode = data->GetNodeParent(); - mainFrame->UpdateSelection(itemNode, itemParentNode); - } - SelectItem(itemId); - } -} - -wxTreeItemId V4StudioTree::FindNodeItem(wxTreeItemId itemId, GF_Node *node) -{ - void* cookie; - V4StudioTreeItemData *data = (V4StudioTreeItemData *)GetItemData(itemId); - if (data != NULL) { - if (data->GetNode() == node) return itemId; - } - wxTreeItemId ret = (wxTreeItemId)0l; - wxTreeItemId child = GetFirstChild(itemId, cookie); - while (child.IsOk()) { - wxTreeItemId ret = FindNodeItem(child, node); - if (ret.IsOk()) return ret; - child = GetNextChild(itemId, cookie); - } - return ret; -} - -void V4StudioTree::OnItemRightClick(wxTreeEvent &event) -{ - wxTreeItemId itemId = event.GetItem(); -} - -void V4StudioTree::OnBeginDrag(wxTreeEvent& event) -{ - // need to explicitly allow drag - if ( event.GetItem() != GetRootItem() ){ - m_draggedItem = event.GetItem(); - V4StudioTreeItemData *draggedData = (V4StudioTreeItemData *)GetItemData(m_draggedItem); - event.Allow(); - } else { - wxLogMessage(wxT("OnBeginDrag: this item can't be dragged.")); - } -} - -void V4StudioTree::OnEndDrag(wxTreeEvent& event) -{ - wxTreeItemId itemSrc = m_draggedItem, itemDst = event.GetItem(), dstParentItem = GetItemParent(itemDst); - m_draggedItem = (wxTreeItemId)0l; - - V4StudioTreeItemData *srcData = (V4StudioTreeItemData *)GetItemData(itemSrc); - GF_FieldInfo srcField; - srcData->GetField(&srcField); - // Removal of the src item from its parent field - switch (srcField.fieldType) { - case GF_SG_VRML_SFNODE: - if (* (GF_Node **) srcField.far_ptr) {} - break; - case GF_SG_VRML_MFNODE: - { - GF_ChildNodeItem *nodes = (* (GF_ChildNodeItem **) srcField.far_ptr); - gf_node_list_del_child_idx(&nodes, srcData->GetPosition()); - } - break; - default: - break; - } - - GF_Node *srcNode = srcData->GetNode(); - GF_FieldInfo dstField; - V4StudioTreeItemData *dstData = (V4StudioTreeItemData *)GetItemData(itemDst); - dstData->GetField(&dstField); - // Addition of the src item prior to the dest item - switch (dstField.fieldType) { - case GF_SG_VRML_SFNODE: - if (* (GF_Node **) dstField.far_ptr) {} - break; - case GF_SG_VRML_MFNODE: - { - GF_ChildNodeItem *nodes = (* (GF_ChildNodeItem **) dstField.far_ptr); - gf_node_list_insert_child(&nodes, srcNode, dstData->GetPosition()); - gf_node_dirty_set(dstData->GetNode(), 0, 1); - } - break; - default: - break; - } - - GF_Node *dstParentNode = dstData->GetNodeParent(); - - Delete(itemSrc); - AddNodesToItem(dstParentItem, srcNode, dstData->GetFieldIndex(), dstData->GetPosition()); - V4StudioFrame *mainFrame = (V4StudioFrame *)GetParent(); - mainFrame->UpdateSelection(srcNode,dstData->GetNodeParent()); - mainFrame->Update(); -} - -GF_Node *V4StudioTree::FindTransformNode(wxTreeItemId itemId) -{ - GF_Node *transformNode = NULL; - while (true) { - if (itemId.IsOk()) { - V4StudioTreeItemData *data = (V4StudioTreeItemData *)GetItemData(itemId); - if (data != NULL) { - GF_Node *itemNode = data->GetNode(); - u32 tag = gf_node_get_tag(itemNode); - if (tag == TAG_MPEG4_Transform2D || tag == TAG_MPEG4_TransformMatrix2D) { - transformNode = itemNode; - break; - } - } else { - break; - } - } else { - break; - } - itemId = GetItemParent(itemId); - } - return transformNode; -} - -void V4StudioTree::Translate(int dX, int dY) -{ - if (m_transformNode) { - GF_FieldInfo field; - u32 tag = gf_node_get_tag(m_transformNode); - if (tag == TAG_MPEG4_Transform2D){ - gf_node_get_field(m_transformNode, 7, &field); - ((SFVec2f *)field.far_ptr)->x += dX; - ((SFVec2f *)field.far_ptr)->y += dY; - } else { - gf_node_get_field(m_transformNode, 5, &field); - *((SFFloat *)field.far_ptr) += dX; - gf_node_get_field(m_transformNode, 8, &field); - *((SFFloat *)field.far_ptr) += dY; - } - V4StudioFrame *mainFrame = (V4StudioFrame *)GetParent(); - mainFrame->GetFieldView()->SetNode(m_transformNode); - mainFrame->GetFieldView()->Create(); - } -} - -void V4StudioTree::Scale(int dX, int dY) -{ - if (m_transformNode && (dX || dY)) { - GF_FieldInfo field; - u32 tag = gf_node_get_tag(m_transformNode); - if (tag == TAG_MPEG4_Transform2D){ - gf_node_get_field(m_transformNode, 5, &field); - if (dX) ((SFVec2f *)field.far_ptr)->x *= (dX>0?1.01:0.99); - if (dY) ((SFVec2f *)field.far_ptr)->y *= (dY>0?1.01:0.99); - } else { - gf_node_get_field(m_transformNode, 3, &field); - if (dX) *((SFFloat *)field.far_ptr) *= (dX>0?1.01:0.99); - gf_node_get_field(m_transformNode, 7, &field); - if (dY) *((SFFloat *)field.far_ptr) *= (dY>0?1.01:0.99); - } - V4StudioFrame *mainFrame = (V4StudioFrame *)GetParent(); - mainFrame->GetFieldView()->SetNode(m_transformNode); - mainFrame->GetFieldView()->Create(); - } -} - - -void V4StudioTree::Rotate(int dX, int dY) -{ - /*quick and dirty of course...*/ - dY *= -1; - if (m_transformNode && (dX || dY)) { - u32 tag = gf_node_get_tag(m_transformNode); - if (tag == TAG_MPEG4_Transform2D){ - Double ang; - ang = atan2(dY, dX) / 100; - ((M_Transform2D *) m_transformNode)->rotationAngle += ang; - } else { - ((M_TransformMatrix2D *) m_transformNode)->mxy += dX; - ((M_TransformMatrix2D *) m_transformNode)->myx += dY; - } - V4StudioFrame *mainFrame = (V4StudioFrame *)GetParent(); - mainFrame->GetFieldView()->SetNode(m_transformNode); - mainFrame->GetFieldView()->Create(); - } -} - - diff --git a/applications/v4studio/V4StudioTree.h b/applications/v4studio/V4StudioTree.h deleted file mode 100644 index 845af74..0000000 --- a/applications/v4studio/V4StudioTree.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef _V4STUDIO_TREE_H -#define _V4STUDIO_TREE_H - -#include "safe_include.h" -#include -#include "V4FieldList.h" - -#include - - -class V4StudioFrame; - - -class V4StudioTreeItemData : public wxTreeItemData { -public: - V4StudioTreeItemData(GF_Node *n, GF_Node *p, s32 fi, s32 pos = -1) : node(n), parent(p), fieldIndex(fi), position(pos) {} - -public: - GF_Node *GetNode() { return node; } - void SetNode(GF_Node *n) { node = n; } - GF_Err GetField(GF_FieldInfo *f); - - GF_Node *GetNodeParent() { return parent; } - void SetNodeParent(GF_Node *n) { parent = n; } - s32 GetPosition() { return position; } - void SetPosition(s32 pos) { position = pos; } - void SetFieldIndex(s32 i) { fieldIndex = i; } - s32 GetFieldIndex() { return fieldIndex; } - -private: - GF_Node *node; - GF_Node *parent; - s32 fieldIndex; - s32 position; - -}; - -class V4StudioTree: public wxTreeCtrl { - -public: - enum - { - TreeCtrlIcon_File, - TreeCtrlIcon_FileSelected, - TreeCtrlIcon_Folder, - TreeCtrlIcon_FolderSelected, - TreeCtrlIcon_FolderOpened - }; - - V4StudioTree(wxWindow *parent, wxSize size, V4FieldList *fieldView); - - void CreateImageList(int size = 16); - - void Refresh(GF_Node * node); - - void OnSelChanged(wxTreeEvent& event); - void OnItemRightClick(wxTreeEvent &event); - void ShowMenu(wxTreeItemId id, const wxPoint& pt); - void OnBeginDrag(wxTreeEvent& event); - void OnEndDrag(wxTreeEvent& event); - - void SetSelectedItem(GF_Node *node); - void Translate(int dX, int dY); - void Scale(int dX, int dY); - void Rotate(int dX, int dY); - wxTreeItemId FindNodeItem(wxTreeItemId itemId, GF_Node *node); - GF_Node *FindTransformNode(wxTreeItemId itemId); - -protected: - DECLARE_EVENT_TABLE() - -private: - void AddNodesToItem(wxTreeItemId parentItemId, GF_Node * node, s32 fieldIndex, s32 position); - - wxTreeItemId m_selectedItem; // item being dragged right now - wxTreeItemId m_draggedItem; // item being dragged right now - - GF_Node * m_selectedNode; - GF_Node * m_transformNode; - - // All the component of the V4Studio Main Frame have a pointer to that Main Frame, called parent. - V4StudioFrame * parent; - -}; - -#endif diff --git a/applications/v4studio/V4TimeLine/V4TimeLine.cpp b/applications/v4studio/V4TimeLine/V4TimeLine.cpp deleted file mode 100644 index ac5acbe..0000000 --- a/applications/v4studio/V4TimeLine/V4TimeLine.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - V4TimeLine.cpp - - Implémentation de la classe V4TimeLine -*/ - -#include "V4TimeLine.h" -#include "V4TimeLineCase.h" -#include "..\V4StudioFrame.h" - - -// Constructeur -V4TimeLine::V4TimeLine(wxWindow * parent_, unsigned int timeLineLength) : wxScrolledWindow(parent_), sizer(NULL) { - - // position en X de la grille - Offset = 100; - Length = timeLineLength; - clicked = NULL; - - parent = (V4StudioFrame *) parent_; - - sizer = new wxBoxSizer(wxVERTICAL); - - // indispensable pour avoir des barres de défilement - SetScrollRate( 5, 5 ); - - hdr = new V4TimeLineHdr(this); - sizer->Add(hdr); - - SetSizer(sizer); - FitInside(); -} - - -// Destructeur -V4TimeLine::~V4TimeLine() { -} - - -// retourne la position en X du debut de la grille -int V4TimeLine::GetOffset() { - return Offset; -} - - -// returns Length attribute -unsigned int V4TimeLine::GetLength() { - return Length; -} - - -// Adds a line to the timeline -void V4TimeLine::AddLine(u32 NodeID, wxString eltName) { - // verifies that we have no line with the same NodeID - - for (int i = 0; i < lines.size(); i++) { - if (lines.at(i)->GetNodeID() == NodeID) - return; - } - - // adds the line at the end of the list, in the next position - // note that we already have the hearder line in position 0 - lines.push_back( - new V4TimeLineElt(this, lines.size()+1, NodeID, eltName, hdr->GetFrame()) - ); - - // redraws the component - sizer->Add(lines.back()); - Layout(); -} - - -// called when time changed, update display (background colors) -void V4TimeLine::SetFrame(u32 _frame, V4TimeLineCell * newClicked) { - - // updates lines display - if (_frame != hdr->GetFrame()) { - hdr->SetFrame(_frame); - - // TODO : apply all commands from previous frames. - // maybe by adding a NextFrame() method - - for (int i = 0; i < lines.size(); i++) - lines.at(i)->SetFrame(_frame); - } - - - // updates clicked state on clicked cells - - // removes state from old - if (clicked != NULL) { - u32 state = clicked->GetState(); - state &= ~CELL_STATE_CLICKED; - clicked->SetState(state); - } - - clicked = newClicked; - - // adds state to new - if (clicked != NULL) { - u32 state = clicked->GetState(); - state |= CELL_STATE_CLICKED; - clicked->SetState(state); - } - - - // updates command panel - ((V4StudioFrame *) GetParent())->GetCmdPanel()->Refresh(_frame); - -} - - -// GetSelectedID -- returns the ID of the node whose timeline is selected -u32 V4TimeLine::GetSelectedID() const { - - // if nothing is selected then returns null nodeID - if (!clicked) return 0; - - // gets the line from the cell - u32 pos = clicked->GetParent()->GetPos(); - - // gets the node id (!! the header line is first) - if (pos) return lines.at(pos-1)->GetNodeID(); - else return 0; // if we clicked on a header cell -} - - -// AddCommand -- -void V4TimeLine::AddCommand(GF_Command * c) { - clicked->AddCommand(c); -} - - -// DeleteCommand -- -void V4TimeLine::DeleteCommand(u32 n) { - clicked->DeleteCommand(n); -} - - -// GetCommand -- -GF_Command * V4TimeLine::GetCommand(u32 n) { - return clicked->GetCommand(n); -} - - -// SetLength -- -void V4TimeLine::SetLength(const unsigned int length_) { - hdr->SetLength(length_); - - // if the selected frames will be deleted, we select the last cell - if (hdr->GetFrame() > length_) SetFrame(length_); - - for (int i = 0; i < lines.size(); i++) - lines.at(i)->SetLength(length_); - - Length = length_; - - FitInside(); -} \ No newline at end of file diff --git a/applications/v4studio/V4TimeLine/V4TimeLine.h b/applications/v4studio/V4TimeLine/V4TimeLine.h deleted file mode 100644 index 98908a8..0000000 --- a/applications/v4studio/V4TimeLine/V4TimeLine.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - V4TimeLine.h - - V4Studio component allowing to edit timings - The component draw sub components whose type is V4TimeLineElt -*/ - -#ifndef _V4TimeLine_ -#define _V4TimeLine_ - -#include "../safe_include.h" - -// wxWidgets includes -#include -#include - -// Own includes -#include "V4TimeLineElt.h" -#include "V4TimeLineHdr.h" - -// STL includes -#include - -class V4TimeLineCell; -class V4StudioFrame; - - - -class V4TimeLine : public wxScrolledWindow { - public: - // Constructeur -- timeLineLength est compté en images - V4TimeLine(wxWindow * parent, unsigned int timeLineLength = 50); - - // Desctructeur - ~V4TimeLine(); - - void AddLine(u32 NodeID, wxString eltName); // Adds a line to the timeline - // TODO : add an additionnal parameter to specify a pointer to the element represented by the line - // TODO : use node pointer instead of id ? - - void Clear(); // clears all the line in the timeline - // TODO : check if everything is destroyed correctly - - // retourne la position en X du debut de la grille - int GetOffset(); - - // access to Length - unsigned int GetLength(); - void SetLength(const unsigned int length_); - - // called when time changed, update display (background colors) - void SetFrame(u32 _frame, V4TimeLineCell * newClicked = NULL); - - // returns the ID of the node whose timeline is selected - u32 GetSelectedID() const; - - // Deletes a command from the current cell - void DeleteCommand(u32 n); - - // Adds a command to the current cell - void AddCommand(GF_Command *); - - // Retrieves the list of commands for the current cell - GF_Command * GetCommand(u32 n); - - // pointer to the parent - V4StudioFrame * parent; - - - private: - // composants graphiques - std::vector lines; - V4TimeLineHdr * hdr; - wxBoxSizer * sizer; - - // attributs divers - int Offset; // X position of the grid - u32 Length; // length (in frames) of the scene - V4TimeLineCell * clicked; // cell currently "clicked" - - -}; - -#endif \ No newline at end of file diff --git a/applications/v4studio/V4TimeLine/V4TimeLineCase.cpp b/applications/v4studio/V4TimeLine/V4TimeLineCase.cpp deleted file mode 100644 index 375e97d..0000000 --- a/applications/v4studio/V4TimeLine/V4TimeLineCase.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - V4TimeLineCase.cpp - -*/ - -#include "V4TimeLineCase.h" -#include "V4TimeLineLine.h" -#include "V4TimeLine.h" - -#include "..\V4StudioFrame.h" -#include "..\V4SceneManager.h" - - -BEGIN_EVENT_TABLE(V4TimeLineCell, wxWindow) - EVT_PAINT(V4TimeLineCell::OnPaint) - EVT_LEFT_UP(V4TimeLineCell::OnLeftUp) -END_EVENT_TABLE() - - -// Constructor -V4TimeLineCell::V4TimeLineCell(V4TimeLineLine * parent_, unsigned int _num, unsigned int _type) : wxWindow(parent_, -1), num(_num), state(0), type(_type) { - - parent = parent_; - commands = gf_list_new(); - - SetSize(parent_->GetOffset() + _num * 20, 0, -1, -1); - - // line, timeline, frame - v4sf = (V4StudioFrame *) parent->GetParent()->GetParent(); - -} - - -// destructor -V4TimeLineCell::~V4TimeLineCell() { - gf_list_del(commands); -} - - -// OnPaint -void V4TimeLineCell::OnPaint(wxPaintEvent & event) { - wxPaintDC dc(this); - - dc.BeginDrawing(); - - int w, h; - GetSize(&w, &h); - - // draws the background - dc.SetPen(*wxTRANSPARENT_PEN); - - // finds a color according to the parity - unsigned char r,g,b; - if ( ((V4TimeLineLine *)GetParent())->GetPos() % 2 ) { r = 220; g = 220; b = 255; } - else { r = 200; g = 200; b = 255; }; - - // if we are selected (ie current frame) adds green - if (state & CELL_STATE_SELECTED) - g += 35; - - wxColour c(r,g,b); - - wxBrush br(c); - dc.SetBrush( br ); - - dc.DrawRectangle(0,0,w,h); - - dc.SetBrush(*wxWHITE_BRUSH); - - // draws the vertical borders - dc.SetPen(*wxLIGHT_GREY_PEN); - dc.DrawLine(0,0,0,h); - - dc.SetPen(*wxBLACK_PEN); - - // draws state specific information - if (state & CELL_STATE_CLICKED) dc.DrawCircle(w/2,h/2,10); - if (state & CELL_STATE_COMMAND) dc.DrawRectangle(2, 2, w-4, h-4); - - // draws frame number - wxString s; - if ( (type == CELL_TYPE_HDR) && (! (num % 10)) ) { - s = s.Format(wxT("%d"), num); - // centers text - int wt, ht; - dc.GetTextExtent(s, &wt, &ht); - dc.DrawText(s, (w-wt)/2, (h-ht)/2); - } - - dc.EndDrawing(); -} - - -// OnLeftUp -- tells the application that the user switched frame -void V4TimeLineCell::OnLeftUp(wxMouseEvent & event) { - - ((V4TimeLine *) GetParent()->GetParent())->SetFrame(num, this); - - V4SceneManager * sg = v4sf->GetV4SceneManager(); - - // don't trigger any more reaction if this is a cell in the first row - //if (type == CELL_TYPE_HDR) return; - - Refresh(); - v4sf->Update(); -} - - -// SetState -- Changes cell state -void V4TimeLineCell::SetState(unsigned int _state) { - state = _state; - - // if cell is clicked but not selected, can't be clicked anymore - if ( (state & CELL_STATE_CLICKED) && !(state & CELL_STATE_SELECTED) ) - state &= ~CELL_STATE_CLICKED; - - Refresh(); -} - - -// GetState -- Retrieves cells state -unsigned int V4TimeLineCell::GetState() const { - return state; -} - - -// AddCommand -- -void V4TimeLineCell::AddCommand(GF_Command *c) { - gf_list_add(commands, c); - SetState( GetState() | CELL_STATE_COMMAND ); -} - -// DeleteCommand -- Deletes ONE command -void V4TimeLineCell::DeleteCommand(const u32 n) { - // TODO : -} - - -// DeleteCommand -- destroys all the commands from this cell (for instance when shortening the scene) -// ONLY works for NORMAL cells -void V4TimeLineCell::DeleteCommands() { - - // deletes the commands from the au - - // useful objects - V4SceneManager *sm = v4sf->GetV4SceneManager(); - GF_StreamContext *ctx = sm->GetBifsStream(); - GF_AUContext * au = NULL; - GF_Node * myNode = gf_sg_find_node( sm->GetSceneGraph(), ((V4TimeLineElt *) parent)->GetNodeID() ); - - u32 myTiming = sm->GetUnits() / sm->GetFrameRate() * num; - - // first, locates the AU - for (int i = 0; i < gf_list_count(ctx->AUs); i++) { - au = (GF_AUContext *) gf_list_get(ctx->AUs, i); - if (au->timing == myTiming) { - // then the commands for this node and deletes it - for (int j = 0; j < gf_list_count(au->commands); j++) { - GF_Command * c = (GF_Command *)gf_list_get(au->commands, j); - if ( c->node == myNode ) { - gf_sg_command_del(c); - gf_list_rem(au->commands, j); - break; - } - } - } - } - - // deletes the command in our chain - gf_list_reset(commands); - - SetState( GetState() ^ CELL_STATE_COMMAND ); -} - - -// GetCommand -- allow listing of the command for this cell -GF_Command * V4TimeLineCell::GetCommand(u32 n) { - if (gf_list_count(commands) < n) return NULL; - else return (GF_Command *) gf_list_get(commands, n); -} - - -// GetParent -- returns a pointer to parent (used to retrieve line number and node ID) -V4TimeLineLine * V4TimeLineCell::GetParent() const { - return parent; -} diff --git a/applications/v4studio/V4TimeLine/V4TimeLineCase.h b/applications/v4studio/V4TimeLine/V4TimeLineCase.h deleted file mode 100644 index 159ab22..0000000 --- a/applications/v4studio/V4TimeLine/V4TimeLineCase.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - V4TimeLineCase.h - - // TODO : description -*/ - -#ifndef _V4TimeLineCell_ -#define _V4TimeLineCell_ - - -#include - -#include - - -class V4TimeLineLine; - -// differents types of a cell -- differs with the line type -#define CELL_TYPE_HDR 0 -#define CELL_TYPE_NORMAL 1 - -// different states of a cell -#define CELL_STATE_CLICKED 1 -#define CELL_STATE_SELECTED 2 -#define CELL_STATE_COMMAND 4 - -class V4StudioFrame; - -class V4TimeLineCell: public wxWindow { - - public: - // Constructor - V4TimeLineCell(V4TimeLineLine * parent, unsigned int num=0, unsigned int type=CELL_TYPE_NORMAL); - - // Destructor - virtual ~V4TimeLineCell(); - - // Changes cell state - void SetState(unsigned int _state); - unsigned int GetState() const; - - // returns a pointer to parent (used to retrieve line number and node ID) - V4TimeLineLine * GetParent() const; - - // manipulates the commands list - void AddCommand(GF_Command *); - void DeleteCommands(); - void DeleteCommand(const u32 n); - GF_Command * GetCommand(u32 n); - - private: - unsigned int state; // possible values not yet defined - unsigned int type; // type of cell - - unsigned int num; - - DECLARE_EVENT_TABLE() - - V4StudioFrame * v4sf; - V4TimeLineLine * parent; - - GF_List * commands; // actions to perform for this object (row) when entering the frame (col) - - void OnLeftUp(wxMouseEvent &); - void OnPaint(wxPaintEvent &); -}; - -#endif \ No newline at end of file diff --git a/applications/v4studio/V4TimeLine/V4TimeLineElt.cpp b/applications/v4studio/V4TimeLine/V4TimeLineElt.cpp deleted file mode 100644 index 2247c62..0000000 --- a/applications/v4studio/V4TimeLine/V4TimeLineElt.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - V4TimeLineElt.cpp - - Implements V4TimeLineElt class -*/ - -#include "V4TimeLineElt.h" -#include "V4TimeLine.h" -#include "V4TimeLineCase.h" - -#include "..\V4StudioFrame.h" -#include "..\V4SceneManager.h" // FPS constant - - -// Constructor -V4TimeLineElt::V4TimeLineElt(V4TimeLine * parent, unsigned int pos, unsigned long _NodeID, wxString eltName, unsigned long frame) : -V4TimeLineLine(parent, pos, frame), txt(NULL), lbl(NULL) { - // creates sub-controls - - NodeID = _NodeID; - - sizer = new wxBoxSizer(wxHORIZONTAL); - SetSizer(sizer); - - lbl = new wxStaticText(this, -1, eltName); - lbl->SetSize(0,0,parent->GetOffset(), 20); - - - sizer->Add(lbl, 0, wxALL, 0); - - CreateLine(CELL_TYPE_NORMAL); - - - // locates the existing commands for a node - GF_StreamContext * stream = parent->parent->GetV4SceneManager()->GetBifsStream(); - - // tries all access units - for (i=0; i < gf_list_count(stream->AUs); i++) { - GF_AUContext * au = (GF_AUContext *) gf_list_get(stream->AUs, i); - - // and all commands in each au - for (u32 j=0; j < gf_list_count(au->commands); j++) { - GF_Command * c = (GF_Command *) gf_list_get(au->commands, j); - - // and checks whether they are appled to this node - if (gf_node_get_id(c->node) == NodeID) { - // TODO : the timing unit might not be 1 ms - u32 cellNum = au->timing / 1000 * parent->parent->GetV4SceneManager()->GetFrameRate(); - cells.at(cellNum)->SetState(CELL_STATE_COMMAND); - cells.at(cellNum)->AddCommand(c); - } - } - - } - -} - - -// Destructor -V4TimeLineElt::~V4TimeLineElt() { - -} - - -// returns NodeID -u32 V4TimeLineElt::GetNodeID() { - return NodeID; -} - - -// -unsigned char V4TimeLineElt::GetType() { - return CELL_TYPE_NORMAL; -} \ No newline at end of file diff --git a/applications/v4studio/V4TimeLine/V4TimeLineElt.h b/applications/v4studio/V4TimeLine/V4TimeLineElt.h deleted file mode 100644 index a2c77af..0000000 --- a/applications/v4studio/V4TimeLine/V4TimeLineElt.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - V4TimeLineElt.h - - Class representing one line in the timeline - - A line consists in a label, giving the name of the object it represents, and an owner drawn zone where are represented the events -*/ - -#ifndef _V4TimeLineElt_ -#define _V4TimeLineElt_ - -#include "../safe_include.h" - -// wxWidgets includes -#include - -// Own includes -#include "V4TimeLineLine.h" - - -// include GPAC -//#include "../safe_include.h" // definition des types de données - - -class V4TimeLine; - - -class V4TimeLineElt : public V4TimeLineLine { - public: - // Constructor - V4TimeLineElt(V4TimeLine * parent, unsigned int pos, unsigned long NodeID, wxString eltName, unsigned long frame=0); - - // Destructor - ~V4TimeLineElt(); - - // inherited - virtual unsigned char GetType(); - - // returns NodeID - u32 GetNodeID(); - - private: - wxTextCtrl * txt; - wxStaticText * lbl; - unsigned long NodeID; -}; - -#endif \ No newline at end of file diff --git a/applications/v4studio/V4TimeLine/V4TimeLineHdr.cpp b/applications/v4studio/V4TimeLine/V4TimeLineHdr.cpp deleted file mode 100644 index 890b174..0000000 --- a/applications/v4studio/V4TimeLine/V4TimeLineHdr.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - V4TimeLineHdr.cpp - - Implements V4TimeLineHdr class. -*/ - -#include "V4TimeLineHdr.h" -#include "V4TimeLine.h" -#include - -BEGIN_EVENT_TABLE(V4TimeLineHdr, wxWindow) -END_EVENT_TABLE() - - -// Constructor -V4TimeLineHdr::V4TimeLineHdr(V4TimeLine * parent, unsigned int pos) : V4TimeLineLine(parent, pos) { - - // Creates default line - sizer = new wxBoxSizer(wxHORIZONTAL); - SetSizer(sizer); - lbl = new wxStaticText(this, -1, wxT("Object")); - lbl->SetSize(0,0,parent->GetOffset(), 20); - sizer->Add(lbl, 0, wxALL, 0); - - CreateLine(CELL_TYPE_HDR); - -} - - -// Desctructor -V4TimeLineHdr::~V4TimeLineHdr() {}; - - -// -unsigned char V4TimeLineHdr::GetType() { - return CELL_TYPE_HDR; -} \ No newline at end of file diff --git a/applications/v4studio/V4TimeLine/V4TimeLineHdr.h b/applications/v4studio/V4TimeLine/V4TimeLineHdr.h deleted file mode 100644 index 068fff5..0000000 --- a/applications/v4studio/V4TimeLine/V4TimeLineHdr.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - V4TimeLineHdr.h - - Defines the class for printing hearder information on the timeline (frame numbers...) -*/ - -#ifndef _V4TimeLineHdr_ -#define _V4TimeLineHdr_ - -#include "../safe_include.h" - -#include -#include "V4TimeLineLine.h" // parent class - -class V4TimeLine; - - -class V4TimeLineHdr : public V4TimeLineLine { - public: - // Constructor - V4TimeLineHdr(V4TimeLine * parent, unsigned int pos=0); - - // Destructor - ~V4TimeLineHdr(); - - // inherited - virtual unsigned char GetType(); - - private: - - wxStaticText * lbl; // holds the title string - - DECLARE_EVENT_TABLE(); -}; - -#endif diff --git a/applications/v4studio/V4TimeLine/V4TimeLineLine.cpp b/applications/v4studio/V4TimeLine/V4TimeLineLine.cpp deleted file mode 100644 index 2c72bef..0000000 --- a/applications/v4studio/V4TimeLine/V4TimeLineLine.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - V4TimeLineLine.cpp - - Implements V4TimeLineLine class - -*/ - -#include "V4TimeLineLine.h" -#include "V4TimeLine.h" - -// Constructor -V4TimeLineLine::V4TimeLineLine(V4TimeLine * parent, unsigned int _pos, unsigned long frame) : wxWindow((wxWindow *) parent, -1), pos(_pos) { -} - - -// retrieves X position of the grid -unsigned int V4TimeLineLine::GetOffset() const { - return ( (V4TimeLine *)GetParent() )->GetOffset(); -} - - -// returns the number of frame in the scene -unsigned int V4TimeLineLine::GetLength() const { - return ( (V4TimeLine *)GetParent() )->GetLength(); -} - - -// returns the position of the line in the timeLine -unsigned int V4TimeLineLine::GetPos() const { - return pos; -} - - -// Update diplay to match new time -void V4TimeLineLine::SetFrame(unsigned long _frame) { - std::vector::iterator iter; - - int i = 0; - - // uptades the needed cells - - for (iter = cells.begin(); iter != cells.end(); iter++) { - // newly selected cell, adds selected state - if (i == _frame) { - unsigned int state = (*iter)->GetState(); - state |= CELL_STATE_SELECTED; - (*iter)->SetState(state); - } - - // old selected cell, deletes selected state - if ( (i == frame) && (_frame != frame) ) { - unsigned int state = (*iter)->GetState(); - state &= ~CELL_STATE_SELECTED; - (*iter)->SetState(state); - } - - i++; - } - - frame = _frame; -} - - -// Retrieves frame -unsigned long V4TimeLineLine::GetFrame() const { - return frame; -} - - -// -void V4TimeLineLine::SetLength(const unsigned int length_) { - int L = GetLength(); - - V4TimeLine * line = (V4TimeLine *) GetParent(); - SetSizeHints(line->GetOffset() + 20 * length_, -1); - line->Layout(); - - if (L <= length_) { - - for (int i = L; i < length_; i++) { - cells.push_back(new V4TimeLineCell(this,i, GetType())); - sizer->Add(cells.back(), 1, wxALL, 0); - } - } else { - for (int i = L-1; i >= length_; i--) { - if (cells.back()->GetCommand(0)) cells.back()->DeleteCommands(); - delete cells.back(); - cells.pop_back(); - } - } - -} \ No newline at end of file diff --git a/applications/v4studio/V4TimeLine/V4TimeLineLine.h b/applications/v4studio/V4TimeLine/V4TimeLineLine.h deleted file mode 100644 index 07e70a2..0000000 --- a/applications/v4studio/V4TimeLine/V4TimeLineLine.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - V4TimeLineLine.h - - Defines generic behaviour for a line in the timeline - There are two child classes: V4TimeLineElt and V4TimeLineHdr - -*/ - -#ifndef _V4TimeLineLine_ -#define _V4TimeLineLine_ - -#include "../safe_include.h" - -#include -#include -#include "V4TimeLineCase.h" - - -#define LINE_TYPE_HDR 0 -#define LINE_TYPE_ELT 1 - -class V4TimeLine; - - -// macro that creates the sizer and the grid for a line -#define CreateLine(CELL_TYPE) \ - SetSizeHints(parent->GetOffset() + 20 * GetLength(), -1); \ - \ - for (u32 i=0; iAdd(cells.back(), 1, wxALL, 0); \ - } \ - SetFrame(frame); - - -class V4TimeLineLine : public wxWindow { - public: - // Constructor - V4TimeLineLine(V4TimeLine * parent, unsigned int _pos, unsigned long frame=0); - - // retrieves the X positon of the grid - unsigned int GetOffset() const; - - // returns the Y position of the line - unsigned int GetPos() const; - - // accesses the length of the grid - unsigned int GetLength() const; - void SetLength(const unsigned int length_); - - // Update display to match new time - void SetFrame(unsigned long _frame); - unsigned long GetFrame() const; - - virtual unsigned char GetType() PURE; - - - protected: - std::vector cells; // cases of the grid - wxBoxSizer * sizer; - - unsigned int pos; // Y position of the line in the grid - - unsigned long frame; // current frame - -}; - -#endif \ No newline at end of file diff --git a/applications/v4studio/install.txt b/applications/v4studio/install.txt deleted file mode 100644 index a728b49..0000000 --- a/applications/v4studio/install.txt +++ /dev/null @@ -1,110 +0,0 @@ -What is V4Studio? ------------------- - -This piece of software is an authoring tool to design and encode MPEG-4 content -at large (audio, video, still picture, vector graphics and text). The current -version has no support for audio, video or still picture. But if you edit an -existing mp4 files that contains some media, they will remain in the output mp4. - -This tool was design based on the rendering system of the gpac project but the -GUI is written using wxWindows (www.wxwindows.org). - -The current version allows you to open an mp4 file or a bt file, to edit the -graphical elements (vector graphics, text) of the initial BIFS scene. You can -then save the result to an mp4 file. Editing is very limited for the moment, you -can: -- add nodes within a node depending on the context. -- delete nodes -- change some field values (float, int, string, colours, points) -- move objects. - -Problems: ---------- -Since it is in a version early stage, this software has known bugs (fields list -view, node drag and drop, node deletions) and may have some more unknown ones. - -How to install V4Studio? --------------------------- -I'm using Windows 2000 and I haven't tried it yet on other platforms. Please -report any problem. Only the Debug version has been tested. - -On Windows: -Get the source from the gpac project http://gpac.sourceforge.net - -Compiling: ---------- -Open the GPAC.dsw file. Set the V4Studio project active and build it. It will -build also libgpac.dll. - -The current version uses a hard-coded path to a configuration file GPAC.cfg. -Before compiling, you should change that path to your path. In the file -wxGPACPanel.cpp, change: - strcpy(config_path, "E:\\MesProjets\\gpac\\gpac\\bin\\Debug"); -into: - strcpy(config_path, \\gpac\\bin\\w32_deb"); - -To link, it needs the js32.lib. Place it under gpac/extra_lib/lib/w32_deb. - -To link, you also need some elements from wxWidgets, version 2.5.2. You need to change the path -to the wxWidgets include and library directories, in tools->options, Directories tab -Add to include directories: -\wxWidgets\include -\wxWidgets\contrib\include -\wxWidgets\lib\mswd - -Add to library directories: -\wxWidgets\lib -\wxWidgets\contrib\lib - -The following libs from wxWidgets are required and should be present in V4Studio project linker settings: -wxmsw25d_html.lib wxbase25d.lib wxmsw25d_core.lib wxmsw25d_adv.lib wxbase25d_xml.lib wxexpatd.lib wxmsw25d_xrc.lib -(remove the 'd' for release versions) - - -Once this is done, you should be able to compile V4Studio.exe. - -Running: --------- -To run the tool, you should have a valid GPAC.cfg file. If you don't have the -GPAC.CFG file, here a default content, where you should change ------------------------------------- -[General] -ModulesDirectory=\gpac\bin\Debug\ -CacheDirectory=\gpac\bin\Debug\cache - -[Rendering] -DriverName=gdip_rend -AntiAlias=All - -[Audio] -ForceConfig=yes -NumBuffers=8 -TotalDuration=400 -DriverName=dx_hw - -[FontEngine] -DriverName=gdip_rend -FontDirectory=C:\WINNT\Fonts - -[Video] -DriverName=dx_hw - -[System] -ThreadingPolicy=Free -Priority=normal ------------------------------------------ - -You need also at least the plugin for the Rendering section (here gdip_rend), -the Video section (here dx_hw), the audio section (here dx_hw). So you should -also compile the dll for the 2 projects gdip_rend, and dx_hw. Then put the dll -in the modules Directory. - -To run the tool outside VC++, copy the V4Studio.exe file in a PATH and copy the -rc directory into the same PATH. The program should run without error messages. - -If GPAC has been compiled with ECMAScript support, you will -also have to copy the js32.dll into the execution directory (or any directory in -the machine PATH) - -Other platforms: -To be tested ... \ No newline at end of file diff --git a/applications/v4studio/rc/V4Studio.aps b/applications/v4studio/rc/V4Studio.aps deleted file mode 100644 index 1e237e0..0000000 Binary files a/applications/v4studio/rc/V4Studio.aps and /dev/null differ diff --git a/applications/v4studio/rc/V4Studio.rc b/applications/v4studio/rc/V4Studio.rc deleted file mode 100644 index b86c4e2..0000000 --- a/applications/v4studio/rc/V4Studio.rc +++ /dev/null @@ -1 +0,0 @@ -#include "wx/msw/wx.rc" diff --git a/applications/v4studio/rc/appearance.bmp b/applications/v4studio/rc/appearance.bmp deleted file mode 100644 index 4b69dc6..0000000 Binary files a/applications/v4studio/rc/appearance.bmp and /dev/null differ diff --git a/applications/v4studio/rc/circle.bmp b/applications/v4studio/rc/circle.bmp deleted file mode 100644 index bc9b603..0000000 Binary files a/applications/v4studio/rc/circle.bmp and /dev/null differ diff --git a/applications/v4studio/rc/close.bmp b/applications/v4studio/rc/close.bmp deleted file mode 100644 index aeedd7d..0000000 Binary files a/applications/v4studio/rc/close.bmp and /dev/null differ diff --git a/applications/v4studio/rc/colortransform.bmp b/applications/v4studio/rc/colortransform.bmp deleted file mode 100644 index 35e202a..0000000 Binary files a/applications/v4studio/rc/colortransform.bmp and /dev/null differ diff --git a/applications/v4studio/rc/copy.bmp b/applications/v4studio/rc/copy.bmp deleted file mode 100644 index 4551a06..0000000 Binary files a/applications/v4studio/rc/copy.bmp and /dev/null differ diff --git a/applications/v4studio/rc/cut.bmp b/applications/v4studio/rc/cut.bmp deleted file mode 100644 index 1555433..0000000 Binary files a/applications/v4studio/rc/cut.bmp and /dev/null differ diff --git a/applications/v4studio/rc/delete.bmp b/applications/v4studio/rc/delete.bmp deleted file mode 100644 index c6cae3a..0000000 Binary files a/applications/v4studio/rc/delete.bmp and /dev/null differ diff --git a/applications/v4studio/rc/fs.bmp b/applications/v4studio/rc/fs.bmp deleted file mode 100644 index be9ddee..0000000 Binary files a/applications/v4studio/rc/fs.bmp and /dev/null differ diff --git a/applications/v4studio/rc/group.bmp b/applications/v4studio/rc/group.bmp deleted file mode 100644 index 08175bd..0000000 Binary files a/applications/v4studio/rc/group.bmp and /dev/null differ diff --git a/applications/v4studio/rc/ifs2d.bmp b/applications/v4studio/rc/ifs2d.bmp deleted file mode 100644 index f4f8785..0000000 Binary files a/applications/v4studio/rc/ifs2d.bmp and /dev/null differ diff --git a/applications/v4studio/rc/ils2d.bmp b/applications/v4studio/rc/ils2d.bmp deleted file mode 100644 index 1ff4094..0000000 Binary files a/applications/v4studio/rc/ils2d.bmp and /dev/null differ diff --git a/applications/v4studio/rc/image.bmp b/applications/v4studio/rc/image.bmp deleted file mode 100644 index c35981c..0000000 Binary files a/applications/v4studio/rc/image.bmp and /dev/null differ diff --git a/applications/v4studio/rc/layer2d.bmp b/applications/v4studio/rc/layer2d.bmp deleted file mode 100644 index 9d8e28b..0000000 Binary files a/applications/v4studio/rc/layer2d.bmp and /dev/null differ diff --git a/applications/v4studio/rc/lg.bmp b/applications/v4studio/rc/lg.bmp deleted file mode 100644 index 631dbd2..0000000 Binary files a/applications/v4studio/rc/lg.bmp and /dev/null differ diff --git a/applications/v4studio/rc/lineproperties.bmp b/applications/v4studio/rc/lineproperties.bmp deleted file mode 100644 index f2a4c27..0000000 Binary files a/applications/v4studio/rc/lineproperties.bmp and /dev/null differ diff --git a/applications/v4studio/rc/material2d.bmp b/applications/v4studio/rc/material2d.bmp deleted file mode 100644 index 2ff3fe9..0000000 Binary files a/applications/v4studio/rc/material2d.bmp and /dev/null differ diff --git a/applications/v4studio/rc/movie.bmp b/applications/v4studio/rc/movie.bmp deleted file mode 100644 index 312f6db..0000000 Binary files a/applications/v4studio/rc/movie.bmp and /dev/null differ diff --git a/applications/v4studio/rc/new.bmp b/applications/v4studio/rc/new.bmp deleted file mode 100644 index d66feb2..0000000 Binary files a/applications/v4studio/rc/new.bmp and /dev/null differ diff --git a/applications/v4studio/rc/open.bmp b/applications/v4studio/rc/open.bmp deleted file mode 100644 index bbf93fe..0000000 Binary files a/applications/v4studio/rc/open.bmp and /dev/null differ diff --git a/applications/v4studio/rc/orderedgroup.bmp b/applications/v4studio/rc/orderedgroup.bmp deleted file mode 100644 index 9d8e28b..0000000 Binary files a/applications/v4studio/rc/orderedgroup.bmp and /dev/null differ diff --git a/applications/v4studio/rc/paste.bmp b/applications/v4studio/rc/paste.bmp deleted file mode 100644 index 564f514..0000000 Binary files a/applications/v4studio/rc/paste.bmp and /dev/null differ diff --git a/applications/v4studio/rc/paste_use.bmp b/applications/v4studio/rc/paste_use.bmp deleted file mode 100644 index 066ee7c..0000000 Binary files a/applications/v4studio/rc/paste_use.bmp and /dev/null differ diff --git a/applications/v4studio/rc/preview.bmp b/applications/v4studio/rc/preview.bmp deleted file mode 100644 index da1f4db..0000000 Binary files a/applications/v4studio/rc/preview.bmp and /dev/null differ diff --git a/applications/v4studio/rc/print.bmp b/applications/v4studio/rc/print.bmp deleted file mode 100644 index 00319b5..0000000 Binary files a/applications/v4studio/rc/print.bmp and /dev/null differ diff --git a/applications/v4studio/rc/rect.bmp b/applications/v4studio/rc/rect.bmp deleted file mode 100644 index 0ba3e89..0000000 Binary files a/applications/v4studio/rc/rect.bmp and /dev/null differ diff --git a/applications/v4studio/rc/redo.bmp b/applications/v4studio/rc/redo.bmp deleted file mode 100644 index 5877e34..0000000 Binary files a/applications/v4studio/rc/redo.bmp and /dev/null differ diff --git a/applications/v4studio/rc/resource_orig.xrc b/applications/v4studio/rc/resource_orig.xrc deleted file mode 100644 index b3c77af..0000000 --- a/applications/v4studio/rc/resource_orig.xrc +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - Create a new document - - - - Open an existing document - - - - Save the active document - - - - - Quit the application; prompts to save documents - - - - - - - Undo the last action - - - - Redo the previously undone action - - - - - Cut the selection and put it on the Clipboard - - - - Copy the selection and put it on the Clipboard - - - - Insert Clipboard contents - - - - Delete the selection - - - - - - - Show or hide the Scene Tree - - - - Show or hide the GF_Route View - - - - Show or hide the Field View - - - - - - - Display program information, version number and copyright - - - - diff --git a/applications/v4studio/rc/rg.bmp b/applications/v4studio/rc/rg.bmp deleted file mode 100644 index 5bfe4f1..0000000 Binary files a/applications/v4studio/rc/rg.bmp and /dev/null differ diff --git a/applications/v4studio/rc/save.bmp b/applications/v4studio/rc/save.bmp deleted file mode 100644 index 56dd10b..0000000 Binary files a/applications/v4studio/rc/save.bmp and /dev/null differ diff --git a/applications/v4studio/rc/shape.bmp b/applications/v4studio/rc/shape.bmp deleted file mode 100644 index 8672ae8..0000000 Binary files a/applications/v4studio/rc/shape.bmp and /dev/null differ diff --git a/applications/v4studio/rc/sound.bmp b/applications/v4studio/rc/sound.bmp deleted file mode 100644 index bcf8e72..0000000 Binary files a/applications/v4studio/rc/sound.bmp and /dev/null differ diff --git a/applications/v4studio/rc/t2d.bmp b/applications/v4studio/rc/t2d.bmp deleted file mode 100644 index 49dbaa1..0000000 Binary files a/applications/v4studio/rc/t2d.bmp and /dev/null differ diff --git a/applications/v4studio/rc/text.bmp b/applications/v4studio/rc/text.bmp deleted file mode 100644 index 2decce3..0000000 Binary files a/applications/v4studio/rc/text.bmp and /dev/null differ diff --git a/applications/v4studio/rc/tm2d.bmp b/applications/v4studio/rc/tm2d.bmp deleted file mode 100644 index 6e61589..0000000 Binary files a/applications/v4studio/rc/tm2d.bmp and /dev/null differ diff --git a/applications/v4studio/rc/undo.bmp b/applications/v4studio/rc/undo.bmp deleted file mode 100644 index 4ad80c7..0000000 Binary files a/applications/v4studio/rc/undo.bmp and /dev/null differ diff --git a/applications/v4studio/rc/v4.bmp b/applications/v4studio/rc/v4.bmp deleted file mode 100644 index ea1a0b3..0000000 Binary files a/applications/v4studio/rc/v4.bmp and /dev/null differ diff --git a/applications/v4studio/rc/v4.ico b/applications/v4studio/rc/v4.ico deleted file mode 100644 index 8ba9328..0000000 Binary files a/applications/v4studio/rc/v4.ico and /dev/null differ diff --git a/applications/v4studio/rc/xlineproperties.bmp b/applications/v4studio/rc/xlineproperties.bmp deleted file mode 100644 index 46d0eaa..0000000 Binary files a/applications/v4studio/rc/xlineproperties.bmp and /dev/null differ diff --git a/applications/v4studio/safe_include.h b/applications/v4studio/safe_include.h deleted file mode 100644 index 7682e88..0000000 --- a/applications/v4studio/safe_include.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _SAFE_INCLUDE_H -#define _SAFE_INCLUDE_H - -#include - -#endif - diff --git a/applications/v4studio/treeIcon1.xpm b/applications/v4studio/treeIcon1.xpm deleted file mode 100644 index 0263fad..0000000 --- a/applications/v4studio/treeIcon1.xpm +++ /dev/null @@ -1,41 +0,0 @@ -/* XPM */ -static char *icon1_xpm[] = { -/* width height num_colors chars_per_pixel */ -" 32 32 2 1", -/* colors */ -". c #000000", -"# c #ffffff", -/* pixels */ -"################################", -"################################", -"####................############", -"####................############", -"####..############....##########", -"####..############....##########", -"####..##..##..####..##..########", -"####..##..##..####..##..########", -"####..############........######", -"####..############........######", -"####..##..##..##########..######", -"####..##..##..##########..######", -"####..##################..######", -"###...##################..######", -"####..##..##..##..##..##..######", -"####..##..##..##..##..##..######", -"####..##################..######", -"####..##################..######", -"####..##..##..##..##..##..######", -"####..##..##..##..##..##..######", -"####..##################..######", -"####..##################..######", -"####..##..##..##..##..##..######", -"####..##..##..##..##..##..######", -"####..##################..######", -"####..##################..######", -"####......................######", -"####......................######", -"################################", -"################################", -"################################", -"################################" -}; diff --git a/applications/v4studio/treeIcon2.xpm b/applications/v4studio/treeIcon2.xpm deleted file mode 100644 index d3d76ec..0000000 --- a/applications/v4studio/treeIcon2.xpm +++ /dev/null @@ -1,42 +0,0 @@ -/* XPM */ -static char *icon2_xpm[] = { -/* width height num_colors chars_per_pixel */ -" 32 32 3 1", -/* colors */ -". c #000000", -"# c #ff0000", -"a c None", -/* pixels */ -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -"aaaa................aaaaaaaaaaaa", -"aaaa................aaaaaaaaaaaa", -"aaaa..############....aaaaaaaaaa", -"aaaa..############....aaaaaaaaaa", -"aaaa..##..##..####..aa..aaaaaaaa", -"aaaa..##..##..####..aa..aaaaaaaa", -"aaaa..############........aaaaaa", -"aaaa..############........aaaaaa", -"aaaa..##..##..##########..aaaaaa", -"aaaa..##..##..##########..aaaaaa", -"aaaa..##################..aaaaaa", -"aaaa..##################..aaaaaa", -"aaaa..##..##..##..##..##..aaaaaa", -"aaaa..##..##..##..##..##..aaaaaa", -"aaaa..##################..aaaaaa", -"aaaa..##################..aaaaaa", -"aaaa..##..##..##..##..##..aaaaaa", -"aaaa..##..##..##..##..##..aaaaaa", -"aaaa..##################..aaaaaa", -"aaaa..##################..aaaaaa", -"aaaa..##..##..##..##..##..aaaaaa", -"aaaa..##..##..##..##..##..aaaaaa", -"aaaa..##################..aaaaaa", -"aaaa..##################..aaaaaa", -"aaaa......................aaaaaa", -"aaaa......................aaaaaa", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" -}; diff --git a/applications/v4studio/treeIcon3.xpm b/applications/v4studio/treeIcon3.xpm deleted file mode 100644 index 0dba5be..0000000 --- a/applications/v4studio/treeIcon3.xpm +++ /dev/null @@ -1,44 +0,0 @@ -/* XPM */ -static char *icon3_xpm[] = { -/* width height num_colors chars_per_pixel */ -" 32 32 5 1", -/* colors */ -". c #000000", -"# c #c0c0c0", -"a c #808080", -"b c #ffff00", -"c c None", -/* pixels */ -"cccccccccccccccccccccccccccccccc", -"cccccccccccccccccccccccccccccccc", -"ccccccaaaaaaaaaacccccccccccccccc", -"ccccccaaaaaaaaaacccccccccccccccc", -"ccccaabb##bb##bbaacccccccccccccc", -"ccccaabb##bb##bbaacccccccccccccc", -"ccaabb##bb##bb##bbaaaaaaaaaaaacc", -"ccaabb##bb##bb##bbaaaaaaaaaaaacc", -"ccaaccccccccccccccccccccccccaa..", -"ccaaccccccccccccccccccccccccaa..", -"ccaaccbb##bb##bb##bb##bb##bbaa..", -"ccaaccbb##bb##bb##bb##bb##bbaa..", -"ccaacc##bb##bb##bb##bb##bb##aa..", -"ccaacc##bb##bb##bb##bb##bb##aa..", -"ccaaccbb##bb##bb##bb##bb##bbaa..", -"ccaaccbb##bb##bb##bb##bb##bbaa..", -"ccaacc##bb##bb##bb##bb##bb##aa..", -"ccaacc##bb##bb##bb##bb##bb##aa..", -"ccaaccbb##bb##bb##bb##bb##bbaa..", -"ccaaccbb##bb##bb##bb##bb##bbaa..", -"ccaacc##bb##bb##bb##bb##bb##aa..", -"ccaacc##bb##bb##bb##bb##bb##aa..", -"ccaaccbb##bb##bb##bb##bb##bbaa..", -"ccaaccbb##bb##bb##bb##bb##bbaa..", -"ccaaaaaaaaaaaaaaaaaaaaaaaaaaaa..", -"ccaaaaaaaaaaaaaaaaaaaaaaaaaaaa..", -"cccc............................", -"cccc............................", -"cccccccccccccccccccccccccccccccc", -"cccccccccccccccccccccccccccccccc", -"cccccccccccccccccccccccccccccccc", -"cccccccccccccccccccccccccccccccc" -}; diff --git a/applications/v4studio/treeIcon4.xpm b/applications/v4studio/treeIcon4.xpm deleted file mode 100644 index f4cd561..0000000 --- a/applications/v4studio/treeIcon4.xpm +++ /dev/null @@ -1,44 +0,0 @@ -/* XPM */ -static char *icon4_xpm[] = { -/* width height num_colors chars_per_pixel */ -" 32 32 5 1", -/* colors */ -". c #000000", -"# c #c0c0c0", -"a c #808080", -"b c #ff0000", -"c c #ffffff", -/* pixels */ -"cccccccccccccccccccccccccccccccc", -"cccccccccccccccccccccccccccccccc", -"ccccccaaaaaaaaaacccccccccccccccc", -"ccccccaaaaaaaaaacccccccccccccccc", -"ccccaabb##bb##bbaacccccccccccccc", -"ccccaabb##bb##bbaacccccccccccccc", -"ccaabb##bb##bb##bbaaaaaaaaaaaacc", -"ccaabb##bb##bb##bbaaaaaaaaaaaacc", -"ccaaccccccccccccccccccccccccaa..", -"ccaaccccccccccccccccccccccccaa..", -"ccaaccbb##bb##bb##bb##bb##bbaa..", -"ccaaccbb##bb##bb##bb##bb##bbaa..", -"ccaacc##bb##bb##bb##bb##bb##aa..", -"ccaacc##bb##bb##bb##bb##bb##aa..", -"ccaaccbb##bb##bb##bb##bb##bbaa..", -"ccaaccbb##bb##bb##bb##bb##bbaa..", -"ccaacc##bb##bb##bb##bb##bb##aa..", -"ccaacc##bb##bb##bb##bb##bb##aa..", -"ccaaccbb##bb##bb##bb##bb##bbaa..", -"ccaaccbb##bb##bb##bb##bb##bbaa..", -"ccaacc##bb##bb##bb##bb##bb##aa..", -"ccaacc##bb##bb##bb##bb##bb##aa..", -"ccaaccbb##bb##bb##bb##bb##bbaa..", -"ccaaccbb##bb##bb##bb##bb##bbaa..", -"ccaaaaaaaaaaaaaaaaaaaaaaaaaaaa..", -"ccaaaaaaaaaaaaaaaaaaaaaaaaaaaa..", -"cccc............................", -"cccc............................", -"cccccccccccccccccccccccccccccccc", -"cccccccccccccccccccccccccccccccc", -"cccccccccccccccccccccccccccccccc", -"cccccccccccccccccccccccccccccccc" -}; diff --git a/applications/v4studio/treeIcon5.xpm b/applications/v4studio/treeIcon5.xpm deleted file mode 100644 index 63820ef..0000000 --- a/applications/v4studio/treeIcon5.xpm +++ /dev/null @@ -1,43 +0,0 @@ -/* XPM */ -static char *icon5_xpm[] = { -/* width height num_colors chars_per_pixel */ -" 32 32 4 1", -/* colors */ -". c #000000", -"# c #808000", -"a c None", -"b c #ffff00", -/* pixels */ -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -"aa..........aaaaaaaaaaaaaaaaaaaa", -"aa..........aaaaaaaaaaaaaaaaaaaa", -"aa..bbbbbb................aaaaaa", -"aa..bbbbbb................aaaaaa", -"aa..bbbbbbbbbbbbbbbbbbbb..aaaaaa", -"aa..bbbbbbbbbbbbbbbbbbbb..aaaaaa", -"aa..bbbbbbbbbbbbbbbbbbbb..aaaaaa", -"aa..bbbbbbbbbbbbbbbbbbbb..aaaaaa", -"aa..bbbb......................aa", -"aa..bbbb......................aa", -"aa..bbb.####################..aa", -"aa..bbb.####################..aa", -"aa..bb..####################.aaa", -"aa..bb..####################.aaa", -"aa..b.####################..aaaa", -"aa..b.####################..aaaa", -"aa....####################.aaaaa", -"aa....####################.aaaaa", -"aa..####################..aaaaaa", -"aa..####################..aaaaaa", -"aa......................aaaaaaaa", -"aa......................aaaaaaaa", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" -}; diff --git a/applications/v4studio/wxGPACPanel.cpp b/applications/v4studio/wxGPACPanel.cpp deleted file mode 100644 index 1e36858..0000000 --- a/applications/v4studio/wxGPACPanel.cpp +++ /dev/null @@ -1,290 +0,0 @@ -#include "safe_include.h" -#include -#include - -#include "wx/wxprec.h" - -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include "wxGPACPanel.h" -#include "V4StudioFrame.h" -#include "V4StudioApp.h" -#include "V4Service.h" - - -bool GPACInit(void *application, GF_Terminal **term, GF_User *user, bool quiet); - -wxGPACPanel::wxGPACPanel(V4SceneManager *parent, const char *path) -{ - this->parent = parent; - m_term = NULL; - m_pService = NULL; - - // Initializes the MPEG-4 terminal - GPACInit(this, &m_term, &m_user, true); - if (!m_term) return; - - // Setting all the variables needed for picking of objects. - m_iDragging = 0; - m_transformMode = 0; - dragX = dragY = 0; - picked = NULL; - - if (path) { - m_pService = new V4Service(path); - gf_term_attach_service(m_term, m_pService->GetServiceInterface()); - } -} - -wxGPACPanel::~wxGPACPanel() -{ - if (m_pService) delete m_pService; - if (m_term) gf_term_del(m_term); - if (m_user.modules) gf_modules_del(m_user.modules); - if (m_user.config) gf_cfg_del(m_user.config); -} - - -Bool V4S_EventProc(void *par, GF_Event *evt) -{ - wxGPACPanel *panel = (wxGPACPanel *)par; - if (!panel->GetMPEG4Terminal()) return 0; - - switch (evt->type) { - case GF_EVENT_REFRESH: - gf_term_set_option(panel->GetMPEG4Terminal(), GF_OPT_REFRESH, 0); - break; - case GF_EVENT_SCENE_SIZE: - case GF_EVENT_SIZE: - gf_sc_set_size(panel->GetSceneCompositor(), evt->size.width, evt->size.height); - panel->Update(); - break; - case GF_EVENT_MOUSEDOWN: - if (evt->mouse.button==GF_MOUSE_LEFT) { - panel->picked = gf_sc_pick_node(panel->GetSceneCompositor(), evt->mouse.x, evt->mouse.y); - panel->m_iDragging ++; - if (panel->picked) { - panel->GetV4SceneManager()->GetV4StudioFrame()->GetTreeView()->SetSelectedItem(panel->picked); - panel->dragX = evt->mouse.x; - panel->dragY = evt->mouse.y; - panel->m_transformMode = 0; - } - } - else if (evt->mouse.button==GF_MOUSE_MIDDLE) { - panel->m_iDragging ++; - panel->picked = gf_sc_pick_node(panel->GetSceneCompositor(), evt->mouse.x, evt->mouse.y); - if (panel->picked) { - panel->GetV4SceneManager()->GetV4StudioFrame()->GetTreeView()->SetSelectedItem(panel->picked); - panel->dragX = evt->mouse.x; - panel->dragY = evt->mouse.y; - panel->m_transformMode = 2; - } - } - else if (evt->mouse.button==GF_MOUSE_RIGHT) { - panel->m_iDragging ++; - panel->picked = gf_sc_pick_node(panel->GetSceneCompositor(), evt->mouse.x, evt->mouse.y); - if (panel->picked) { - panel->GetV4SceneManager()->GetV4StudioFrame()->GetTreeView()->SetSelectedItem(panel->picked); - panel->dragX = evt->mouse.x; - panel->dragY = evt->mouse.y; - panel->m_transformMode = 1; - } - } - break; - case GF_EVENT_MOUSEUP: - if (evt->mouse.button==GF_MOUSE_LEFT) { - panel->m_iDragging --; - if (panel->picked) { - int dX = evt->mouse.x - panel->dragX; - int dY = evt->mouse.y - panel->dragY; - panel->dragX = evt->mouse.x; - panel->dragY = evt->mouse.y; - wxString pos; - pos << dX; - pos << ','; - pos << dY; - panel->GetV4SceneManager()->GetV4StudioFrame()->GetTreeView()->Translate(dX,dY); - panel->GetV4SceneManager()->GetV4StudioFrame()->GetStatusBar()->SetStatusText(pos); - } - } - else if (evt->mouse.button==GF_MOUSE_MIDDLE) { - panel->m_iDragging --; - if (panel->picked) { - int dX = evt->mouse.x - panel->dragX; - int dY = evt->mouse.y - panel->dragY; - panel->dragX = evt->mouse.x; - panel->dragY = evt->mouse.y; - wxString pos; - pos << dX; - pos << ','; - pos << dY; - panel->GetV4SceneManager()->GetV4StudioFrame()->GetTreeView()->Rotate(dX,dY); - panel->GetV4SceneManager()->GetV4StudioFrame()->GetStatusBar()->SetStatusText(pos); - } - } - else if (evt->mouse.button==GF_MOUSE_RIGHT) { - panel->m_iDragging --; - if (panel->picked) { - int dX = evt->mouse.x - panel->dragX; - int dY = evt->mouse.y - panel->dragY; - panel->dragX = evt->mouse.x; - panel->dragY = evt->mouse.y; - wxString pos; - pos << dX; - pos << ','; - pos << dY; - panel->GetV4SceneManager()->GetV4StudioFrame()->GetTreeView()->Scale(dX,dY); - panel->GetV4SceneManager()->GetV4StudioFrame()->GetStatusBar()->SetStatusText(pos); - } - } - break; - case GF_EVENT_MOUSEMOVE: - { - wxString pos; - if (panel->picked && panel->m_iDragging) { - int dX = evt->mouse.x - panel->dragX; - int dY = evt->mouse.y - panel->dragY; - panel->dragX = evt->mouse.x; - panel->dragY = evt->mouse.y; - pos << dX; - pos << ','; - pos << dY; - switch (panel->m_transformMode) { - case 0: - panel->GetV4SceneManager()->GetV4StudioFrame()->GetTreeView()->Translate(dX,dY); - break; - case 1: - panel->GetV4SceneManager()->GetV4StudioFrame()->GetTreeView()->Scale(dX,dY); - break; - case 2: - panel->GetV4SceneManager()->GetV4StudioFrame()->GetTreeView()->Rotate(dX,dY); - break; - } - } else { - pos << evt->mouse.x; - pos << ','; - pos << evt->mouse.y; - } - panel->GetV4SceneManager()->GetV4StudioFrame()->GetStatusBar()->SetStatusText(pos); - } - break; - case GF_EVENT_QUIT: - panel->GetV4SceneManager()->GetV4StudioFrame()->Close(TRUE); - break; - } - return 0; -} - -void wxGPACPanel::Update() -{ - if (m_term) { - //gf_term_set_option(m_term, GF_OPT_PLAY_STATE, GF_STATE_STEP_PAUSE); - gf_sc_invalidate(m_term->compositor, NULL); - gf_sc_draw_frame(m_term->compositor); - } -} - -bool GPACInit(void *application, GF_Terminal **term, GF_User *user, bool quiet) -{ - memset(user, 0, sizeof(GF_User)); - - /*locate exec dir for cfg file*/ - wxPathList pathList; - wxString currentDir(wxGetCwd()); - wxString abs_gpac_path = ""; - const char *gpac_cfg; - - if (!quiet) ::wxLogMessage("Looking for GPAC configuration file"); - -#if defined(__WXMAC__) && !defined(__DARWIN__) - // On Mac, the current directory is the relevant one when the application starts. - abs_gpac_path = wxGetCwd(); - gpac_cfg = "GPAC.cfg"; -#else - -#ifdef WIN32 - V4StudioApp &app = wxGetApp(); - gpac_cfg = "GPAC.cfg"; - /*locate exe*/ - if (wxIsAbsolutePath(app.argv[0])) { - abs_gpac_path = wxPathOnly(app.argv[0]); - } else { - if (currentDir.Last() != wxFILE_SEP_PATH) currentDir += wxFILE_SEP_PATH; - abs_gpac_path = currentDir + app.argv[0]; - if (wxFileExists(abs_gpac_path)) { - abs_gpac_path = wxPathOnly(abs_gpac_path); - } else { - abs_gpac_path = ""; - pathList.AddEnvList(wxT("PATH")); - abs_gpac_path = pathList.FindAbsoluteValidPath(app.argv[0]); - if (!abs_gpac_path.IsEmpty()) { - abs_gpac_path = wxPathOnly(abs_gpac_path); - } else { - /*ask user*/ - wxDirDialog dlg(NULL, "Locate GPAC config file directory"); - if ( dlg.ShowModal() != wxID_OK ) return 0; - abs_gpac_path = dlg.GetPath(); - } - } - } -#else - gpac_cfg = ".gpacrc"; - char *cfg_dir = getenv("HOME"); - if (cfg_dir) { - abs_gpac_path = cfg_dir; - } else { - /*ask user*/ - wxDirDialog dlg(NULL, "Locate GPAC config file directory"); - if ( dlg.ShowModal() != wxID_OK ) return 0; - abs_gpac_path = dlg.GetPath(); - } - -#endif - -#endif - - /*load config*/ - Bool first_launch = 0; - user->config = gf_cfg_init(NULL, &first_launch); - - if (!user->config) { - wxMessageDialog(NULL, "Cannot create GPAC config file", "Init error", wxOK).ShowModal(); - } - if (!quiet) ::wxLogMessage("GPAC configuration file opened - looking for modules"); - const char *str = gf_cfg_get_key(user->config, "General", "ModulesDirectory"); - user->modules = gf_modules_new(str, user->config); - - if (! gf_modules_get_count(user->modules) ) { - wxMessageDialog(NULL, "No modules available - system cannot work", "Fatal Error", wxOK).ShowModal(); - gf_modules_del(user->modules); - gf_cfg_del(user->config); - return 0; - } - - if (!quiet) ::wxLogMessage("%d modules found:", gf_modules_get_count(user->modules)); - for (u32 i=0; imodules); i++) { - if (!quiet) ::wxLogMessage("\t%s", gf_modules_get_file_name(user->modules, i)); - } - - if (!quiet) ::wxLogMessage("Starting GPAC Terminal"); - /*now load terminal*/ - user->opaque = application; - user->EventProc = V4S_EventProc; -// user->os_window_handler = ((wxGPACPanel *)application)->GetV4SceneManager()->GetV4StudioFrame()->GetHandle(); - - // Forces the renderer to not use a thread and do the rendering by itfe - gf_cfg_set_key(user->config, "Systems", "NoVisualThread", "No"); - - *term = gf_term_new(user); - if (!*term) { - wxMessageDialog(NULL, "Fatal Error", "Cannot load GPAC Terminal", wxOK).ShowModal(); - return 0; - } else { - if (!quiet) ::wxLogMessage("GPAC Terminal started"); - } - - return 1; -} - diff --git a/applications/v4studio/wxGPACPanel.h b/applications/v4studio/wxGPACPanel.h deleted file mode 100644 index ea46034..0000000 --- a/applications/v4studio/wxGPACPanel.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _GPACPANEL_H -#define _GPACPANEL_H - - -#include "safe_include.h" -#include -#include -/*for service connection...*/ -#include - -class V4SceneManager; -class V4Service; - -class wxGPACPanel -{ - -public : - // Constructor / Desctructor - wxGPACPanel(V4SceneManager *parent, const char *path); - ~wxGPACPanel(); - - // Access to private members - GF_Terminal *GetMPEG4Terminal() { return m_term; } - GF_Compositor *GetSceneCompositor() { return m_term->compositor; } - V4SceneManager *GetV4SceneManager() { return parent; } - // - void Update(); - - // Variables used for drag, drop, move, ... picking ... - s32 m_iDragging; - u32 m_transformMode; // 0 Move, 1 Scale, 2 Rotate - GF_Node *picked; - u32 dragX, dragY; - -private: - void TranslateCoordinates(long x, long y, int &sceneX, int &sceneY); - - V4SceneManager *parent; - - GF_Terminal *m_term; - GF_User m_user; - - V4Service *m_pService; -}; - -#endif diff --git a/configure b/configure index feca36b..a117a4a 100755 --- a/configure +++ b/configure @@ -292,6 +292,8 @@ for opt do case "$opt" in --prefix=*) prefix=`echo $opt | cut -d '=' -f 2` ;; + --libdir=*) libdir=`echo $opt | cut -d '=' -f 2` + ;; --mandir=*) mandir=`echo $opt | cut -d '=' -f 2` ;; --source-path=*) source_path=`echo $opt | cut -d '=' -f 2` @@ -340,9 +342,6 @@ case "$cpu" in if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then if [ -z "`echo $CFLAGS | grep -- -m32`" ]; then cpu="x86_64" - if test "$linux" = "yes" ; then - libdir="lib64" - fi want_pic="yes" fi fi @@ -355,7 +354,6 @@ case "$cpu" in ;; ppc64) cpu="powerpc" - libdir="lib64" ;; "Power Macintosh"|ppc) cpu="powerpc"