Ejemplo n.º 1
0
void CMainFrame::OnViewFullscreen() 
{
	COsmo4 *app = GetApp();
	if (!app->m_open) return;
	u32 disp_w = app->m_screen_width;
	u32 disp_h = app->m_screen_height;
	
	Bool is_full_screen = !m_full_screen;

	/*prevent resize messages*/
	m_full_screen = 1;

	HWND hWnd = GetSafeHwnd();
	::SetForegroundWindow(hWnd);
	::CommandBar_Show(m_wndCommandBar.GetSafeHwnd(), is_full_screen ? FALSE : TRUE);
	SHFullScreen(hWnd, SHFS_HIDESTARTICON | SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON);

	if (is_full_screen) {
		m_dumbWnd.ShowWindow(SW_HIDE);

		::MoveWindow(m_hWnd, 0, 0, disp_w, disp_h, 0);
		m_wndView.GetWindowRect(&m_view_rc);
		m_wndView.SetWindowPos(this, 0, 0, disp_w, disp_h, SWP_NOZORDER);
		gf_term_set_option(app->m_term, GF_OPT_FULLSCREEN, is_full_screen);
		m_full_screen = 1;
	} else {
		gf_term_set_option(app->m_term, GF_OPT_FULLSCREEN, is_full_screen);
		m_full_screen = 0;
		OnSetSize(0,0);
		m_dumbWnd.ShowWindow(SW_SHOW);
		gf_term_set_option(app->m_term, GF_OPT_REFRESH, 0);
	}
}
Ejemplo n.º 2
0
STDMETHODIMP CGPAXPlugin::Pause()
{
    if(m_term) {
		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);
		} else {
	        gf_term_set_option(m_term, GF_OPT_PLAY_STATE, GF_STATE_PAUSED);
		}
	}
    return S_OK;
}
Ejemplo n.º 3
0
void set_full_screen()
{
	full_screen = !full_screen;
	if (full_screen) {
		show_status = 0;
		do_layout(0);
		gf_term_set_option(term, GF_OPT_FULLSCREEN, full_screen);
	} else {
		const char *str = gf_cfg_get_key(user.config, "General", "ShowStatusBar");
		show_status = (str && !strcmp(str, "yes")) ? 1 : 0;
		gf_term_set_option(term, GF_OPT_FULLSCREEN, full_screen);
		do_layout(1);
	}
}
Ejemplo n.º 4
0
void CMainFrame::OnFileStep()
{
	COsmo4 *app = GetApp();
	gf_term_set_option(app->m_term, GF_OPT_PLAY_STATE, GF_STATE_STEP_PAUSE);
	app->SetBacklightState(0);
	SetPauseButton(1);
}
Ejemplo n.º 5
0
int playpause(sPlayerInterface* player_interf)
{
	int  is_pause = gf_term_get_option( player_interf->m_term, GF_OPT_PLAY_STATE);
	fprintf(stdout, "[Status: %s]\n", is_pause ? "Playing" : "Paused");
	gf_term_set_option( player_interf->m_term, GF_OPT_PLAY_STATE, is_pause ? GF_STATE_PLAYING : GF_STATE_PAUSED);
	return 1;
}
Ejemplo n.º 6
0
static Bool play_pause_seek_gettime(GF_Terminal *term, const char *fn)
{
	u32 time;
	const u32 target_time_in_ms = 10000;

	//play
	connected = GF_FALSE;
	gf_term_connect_from_time(term, fn, 0, GF_FALSE);
	while (!connected) gf_sleep(1);

	//seek to target_time_in_ms
	gf_term_play_from_time(term, target_time_in_ms, GF_FALSE);
	gf_term_set_option(term, GF_OPT_PLAY_STATE, GF_STATE_STEP_PAUSE);
	time = gf_term_get_time_in_ms(term);
	assert(time == target_time_in_ms);
	
	//seek to 0
	connected = GF_FALSE;
	gf_term_play_from_time(term, 0, GF_FALSE);
	while (!connected) gf_sleep(1);
	time = gf_term_get_time_in_ms(term);
	assert(time == 0);

	return GF_TRUE;
}
Ejemplo n.º 7
0
//Create window message fuction. when the window is created, also initialize a instance of
//GPAC player instance.
LRESULT CGPAXPlugin::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    if (m_term) return 0;
    const char *str;

    if (m_hWnd==NULL) return 0;


	//Create a structure m_user for initialize the terminal. the parameters to set:
	//1)config file path
	//2)Modules file path
	//3)window handler
	//4)EventProc
    memset(&m_user, 0, sizeof(m_user));

    m_user.config = gf_cfg_init(NULL, NULL);
    if(!m_user.config) {
#ifdef _WIN32_WCE
		::MessageBox(NULL, _T("GPAC Configuration file not found"), _T("Fatal Error"), MB_OK);
#else
		::MessageBox(NULL, "GPAC Configuration file not found", "Fatal Error", MB_OK);
#endif
		goto err_exit;
	}

    str = gf_cfg_get_key(m_user.config, "General", "ModulesDirectory");
    m_user.modules = gf_modules_new(str, m_user.config);
    if(!gf_modules_get_count(m_user.modules)) goto err_exit;

    m_user.os_window_handler = m_hWnd;
    m_user.opaque = this;
    m_user.EventProc = GPAX_EventProc;

	//create a terminal
    m_term = gf_term_new(&m_user);

	if (!m_term) goto err_exit;
	
	gf_term_set_option(m_term, GF_OPT_AUDIO_VOLUME, 100);
    
	LoadDATAUrl();

	RECT rc;
    ::GetWindowRect(m_hWnd, &rc);
    m_width = rc.right-rc.left;
    m_height = rc.bottom-rc.top;
	if (m_bAutoStart && strlen(m_url)) Play();
    return 0;

	//Error Processing
err_exit:
    if(m_user.modules)
        gf_modules_del(m_user.modules);
    m_user.modules = NULL;
    if(m_user.config)
        gf_cfg_del(m_user.config);
    m_user.config = NULL;
	return 1;
}
Ejemplo n.º 8
0
void COsmo4AppView::ShowHide(Bool show)
{
#ifndef GPAC_GUI_ONLY
	if (show) {
		MakeVisible(ETrue);
		if (m_term) {
			gf_term_set_option(m_term, GF_OPT_VISIBLE, 1);
			DrawDeferred();
		}
	} else {
		MakeVisible(EFalse);
		if (m_term) gf_term_set_option(m_term, GF_OPT_VISIBLE, 0);
	}
#else
	MakeVisible(ETrue);
#endif
}
Ejemplo n.º 9
0
STDMETHODIMP CGPAXPlugin::Play()
{
	if (m_term) {
		if (!m_bIsConnected) {
			if (strlen(m_url)) {
				/*connect from 0 and pause if not autoplay*/
				const char *gui = gf_cfg_get_key(m_user.config, "General", "StartupFile");
				if (gui && m_bUseGUI) {
					gf_cfg_set_key(m_user.config, "Temp", "BrowserMode", "yes");
					gf_cfg_set_key(m_user.config, "Temp", "GUIStartupFile", m_url);
					gf_term_connect(m_term, gui);
				} else {
					gf_term_connect(m_term, m_url);
				}
				gf_term_set_option(m_term, GF_OPT_ASPECT_RATIO, m_AR);
			}
		} else
			gf_term_set_option(m_term, GF_OPT_PLAY_STATE, GF_STATE_PLAYING);   //if target is connected, set it playing
	}
    return S_OK;
}
Ejemplo n.º 10
0
void COptions::OnSaveopt()
{
	m_general.SaveOptions();
	m_systems.SaveOptions();
	m_render.SaveOptions();
	m_render3D.SaveOptions();
	m_audio.SaveOptions();
	m_http.SaveOptions();
	m_font.SaveOptions();
	m_stream.SaveOptions();
	m_decoder.SaveOptions();

	COsmo4 *gpac = GetApp();
	gf_term_set_option(gpac->m_term, GF_OPT_RELOAD_CONFIG, 1);
}
Ejemplo n.º 11
0
void gf_freeze_display(Bool do_gf_freeze)
{
	if (do_gf_freeze) {
		prev_backlight_state = backlight_off;
		do_resume = 0;
		if (0 && is_connected && gf_term_get_option(term, GF_OPT_PLAY_STATE)==GF_STATE_PLAYING) {
			do_resume= 1;
			gf_term_set_option(term, GF_OPT_PLAY_STATE, GF_STATE_PAUSED);
		}
		/*gf_freeze display*/
		gf_term_set_option(term, GF_OPT_FREEZE_DISPLAY, 1);

		set_backlight_state(0);
		gf_sleep(100);
	} else {
		if (prev_backlight_state) set_backlight_state(1);
		gf_term_set_option(term, GF_OPT_FREEZE_DISPLAY, 0);

		if (do_resume) {
			gf_term_set_option(term, GF_OPT_PLAY_STATE, GF_STATE_PLAYING);
			set_backlight_state(1);
		}
	}
}
Ejemplo n.º 12
0
void pause_file()
{
	if (!is_connected) return;
#ifdef _WIN32_WCE
	TBBUTTONINFO tbbi;
	tbbi.cbSize = sizeof(tbbi);
	tbbi.dwMask = TBIF_TEXT;
#endif

	if (gf_term_get_option(term, GF_OPT_PLAY_STATE)==GF_STATE_PLAYING) {
		gf_term_set_option(term, GF_OPT_PLAY_STATE, GF_STATE_PAUSED);
#ifdef _WIN32_WCE
		tbbi.pszText = _T("Resume");
#endif
	} else {
		gf_term_set_option(term, GF_OPT_PLAY_STATE, GF_STATE_PLAYING);
#ifdef _WIN32_WCE
		tbbi.pszText = _T("Pause");
#endif
	}
#ifdef _WIN32_WCE
	SendMessage(g_hwnd_menu, TB_SETBUTTONINFO, IDM_FILE_PAUSE, (LPARAM)&tbbi);
#endif
}
Ejemplo n.º 13
0
static void gf_sr_pause(GF_Renderer *sr, u32 PlayState)
{
	if (!sr || !sr->audio_renderer) return;
	if (!sr->paused && !PlayState) return;
	if (sr->paused && (PlayState==GF_STATE_PAUSED)) return;

	/*step mode*/
	if (PlayState==GF_STATE_STEP_PAUSE) {
		sr->step_mode = 1;
		/*resume for next step*/
		if (sr->paused && sr->term) gf_term_set_option(sr->term, GF_OPT_PLAY_STATE, GF_STATE_PLAYING);
	} else {
		if (sr->audio_renderer) gf_sr_ar_control(sr->audio_renderer, (sr->paused && (PlayState==0xFF)) ? 2 : sr->paused);
		sr->paused = (PlayState==GF_STATE_PAUSED) ? 1 : 0;
	}
}
Ejemplo n.º 14
0
// -----------------------------------------------------------------------------
// COsmo4AppView::Draw()
// Draws the display.
// -----------------------------------------------------------------------------
//
void COsmo4AppView::Draw( const TRect& /*aRect*/ ) const
{
#ifndef GPAC_GUI_ONLY
	if (!m_term) {
		CWindowGc& gc = SystemGc();
		TRgb black(0,0,0);
		gc.SetBrushColor(black);
		gc.Clear();
	} else {
		/*FIXME - this is just to force a screen flush, needs rework*/
		gf_term_set_option(m_term, GF_OPT_FREEZE_DISPLAY, 0);
	}
#else
		CWindowGc& gc = SystemGc();
		TRgb black(0,0,0);
	    TRect rect = Rect();
		gc.SetBrushColor(black);
		gc.Clear(rect);
#endif
}
Ejemplo n.º 15
0
static Bool validator_process(GF_TermExt *termext, u32 action, void *param)
{
	const char *opt;
	GF_Validator *validator = termext->udta;

	switch (action) {

    /* Upon starting of the terminal, we parse (possibly an XVL file), an XVS file, and start the first test sequence */
    case GF_TERM_EXT_START:
		validator->term = (GF_Terminal *) param;

		/* if the validator is loaded, we switch off anti-aliasing for image comparison and we put a low framerate,
		but we store the previous value to restore it upon termination of the validator */
        opt = (char *)gf_modules_get_option((GF_BaseInterface*)termext, "Compositor", "FrameRate");
        if (opt) validator->prev_fps = gf_strdup(opt);
        opt = (char *)gf_modules_get_option((GF_BaseInterface*)termext, "Compositor", "AntiAlias");
        if (opt) validator->prev_alias = gf_strdup(opt);

		/* Check if the validator should be loaded and in which mode */
        opt = gf_modules_get_option((GF_BaseInterface*)termext, "Validator", "Mode");
		if (!opt) {
			GF_LOG(GF_LOG_DEBUG, GF_LOG_MODULE, ("Validator missing configuration, stopping.\n"));
			return 0;
		} else if (!strcmp(opt, "Play")) {
			GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("Validator starting in playback mode.\n"));
            validator->is_recording = 0;
        } else if (!strcmp(opt, "Record")) {
			GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("Validator starting in recording mode.\n"));
            validator->is_recording = 1;
        } else if (!strcmp(opt, "Disable")) {
			GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("Validator is disabled.\n"));
            return 0;
        } else {
			GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("Validator configuration using wrong mode, stopping.\n"));
            return 0;
        }

		/* initializes the validator and starts */
        validator->xvs_filename = NULL;
        validator->xvl_filename = (char *)gf_modules_get_option((GF_BaseInterface*)termext, "Validator", "XVL");
        if (!validator->xvl_filename) {
            validator->xvs_filename = (char *)gf_modules_get_option((GF_BaseInterface*)termext, "Validator", "XVS");
			if (!validator->xvs_filename) {
				GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("Validator configuration without input, stopping.\n"));
				return 0;
			} else {
				GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("Validator using scenario file: %s\n", validator->xvs_filename));
			}
		} else {
			GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("Validator using scenario playlist: %s\n", validator->xvl_filename));
		}

		/* since we changed parameters of the compositor, we need to trigger a reconfiguration */
        	gf_modules_set_option((GF_BaseInterface*)termext, "Compositor", "FrameRate", "5.0");
        	gf_modules_set_option((GF_BaseInterface*)termext, "Compositor", "AntiAlias", "None");
        	gf_term_set_option(validator->term, GF_OPT_RELOAD_CONFIG, 1);

		validator->evt_filter.udta = validator;
		if (!validator->is_recording) {
			validator->evt_filter.on_event = validator_on_event_play;
        	termext->caps |= GF_TERM_EXTENSION_NOT_THREADED;
        } else {
		validator->evt_filter.on_event = validator_on_event_record;
        }
	gf_term_add_event_filter(validator->term, &validator->evt_filter);
	validator->video_listener.udta = validator;
	validator->video_listener.on_video_frame = validator_on_video_frame;
	validator->video_listener.on_video_reconfig = validator_on_video_reconfig;

		/* TODO: if start returns 0, the module is not loaded, so the above init (filter registration) is not removed,
		   should probably return 1 all the time, to make sure stop is called */
        if (validator->xvl_filename) {
            validator_xvl_open(validator);
            if (!validator->xvl_node) {
                return 0;
            }
            validator_xvs_next(validator, 0);
            if (!validator->xvs_node) {
                return 0;
            }
        } else if (validator->xvs_filename) {
            validator_xvs_open(validator);
            if (!validator->xvs_node) {
                return 0;
            }
            if (validator->test_filename) {
                validator_test_open(validator);
            } else {
                validator_xvs_close(validator);
                return 0;
            }
        } else {
            return 0;
        }
        if (!validator->is_recording) {
            validator_load_event(validator);
        }
		return 1;

    /* when the terminal stops, we close the XVS parser and XVL parser if any, restore the config,
    and free all validator data (the validator will be destroyed when the module is unloaded)
    Note: we don't need to disconnect the terminal since it's already stopping */
	case GF_TERM_EXT_STOP:
        gf_term_remove_event_filter(validator->term, &validator->evt_filter);
		validator_xvs_close(validator);
        validator_xvl_close(validator);
		validator->term = NULL;
        if (validator->test_base) {
            gf_free(validator->test_base);
            validator->test_base = NULL;
        }
		/*auto-disable the recording by default*/
		if (validator->is_recording) {
			gf_modules_set_option((GF_BaseInterface*)termext, "Validator", "Mode", "Play");
		} else {
			gf_modules_set_option((GF_BaseInterface*)termext, "Validator", "Mode", "Disable");
		}
		GF_LOG(GF_LOG_INFO, GF_LOG_MODULE, ("Stopping validator\n"));
		if (validator->prev_fps) {
			gf_modules_set_option((GF_BaseInterface*)termext, "Compositor", "FrameRate", validator->prev_fps);
            gf_free(validator->prev_fps);
            validator->prev_fps = NULL;
		}
        if (validator->prev_alias) {
	        gf_modules_set_option((GF_BaseInterface*)termext, "Compositor", "AntiAlias", validator->prev_alias);
            gf_free(validator->prev_alias);
            validator->prev_alias = NULL;
        }
		break;

    /* When called in the main loop of the terminal, we don't do anything in the recording mode.
       In the playing/validating mode, we need to check if an event needs to be dispatched or if snapshots need to be made,
       until there is no more event, in which case we trigger either the load of the next XVS or the quit */
	case GF_TERM_EXT_PROCESS:
        /* if the time is right, dispatch the event and load the next one */
		while (!validator->is_recording && validator->evt_loaded && validator->ck && (validator->next_time <= gf_clock_time(validator->ck) )) {
            Bool has_more_events;
            //u32 diff = gf_clock_time(validator->ck) - validator->next_time;
            //GF_LOG(GF_LOG_ERROR, GF_LOG_MODULE, ("[Validator] Time diff: evt_time=%d  clock_time = %d, diff=%d\n", validator->next_time, gf_clock_time(validator->ck), diff));
            if (validator->next_event_snapshot) {
                Bool res;
                char *snap_name = validator_create_snapshot(validator);
                gf_free(snap_name);
                res = validator_compare_snapshots(validator);
                validator->xvs_result &= res;
                validator->next_event_snapshot = 0;
            } else {
                validator->term->compositor->video_out->on_event(validator->term->compositor->video_out->evt_cbk_hdl, &validator->next_event);
            }
		    has_more_events = validator_load_event(validator);
            if (!has_more_events) {
                validator_xvs_close(validator);
                gf_term_disconnect(validator->term);
                gf_sc_remove_video_listener(validator->term->compositor, &validator->video_listener);
                validator_xvs_next(validator, 0);
                if (!validator->xvs_node) {
                    GF_Event evt;
                    evt.type = GF_EVENT_QUIT;
                    validator->term->compositor->video_out->on_event(validator->term->compositor->video_out->evt_cbk_hdl, &evt);
                } else {
                    if (!validator->is_recording) {
                        validator_load_event(validator);
                    }
                }
            }
		}
		break;
	}
	return 0;
}
Ejemplo n.º 16
0
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);
}
Ejemplo n.º 17
0
Bool Osmo4CE_EventProc(void *priv, GF_Event *event)
{
	u32 dur;
	COsmo4 *app = (COsmo4 *) priv;
	CMainFrame *pFrame = (CMainFrame *) app->m_pMainWnd;
	/*shutdown*/
	if (!pFrame) return 0;

	switch (event->type) {
	case GF_EVENT_MESSAGE:
		if (event->message.error!=GF_OK) {
			if (event->message.error<GF_OK) {
				pFrame->console_err = event->message.error;
				pFrame->console_message = event->message.message;
				pFrame->PostMessage(WM_CONSOLEMSG, 0, 0);
			}
			return 0;
		}
		if (1) return 0;
		/*process user message*/
		pFrame->console_err = GF_OK;
		pFrame->console_message = event->message.message;
		pFrame->PostMessage(WM_CONSOLEMSG, 0, 0);
		break;
	case GF_EVENT_SIZE:
		break;
	case GF_EVENT_SCENE_SIZE:
		app->m_scene_width = event->size.width;
		app->m_scene_height = event->size.height;
		if (!pFrame->m_full_screen) 
			pFrame->PostMessage(WM_SETSIZE, event->size.width, event->size.height);
		break;
	case GF_EVENT_CONNECT:
		app->m_open = event->connect.is_connected;
		break;
	case GF_EVENT_DURATION:
		dur = (u32) (1000 * event->duration.duration);
		if (dur<2000) dur = 0;
		app->m_duration = dur;
		app->m_can_seek = event->duration.can_seek && dur;
		pFrame->m_progBar.m_range_invalidated = 1;
		/*by default, don't display timing if not seekable and vice-versa*/
		if (app->m_can_seek != pFrame->m_view_timing) {
			pFrame->m_view_timing = app->m_can_seek;
			if (!pFrame->m_full_screen) 
				pFrame->PostMessage(WM_SETSIZE, 0, 0);
		}
		break;
	case GF_EVENT_NAVIGATE:
		/*store URL since it may be destroyed, and post message*/
		app->m_navigate_url = event->navigate.to_url;
		pFrame->PostMessage(WM_NAVIGATE, NULL, NULL);
		return 1;
	case GF_EVENT_QUIT:
		pFrame->PostMessage(WM_CLOSE, 0L, 0L);
		break;
	/*ipaq keys*/
	case GF_EVENT_KEYDOWN:
		switch (event->key.key_code) {
		case GF_KEY_F1: 
			pFrame->PostMessage(WM_COMMAND, ID_FILE_OPEN); 
			break;
		case GF_KEY_F2:
			pFrame->PostMessage(WM_QUIT); 
			break;
		case GF_KEY_F3:
			pFrame->PostMessage(WM_COMMAND, ID_FILE_RESTART);
			break;
		case GF_KEY_F5:
			pFrame->PostMessage(WM_COMMAND, ID_VIEW_FULLSCREEN);
			break;
		case GF_KEY_ENTER:
			pFrame->PostMessage(WM_COMMAND, ID_FILE_PAUSE);
			break;
		case GF_KEY_LEFT:
			if (app->m_duration>=2000) {
				s32 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:
			if (app->m_duration>=2000) {
				u32 res = gf_term_get_time_in_ms(app->m_term) + 5*app->m_duration/100;
				if (res>=app->m_duration) res = 0;
				gf_term_play_from_time(app->m_term, res, 0);
			}
			break;
		case GF_KEY_UP:
			if (app->m_duration>=2000) pFrame->PostMessage(WM_COMMAND, ID_FILE_STEP);	
			break;
		case GF_KEY_DOWN:
			gf_term_set_option(app->m_term, GF_OPT_REFRESH, 0);
			break;
		}
		break;
	case GF_EVENT_MOUSEDOUBLECLICK:
		pFrame->PostMessage(WM_COMMAND, ID_VIEW_FULLSCREEN);
		return 0;
	}
	
	return 0;
}
Ejemplo n.º 18
0
// -----------------------------------------------------------------------------
// COsmo4AppUi::HandleCommandL()
// Takes care of command handling.
// -----------------------------------------------------------------------------
//
void COsmo4AppUi::HandleCommandL( TInt aCommand )
{
	GF_Err e;
#ifndef GPAC_GUI_ONLY
	switch( aCommand ) {
	case EAknSoftkeyBack:
		if (view_mode==1) TogglePlaylist();
		break;
    case EEikCmdExit:
    case EAknSoftkeyExit:
        iAppView->Shutdown();
		Exit();
        break;
	/*PLAYLIST commands*/
	case EOsmo4PlayListAdd:
		iPlaylist->PlaylistAct(Osmo4PLAdd);
		break;
	case EOsmo4PlayListRem:
		iPlaylist->PlaylistAct(Osmo4PLRem);
		break;
	case EOsmo4PlayListMoveUp:
		iPlaylist->PlaylistAct(Osmo4PLMoveUp);
		break;
	case EOsmo4PlayListMoveDown:
		iPlaylist->PlaylistAct(Osmo4PLMoveDown);
		break;
	case EOsmo4PlayListClear:
		iPlaylist->PlaylistAct(Osmo4PLClear);
		break;
	case EOsmo4PlayListMode:
		iPlaylist->PlaylistAct(Osmo4PLToggleMode);
		break;
	case EOsmo4PlayListAllFiles:
		iPlaylist->PlaylistAct(Osmo4PLToggleAllFiles);
		break;

	/*FILE menu command*/
	case EOsmo4PlayListView:
		TogglePlaylist();
		break;
	case EOsmo4OpenURL:
		break;
	case EOsmo4Fullscreen:
		break;
	case EOsmo4ViewMaxSize:
	{
		CEikStatusPane* statusPane = StatusPane();
		if (statusPane->IsVisible()) statusPane->MakeVisible(EFalse);
		else statusPane->MakeVisible(ETrue);
	}
		break;
	case EOsmo4AROriginal:
		gf_term_set_option(iAppView->m_term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_KEEP);
		break;
	case EOsmo4ARFillScreen:
		gf_term_set_option(iAppView->m_term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_FILL_SCREEN);
		break;
	case EOsmo4AR4_3:
		gf_term_set_option(iAppView->m_term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_4_3);
		break;
	case EOsmo4AR16_9:
		gf_term_set_option(iAppView->m_term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_16_9);
		break;

	case EOsmo4NavReset:
		gf_term_set_option(iAppView->m_term, GF_OPT_NAVIGATION_TYPE, 0);
		break;
	case EOsmo4NavNone:
		gf_term_set_option(iAppView->m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_NONE);
		break;
	case EOsmo4NavSlide:
		e = gf_term_set_option(iAppView->m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_SLIDE);
		if (e) {
			GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("Cannot set navigation: %s", gf_error_to_string(e) ));
		}
		break;
	case EOsmo4NavWalk:
		gf_term_set_option(iAppView->m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_WALK);
		break;
	case EOsmo4NavFly:
		gf_term_set_option(iAppView->m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_FLY);
		break;
	case EOsmo4NavExamine:
		gf_term_set_option(iAppView->m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_EXAMINE);
		break;
	case EOsmo4NavHeadlight:
		gf_term_set_option(iAppView->m_term, GF_OPT_HEADLIGHT, !gf_term_get_option(iAppView->m_term, GF_OPT_HEADLIGHT) );
		break;
	case EOsmo4CollideNone:
		gf_term_set_option(iAppView->m_term, GF_OPT_COLLISION, GF_COLLISION_NONE);
		break;
	case EOsmo4CollideSimple:
		gf_term_set_option(iAppView->m_term, GF_OPT_COLLISION, GF_COLLISION_NORMAL);
		break;
	case EOsmo4CollideDisp:
		gf_term_set_option(iAppView->m_term, GF_OPT_COLLISION, GF_COLLISION_DISPLACEMENT);
		break;
	case EOsmo4NavGravity:
		gf_term_set_option(iAppView->m_term, GF_OPT_GRAVITY, !gf_term_get_option(iAppView->m_term, GF_OPT_GRAVITY));
		break;
	case EOsmo4ViewRTI:
		iAppView->show_rti = !iAppView->show_rti;
		break;

    case EOsmo4OptEnableLogs:
    {
		const char *opt = gf_cfg_get_key(iAppView->m_user.config, "General", "Logs");
		if (opt && !stricmp(opt, "@debug")) {
			gf_cfg_set_key(iAppView->m_user.config, "General", "Logs", "all@error");
		} else {
			gf_cfg_set_key(iAppView->m_user.config, "General", "Logs", "all@debug");
		}
		iAppView->SetupLogs();
    }
        break;
	case EOsmo4OptOpenGL:
	{
		const char *opt = gf_cfg_get_key(iAppView->m_user.config, "Compositor", "ForceOpenGL");
		Bool use_gl = (opt && !strcmp(opt, "yes")) ? 1 : 0;
		gf_cfg_set_key(iAppView->m_user.config, "Compositor", "ForceOpenGL", use_gl ? "no" : "yes");
		gf_term_set_option(iAppView->m_term, GF_OPT_USE_OPENGL, !use_gl);
	}
		break;
	case EOsmo4OptDirectDraw:
	{
		const char *opt = gf_cfg_get_key(iAppView->m_user.config, "Compositor", "DirectDraw");
		Bool use_dd = (opt && !strcmp(opt, "yes")) ? 1 : 0;
		gf_cfg_set_key(iAppView->m_user.config, "Compositor", "DirectDraw", use_dd ? "no" : "yes");
		gf_term_set_option(iAppView->m_term, GF_OPT_DIRECT_DRAW, !use_dd);
	}
		break;
	case EOsmo4OptXMLProgressive:
	{
		const char *opt = gf_cfg_get_key(iAppView->m_user.config, "SAXLoader", "Progressive");
		Bool use_prog = (opt && !strcmp(opt, "yes")) ? 1 : 0;
		gf_cfg_set_key(iAppView->m_user.config, "SAXLoader", "Progressive", use_prog ? "no" : "yes");
		gf_cfg_set_key(iAppView->m_user.config, "SAXLoader", "MaxDuration", "100");
	}
		break;

    default:
		if ((aCommand>=EOsmo4OpenRecentFirst) && (aCommand<=EOsmo4OpenRecentLast)) {
			const char *sOpt = gf_cfg_get_key_name(iAppView->m_user.config, "RecentFiles", aCommand - EOsmo4OpenRecentFirst);
			if (sOpt) iAppView->Connect(sOpt);
		} else {
			iAppView->MessageBox("Unandled command - panic", "Osmo4");
			Panic( EOsmo4Ui );
		}
        break;
    }
#endif
}
Ejemplo n.º 19
0
//GPAC player Event Handler. not yet implemented, just dummies here
Bool CGPAXPlugin::EventProc(GF_Event *evt)
{
	char msg[1024];
	if (!m_term) return 0;

    switch (evt->type) {
	case GF_EVENT_MESSAGE:
		if (evt->message.error) {
			sprintf(msg, "(GPAC) %s (%s)", evt->message.message, gf_error_to_string(evt->message.error));
		} else {
			sprintf(msg, "(GPAC) %s", evt->message.message);
		}
		SetStatusText(msg);
        break;
	case GF_EVENT_PROGRESS:
		if (evt->progress.done == evt->progress.total) {
			SetStatusText(NULL);
			m_iDownload_progress = 100;
		} else {
			char *szTitle = "";
			if (evt->progress.progress_type==0) szTitle = "Buffer ";
			else 
			if (evt->progress.progress_type==1) 
			{
				szTitle = "Download ";
				m_iDownload_progress = (int)floor((100.0*evt->progress.done) / evt->progress.total);
			}
			else if (evt->progress.progress_type==2) szTitle = "Import ";
			sprintf(msg, "(GPAC) %s: %02.2f", szTitle, (100.0*evt->progress.done) / evt->progress.total);
			SetStatusText(msg);
		}
		break;
    case GF_EVENT_CONNECT:
        m_bIsConnected = evt->connect.is_connected;
        break;
	/*IGNORE any scene size, just work with the size allocated in the parent doc*/
	case GF_EVENT_SCENE_SIZE:
        gf_term_set_size(m_term, m_width, m_height);
        break;
	/*window has been resized (full-screen plugin), resize*/
	case GF_EVENT_SIZE:
		m_width = evt->size.width;
		m_height = evt->size.height;
        gf_term_set_size(m_term, m_width, m_height);
        break;
	case GF_EVENT_DBLCLICK:
		gf_term_set_option(m_term, GF_OPT_FULLSCREEN, !gf_term_get_option(m_term, GF_OPT_FULLSCREEN));
		break;
	case GF_EVENT_KEYDOWN:
		if ((evt->key.flags  & GF_KEY_MOD_ALT)) {
	    } else {
			switch (evt->key.key_code) {
			case GF_KEY_HOME:
				gf_term_set_option(m_term, GF_OPT_NAVIGATION_TYPE, 1);
				break;
			case GF_KEY_ESCAPE:
				gf_term_set_option(m_term, GF_OPT_FULLSCREEN, !gf_term_get_option(m_term, GF_OPT_FULLSCREEN));
				break;
			}
		}
	    break;
	case GF_EVENT_NAVIGATE_INFO:
		strcpy(msg, evt->navigate.to_url);
		SetStatusText(msg);
		break;
	case GF_EVENT_NAVIGATE:
		if (gf_term_is_supported_url(m_term, evt->navigate.to_url, 1, 1)) {
			gf_term_navigate_to(m_term, evt->navigate.to_url);
			return 1;
		} 
#ifndef _WIN32_WCE
		else if (m_pBrowser) {
			u32 i;
			const char **sz_ptr;
			u16 w_szTar[1024], w_szURL[1024];
			VARIANT target, flags;
			flags.intVal = 0;
			target.bstrVal = L"_SELF";

			for (i=0; i<evt->navigate.param_count; i++) {
				if (!strcmp(evt->navigate.parameters[i], "_parent")) target.bstrVal = L"_PARENT";
				else if (!strcmp(evt->navigate.parameters[i], "_blank")) target.bstrVal = L"_BLANK";
				else if (!strcmp(evt->navigate.parameters[i], "_top")) target.bstrVal = L"_TOP";
				else if (!strcmp(evt->navigate.parameters[i], "_new")) flags.intVal |= navOpenInNewWindow;
				else if (!strnicmp(evt->navigate.parameters[i], "_target=", 8)) {
					sz_ptr = & evt->navigate.parameters[i]+8;
					gf_utf8_mbstowcs(w_szTar, 1024, (const char **)sz_ptr);
					target.bstrVal = (BSTR) w_szTar;
				}
			}
			sz_ptr = & evt->navigate.to_url;
			gf_utf8_mbstowcs(w_szURL, 1024, (const char **)sz_ptr);
			m_pBrowser->Navigate((BSTR) w_szURL, &flags, &target, NULL, NULL);;
			return 1;
		}
#endif
		break;
    }
    return 0;
}
Ejemplo n.º 20
0
void CMainFrame::OnViewArOrig() 
{
	gf_term_set_option(GetApp()->m_term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_KEEP);	
}
Ejemplo n.º 21
0
void CMainFrame::OnSetNavigation(UINT nID) 
{
	gf_term_set_option(GetApp()->m_term, GF_OPT_NAVIGATION, nID - ID_NAV_NONE);
}
Ejemplo n.º 22
0
void CMainFrame::OnNaveReset() 
{
	gf_term_set_option(GetApp()->m_term, GF_OPT_NAVIGATION_TYPE, 0);
}
Ejemplo n.º 23
0
void CMainFrame::OnNavSlide() 
{
	gf_term_set_option(GetApp()->m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_SLIDE);
}
Ejemplo n.º 24
0
void CMainFrame::OnViewArFill() 
{
	gf_term_set_option(GetApp()->m_term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_FILL_SCREEN);	
}
Ejemplo n.º 25
0
Bool Osmo4_EventProc(void *priv, GF_Event *evt)
{
	u32 dur;
	Osmo4 *gpac = (Osmo4 *) priv;
	CMainFrame *pFrame = (CMainFrame *) gpac->m_pMainWnd;
	/*shutdown*/
	if (!pFrame) return 0;

	switch (evt->type) {
	case GF_EVENT_DURATION:
		dur = (u32) (1000 * evt->duration.duration);
		//if (dur<1100) dur = 0;
		pFrame->m_pPlayList->SetDuration((u32) evt->duration.duration );
		gpac->max_duration = dur;
		gpac->can_seek = evt->duration.can_seek;
		if (!gpac->can_seek) {
			pFrame->m_Sliders.m_PosSlider.EnableWindow(FALSE);
		} else {
			pFrame->m_Sliders.m_PosSlider.EnableWindow(TRUE);
			pFrame->m_Sliders.m_PosSlider.SetRangeMin(0);
			pFrame->m_Sliders.m_PosSlider.SetRangeMax(dur);
		}
		break;

	case GF_EVENT_MESSAGE:
		if (!evt->message.service || !strcmp(evt->message.service, (LPCSTR) pFrame->m_pPlayList->GetURL() )) {
			pFrame->console_service = "main service";
		} else {
			pFrame->console_service = evt->message.service;
		}
		if (evt->message.error!=GF_OK) {
			if (evt->message.error<GF_OK || !gpac->m_NoConsole) {
				pFrame->console_err = evt->message.error;
				pFrame->console_message = evt->message.message;
				gpac->m_pMainWnd->PostMessage(WM_CONSOLEMSG, 0, 0);

				/*any error before connection confirm is a service connection error*/
				if (!gpac->m_isopen) pFrame->m_pPlayList->SetDead();
			}
			return 0;
		}
		if (gpac->m_NoConsole) return 0;

		/*process user message*/
		pFrame->console_err = GF_OK;
		pFrame->console_message = evt->message.message;
		gpac->m_pMainWnd->PostMessage(WM_CONSOLEMSG, 0, 0);
		break;
	case GF_EVENT_PROGRESS:
		char *szType;
		if (evt->progress.progress_type==0) szType = "Buffer ";
		else if (evt->progress.progress_type==1) szType = "Download ";
		else if (evt->progress.progress_type==2) szType = "Import ";
		gf_set_progress(szType, evt->progress.done, evt->progress.total);
		break;
	case GF_EVENT_NAVIGATE_INFO:
		pFrame->console_message = evt->navigate.to_url;
		gpac->m_pMainWnd->PostMessage(WM_CONSOLEMSG, 1000, 0);
		break;

	case GF_EVENT_SCENE_SIZE:
		if (evt->size.width && evt->size.height) {
			gpac->orig_width = evt->size.width;
			gpac->orig_height = evt->size.height;
			if (gpac->m_term && !pFrame->m_bFullScreen) 
				pFrame->PostMessage(WM_SETSIZE, evt->size.width, evt->size.height);
		}
		break;
	/*don't resize on win32 msg notif*/
#if 0
	case GF_EVENT_SIZE:
		if (/*gpac->m_term && !pFrame->m_bFullScreen && */gpac->orig_width && (evt->size.width < W32_MIN_WIDTH) ) 
			pFrame->PostMessage(WM_SETSIZE, W32_MIN_WIDTH, (W32_MIN_WIDTH*gpac->orig_height) / gpac->orig_width);
		else
			pFrame->PostMessage(WM_SETSIZE, evt->size.width, evt->size.height);
		break;
#endif

	case GF_EVENT_CONNECT:
//		if (pFrame->m_bStartupFile) return 0;

		pFrame->BuildStreamList(1);
		if (evt->connect.is_connected) {
			pFrame->BuildChapterList(0);
			gpac->m_isopen = 1;
			//resetting sliders when opening a new file creates a deadlock on the window thread which is disconnecting
			pFrame->m_wndToolBar.SetButtonInfo(5, ID_FILE_PLAY, TBBS_BUTTON, gpac->m_isopen ? 4 : 3);
			pFrame->m_Sliders.m_PosSlider.SetPos(0);
			pFrame->SetProgTimer(1);
		} else {
			gpac->max_duration = 0;
			gpac->m_isopen = 0;
			pFrame->BuildChapterList(1);
		}
		if (!pFrame->m_bFullScreen) {
			pFrame->SetFocus();
			pFrame->SetForegroundWindow();
		}
		break;

	case GF_EVENT_QUIT:
		pFrame->PostMessage(WM_CLOSE, 0L, 0L);
		break;
	case GF_EVENT_MIGRATE:
	{
	}
		break;
	case GF_EVENT_KEYDOWN:
		gf_term_process_shortcut(gpac->m_term, evt);
		/*update volume control*/
		pFrame->m_Sliders.SetVolume();

		switch (evt->key.key_code) {
		case GF_KEY_HOME:
			gf_term_set_option(gpac->m_term, GF_OPT_NAVIGATION_TYPE, 1);
			break;
		case GF_KEY_ESCAPE:
			pFrame->PostMessage(WM_COMMAND, ID_VIEW_FULLSCREEN);
			break;
		case GF_KEY_MEDIANEXTTRACK:
			pFrame->m_pPlayList->PlayNext();
			break;
		case GF_KEY_MEDIAPREVIOUSTRACK:
			pFrame->m_pPlayList->PlayPrev();
			break;
		case GF_KEY_H:
			if ((evt->key.flags & GF_KEY_MOD_CTRL) && gpac->m_isopen)
				gf_term_switch_quality(gpac->m_term, 1);
			break;
		case GF_KEY_L:
			if ((evt->key.flags & GF_KEY_MOD_CTRL) && gpac->m_isopen)
				gf_term_switch_quality(gpac->m_term, 0);
			break;
		}
		break;
	case GF_EVENT_NAVIGATE:
		/*fixme - a proper browser would require checking mime type & co*/
		/*store URL since it may be destroyed, and post message*/
		gpac->m_navigate_url = evt->navigate.to_url;
		pFrame->PostMessage(WM_NAVIGATE, NULL, NULL);
		return 1;
	case GF_EVENT_VIEWPOINTS:
		pFrame->BuildViewList();
		return 0;
	case GF_EVENT_STREAMLIST:
		pFrame->BuildStreamList(0);
		return 0;
	case GF_EVENT_SET_CAPTION:
		pFrame->SetWindowText(evt->caption.caption);
		break;
	case GF_EVENT_DBLCLICK:
		pFrame->PostMessage(WM_COMMAND, ID_VIEW_FULLSCREEN);
		return 0;
	case GF_EVENT_AUTHORIZATION:
	{
		UserPassDialog passdlg;
		return passdlg.GetPassword(evt->auth.site_url, evt->auth.user, evt->auth.password);
	}
	}
	return 0;
}
Ejemplo n.º 26
0
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;
}
Ejemplo n.º 27
0
void CMainFrame::OnViewAr169() 
{
	gf_term_set_option(GetApp()->m_term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_16_9);	
}
Ejemplo n.º 28
0
//-------------------------------
// dir should end with /
int CNativeWrapper::init(JNIEnv * env, void * bitmap, jobject * callback, int width, int height, const char * cfg_dir, const char * modules_dir, const char * cache_dir, const char * font_dir, const char * gui_dir, const char * urlToLoad) {
	LOGI("Initializing GPAC with URL=%s...", urlToLoad);
	strcpy(m_modules_dir, modules_dir);
	strcpy(m_cache_dir, cache_dir);
	strcpy(m_font_dir, font_dir);
	if (cfg_dir)
		strcpy(m_cfg_dir, cfg_dir);

	char m_cfg_filename[GF_MAX_PATH];
	if (m_cfg_dir) {
		LOGI("GPAC.cfg found in %s, force using it.\n", m_cfg_dir);
		strcpy(m_cfg_filename, m_cfg_dir);
		strcat(m_cfg_filename, "GPAC.cfg");
	}

	int m_Width = width;
	int m_Height = height;

	int first_launch = 0;
	const char *opt;

	m_window = env;
	m_session = bitmap;
	if (!mainJavaEnv)
		mainJavaEnv = (JavaEnvTh *) gf_malloc(sizeof(JavaEnvTh));
	memset(mainJavaEnv, 0, sizeof(JavaEnvTh));
	setJavaEnv(mainJavaEnv, env, env->NewGlobalRef(*callback));
	if (pthread_setspecific( jni_thread_env_key, mainJavaEnv)) {
		LOGE("Failed to set specific thread data to jni_thread_env_key=%d for main thread !", jni_thread_env_key);
	}

	m_mx = gf_mx_new("Osmo4");

	//load config file
	LOGI("Loading User Config %s...", "GPAC.cfg");
	m_user.config = gf_cfg_init(m_cfg_dir ? m_cfg_filename : NULL, NULL);
	gf_set_progress_callback(this, Osmo4_progress_cbk);

	opt = gf_cfg_get_key(m_user.config, "General", "ModulesDirectory");
	LOGI("loading modules in directory %s...", opt);
	m_user.modules = gf_modules_new(opt, m_user.config);
	if (!m_user.modules || !gf_modules_get_count(m_user.modules)) {
		LOGE("No modules found in directory %s !", opt);
		if (m_user.modules)
			gf_modules_del(m_user.modules);
		gf_cfg_del(m_user.config);
		m_user.config = NULL;
		return Quit(KErrGeneral);
	}

	/*we don't thread the visual compositor to be able to minimize the app and still have audio running*/
	m_user.init_flags = GF_TERM_NO_COMPOSITOR_THREAD;
	m_user.opaque = this;

	m_user.os_window_handler = m_window;
	m_user.os_display = m_session;
	m_user.EventProc = GPAC_EventProc;
	if (!javaVM) {
		LOGE("NO JAVA VM FOUND, m_user=%p !!!!\n", &m_user);
		return Quit(KErrGeneral);
	}

	LOGD("Loading GPAC terminal, m_user=%p...", &m_user);
	gf_sys_init(GF_MemTrackerNone);
	gf_fm_request_set_callback(this, on_fm_request);
	SetupLogs();
	m_term = gf_term_new(&m_user);
	if (!m_term) {
		LOGE("Cannot load GPAC Terminal with m_user=%p", &m_user);
		MessageBox("Cannot load GPAC terminal", "Fatal Error", GF_SERVICE_ERROR);
		gf_modules_del(m_user.modules);
		m_user.modules = NULL;
		gf_cfg_del(m_user.config);
		m_user.config = NULL;
		return Quit(KErrGeneral);
	}

	/*force fullscreen*/
	gf_term_set_option(m_term, GF_OPT_FULLSCREEN, 1);

	//setAudioEnvironment(javaVM);

	LOGD("Setting term size m_user=%p...", &m_user);
	gf_term_set_size(m_term, m_Width, m_Height);

	opt = gf_cfg_get_key(m_user.config, "General", "StartupFile");
	LOGD("File loaded at startup=%s.", opt);

	if (!urlToLoad)
		urlToLoad = opt;
	if (urlToLoad) {
		LOGI("Connecting to %s...", urlToLoad);
		gf_term_connect(m_term, urlToLoad);
	}
	debug_log("init end");
	LOGD("Saving config file...\n");
	gf_cfg_save(m_user.config);
	LOGI("Initialization complete, config file saved.\n");

	return 0;
}
Ejemplo n.º 29
0
BOOL HandleCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
	switch (LOWORD(wParam)) {
	case IDM_FILE_OPEN:
		open_file(hwnd);
		break;
	case IDM_FILE_LOG_RTI:
		log_rti = !log_rti;
		setup_logs();
		break;
	case IDM_FILE_PAUSE:
		pause_file();
		break;
	case IDM_VIEW_ABOUT:
		view_about(hwnd);
		break;
	case IDM_VIEW_FS:
		set_full_screen();
		break;
	case IDM_VIEW_STATUS:
		show_status = !show_status;
		gf_cfg_set_key(user.config, "General", "ShowStatusBar", show_status ? "yes" : "no");
		do_layout(1);
		break;
	case IDM_VIEW_CPU:
		view_cpu = !view_cpu;
		break;
	case IDM_VIEW_FORCEGL:
		force_2d_gl = !force_2d_gl;
		gf_cfg_set_key(user.config, "Compositor", "ForceOpenGL", force_2d_gl ? "yes" : "no");
		gf_term_set_option(term, GF_OPT_USE_OPENGL, force_2d_gl);
		break;
	case IDM_NAV_RESET:
		gf_term_set_option(term, GF_OPT_NAVIGATION_TYPE, 0);
		break;
	case IDM_NAV_NONE:
		gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_NONE);
		break;
	case IDM_NAV_SLIDE:
		gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_SLIDE);
		break;
	case IDM_NAV_WALK:
		gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_WALK);
		break;
	case IDM_NAV_FLY:
		gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_FLY);
		break;
	case IDM_NAV_EXAMINE:
		gf_term_set_option(term, GF_OPT_NAVIGATION, GF_NAVIGATE_EXAMINE);
		break;
	case IDM_NAV_HEADLIGHT:
		gf_term_set_option(term, GF_OPT_HEADLIGHT, !gf_term_get_option(term, GF_OPT_HEADLIGHT) );
		break;
	case IDM_NAV_COL_NONE:
		gf_term_set_option(term, GF_OPT_COLLISION, GF_COLLISION_NONE);
		break;
	case IDM_NAV_COL_REG:
		gf_term_set_option(term, GF_OPT_COLLISION, GF_COLLISION_NORMAL);
		break;
	case IDM_NAV_COL_DISP:
		gf_term_set_option(term, GF_OPT_COLLISION, GF_COLLISION_DISPLACEMENT);
		break;
	case IDM_NAV_GRAVITY:
		gf_term_set_option(term, GF_OPT_GRAVITY, !gf_term_get_option(term, GF_OPT_GRAVITY));
		break;

	case IDM_VIEW_AR_NONE:
		gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_KEEP);
		break;
	case IDM_VIEW_AR_FILL:
		gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_FILL_SCREEN);
		break;
	case IDM_VIEW_AR_4_3:
		gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_4_3);
		break;
	case IDM_VIEW_AR_16_9:
		gf_term_set_option(term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_16_9);
		break;

	case IDM_VIEW_LOW_RATE:
		use_low_fps = !use_low_fps;
		gf_term_set_simulation_frame_rate(term, use_low_fps ? 15.0 : 30.0);
		break;
	case ID_VIDEO_DIRECTDRAW:
	{
		u32 drend = (gf_term_get_option(term, GF_OPT_DRAW_MODE)==GF_DRAW_MODE_IMMEDIATE) ? GF_DRAW_MODE_DEFER : GF_DRAW_MODE_IMMEDIATE;
		gf_term_set_option(term, GF_OPT_DRAW_MODE, drend);
		gf_cfg_set_key(user.config, "Compositor", "DrawMode", drend ? "immediate" : "defer");
	}
		break;

	case ID_FILE_CUT_PASTE:
		do_copy_paste();
		break;

	case IDM_OPEN_FILE1:
	case IDM_OPEN_FILE2:
	case IDM_OPEN_FILE3:
	case IDM_OPEN_FILE4:
	case IDM_OPEN_FILE5:
	case IDM_OPEN_FILE6:
	case IDM_OPEN_FILE7:
	case IDM_OPEN_FILE8:
	case IDM_OPEN_FILE9:
	case IDM_OPEN_FILE10:
		load_recent_file(LOWORD(wParam) - IDM_OPEN_FILE1);
		break;

	case IDS_CAP_DISABLE_PLAYLIST:
		playlist_navigation_on = !playlist_navigation_on;
		break;
	case IDM_VIEW_SVG_LOAD:
		set_svg_progressive();
		break;
	case ID_VIDEO_DIRECTFB:
		set_gx_mode(0);
		break;
	case ID_VIDEO_GAPI:
		set_gx_mode(1);
		break;
	case ID_VIDEO_GDI:
		set_gx_mode(2);
		break;

	case ID_LOGLEVEL_NONE:
		log_level = GF_LOG_QUIET;
		rewrite_log_tools(GF_LOG_ALL);
		break;
	case ID_LOGLEVEL_ERROR:
		log_level = GF_LOG_ERROR;
		rewrite_log_tools(GF_LOG_ALL);
		break;
	case ID_LOGLEVEL_WARNING:
		log_level = GF_LOG_WARNING;
		rewrite_log_tools(GF_LOG_ALL);
		break;
	case ID_LOGLEVEL_INFO:
		log_level = GF_LOG_INFO;
		rewrite_log_tools(GF_LOG_ALL);
		break;
	case ID_LOGLEVEL_DEBUG:
		log_level = GF_LOG_DEBUG;
		rewrite_log_tools(GF_LOG_ALL);
		break;
	case ID_TOOLS_CORE: rewrite_log_tools(GF_LOG_CORE); break;
	case ID_TOOLS_CODING: rewrite_log_tools(GF_LOG_CODING); break;
	case ID_TOOLS_CONTAINER: rewrite_log_tools(GF_LOG_CONTAINER); break;
	case ID_TOOLS_NETWORK: rewrite_log_tools(GF_LOG_NETWORK); break;
	case ID_TOOLS_RTP: rewrite_log_tools(GF_LOG_RTP); break;
	case ID_TOOLS_SCRIPT: rewrite_log_tools(GF_LOG_SCRIPT); break;
	case ID_TOOLS_CODEC: rewrite_log_tools(GF_LOG_CODEC); break;
	case ID_TOOLS_PARSER: rewrite_log_tools(GF_LOG_PARSER); break;
	case ID_TOOLS_MEDIA: rewrite_log_tools(GF_LOG_MEDIA); break;
	case ID_TOOLS_SCENE: rewrite_log_tools(GF_LOG_SCENE); break;
	case ID_TOOLS_INTERACT: rewrite_log_tools(GF_LOG_INTERACT); break;
	case ID_TOOLS_COMPOSE: rewrite_log_tools(GF_LOG_COMPOSE); break;
	case ID_TOOLS_MMIO: rewrite_log_tools(GF_LOG_MMIO); break;
	case ID_TOOLS_RTI: rewrite_log_tools(GF_LOG_RTI); break;
	case ID_TOOLS_ALL: rewrite_log_tools(GF_LOG_ALL); break;
	case ID_TOOLS_NONE:
		log_level = GF_LOG_QUIET;
		rewrite_log_tools(GF_LOG_ALL);
		break;
	case ID_LOGS_RESET:
		if (log_file) {
			fclose(log_file);
			log_file = NULL;
		}
		{
			const char *filename = gf_cfg_get_key(user.config, "General", "LogFile");
			if (filename) gf_delete_file(filename);
		}
		setup_logs();
		break;

	case IDM_ITEM_QUIT:
		DestroyWindow(hwnd);
		return FALSE;
	}
	return TRUE;
}
Ejemplo n.º 30
0
void CMainFrame::OnNavNone() 
{
	gf_term_set_option(GetApp()->m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_NONE);
}