2 * GPAC - Multimedia Framework C SDK
\r
4 * Copyright (c) Jean Le Feuvre 2000-2005
\r
5 * All rights reserved
\r
7 * This file is part of GPAC / Stream Management sub-project
\r
9 * GPAC is free software; you can redistribute it and/or modify
\r
10 * it under the terms of the GNU Lesser General Public License as published by
\r
11 * the Free Software Foundation; either version 2, or (at your option)
\r
12 * any later version.
\r
14 * GPAC is distributed in the hope that it will be useful,
\r
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 * GNU Lesser General Public License for more details.
\r
19 * You should have received a copy of the GNU Lesser General Public
\r
20 * License along with this library; see the file COPYING. If not, write to
\r
21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
\r
25 #ifndef _GF_TERMINAL_H_
\r
26 #define _GF_TERMINAL_H_
\r
33 #include <gpac/user.h>
\r
35 /*creates a new terminal for a userApp callback*/
\r
36 GF_Terminal *gf_term_new(GF_User *user);
\r
38 /*delete the app - stop is done automatically, you don't have to do it before deleting the app
\r
39 returns GF_IO_ERR if client couldn't be shutdown normally*/
\r
40 GF_Err gf_term_del(GF_Terminal *term);
\r
42 /*connects to a URL*/
\r
43 void gf_term_connect(GF_Terminal *term, const char *URL);
\r
44 /*disconnects the url*/
\r
45 void gf_term_disconnect(GF_Terminal *term);
\r
46 /*navigates to a given destination or shutdown/restart the current one if any.
\r
47 This is the only safe way of restarting/jumping a presentation from inside the EventProc
\r
48 where doing a disconnect/connect could deadlock if toURL is NULL, uses the current URL*/
\r
49 void gf_term_navigate_to(GF_Terminal *term, const char *toURL);
\r
50 /*restarts url from given time (in ms). Return value:
\r
51 0: service is not connected yet
\r
52 1: service has no seeking capabilities
\r
53 2: service has been seeked
\r
55 u32 gf_term_play_from_time(GF_Terminal *term, u64 from_time, Bool pause_at_first_frame);
\r
56 /*connect URL and seek right away - only needed when reloading the complete player (avoids waiting
\r
57 for connection and post a seek..)*/
\r
58 void gf_term_connect_from_time(GF_Terminal *term, const char *URL, u64 time_in_ms, Bool pause_at_first_frame);
\r
60 /*same as gf_term_connect but specifies a parent path*/
\r
61 void gf_term_connect_with_path(GF_Terminal *term, const char *URL, const char *parent_URL);
\r
63 /*returns current framerate
\r
64 if @absoluteFPS is set, the return value is the absolute framerate, eg NbFrameCount/NbTimeSpent regardless of
\r
65 whether a frame has been drawn or not, which means the FPS returned can be much greater than the target rendering
\r
67 if @absoluteFPS is not set, the return value is the FPS taking into account not drawn frames (eg, less than
\r
68 or equal to compositor FPS)
\r
70 Double gf_term_get_framerate(GF_Terminal *term, Bool absoluteFPS);
\r
71 /*get main scene current time in milliseconds*/
\r
72 u32 gf_term_get_time_in_ms(GF_Terminal *term);
\r
74 /*returns current URL address*/
\r
75 const char *gf_term_get_url(GF_Terminal *term);
\r
77 /*get viewpoints/viewports for main scene - idx is 1-based, and if greater than number of viewpoints return GF_EOS*/
\r
78 GF_Err gf_term_get_viewpoint(GF_Terminal *term, u32 viewpoint_idx, const char **outName, Bool *is_bound);
\r
79 /*set active viewpoints/viewports for main scene given its name - idx is 1-based, or 0 to set by viewpoint name
\r
80 if only one viewpoint is present in the scene, this will bind/unbind it*/
\r
81 GF_Err gf_term_set_viewpoint(GF_Terminal *term, u32 viewpoint_idx, const char *viewpoint_name);
\r
83 /*adds an object to the scene - only possible if scene has selectable streams (cf GF_OPT_CAN_SELECT_STREAMS option)*/
\r
84 GF_Err gf_term_add_object(GF_Terminal *term, const char *url, Bool auto_play);
\r
87 /*set/set option - most of the terminal cfg is done through options, please refer to user.h for details*/
\r
88 GF_Err gf_term_set_option(GF_Terminal *term, u32 opt_type, u32 opt_value);
\r
89 u32 gf_term_get_option(GF_Terminal *term, u32 opt_type);
\r
91 /*checks if given URL is understood by client.
\r
92 if use_parent_url is set, relative URLs are solved against the current presentation URL*/
\r
93 Bool gf_term_is_supported_url(GF_Terminal *term, const char *fileName, Bool use_parent_url, Bool no_mime_check);
\r
95 /*sets simulation frame rate*/
\r
96 GF_Err gf_term_set_simulation_frame_rate(GF_Terminal * term, Double frame_rate);
\r
97 /*gets simulation frame rate*/
\r
98 Double gf_term_get_simulation_frame_rate(GF_Terminal *term);
\r
100 /*sends a set of scene commands (BT, XMT, X3D, LASeR+XML) to the scene
\r
101 type indicates the language used - accepted values are
\r
102 "model/x3d+xml" or "x3d": commands is an X3D+XML scene
\r
103 "model/x3d+vrml" or "xrdv": commands is an X3D+VRML scene
\r
104 "model/vrml" or "vrml": commands is an VRML scene
\r
105 "application/x-xmt" or "xmt": commands is an XMT-A scene or a list of XMT-A updates
\r
106 "application/x-bt" or "bt": commands is a BT scene or a list of BT updates
\r
107 "image/svg+xml" or "svg": commands is an SVG scene
\r
108 "application/x-laser+xml" or "laser": commands is an SVG/LASeR+XML scene or a list of LASeR+XML updates
\r
109 if not specified, the type will be guessed from the current root node if any
\r
111 GF_Err gf_term_scene_update(GF_Terminal *term, char *type, char *com);
\r
114 /*request visual output size change:
\r
115 * NOT NEEDED WHEN THE TERMINAL IS HANDLING THE DISPLAY WINDOW (cf user.h)
\r
116 * if the user app manages the output window it shall resize it before calling this
\r
118 GF_Err gf_term_set_size(GF_Terminal *term, u32 NewWidth, u32 NewHeight);
\r
120 /*returns current text selection if any, or NULL otherwise. If probe mode is set, returns a non-NULL string ("")
\r
121 if some text is selected*/
\r
122 const char *gf_term_get_text_selection(GF_Terminal *term, Bool probe_only);
\r
123 /*pastes text into current selection if any. If probe mode is set, only check if text is currently edited
\r
124 if some text is selected*/
\r
125 GF_Err gf_term_paste_text(GF_Terminal *term, const char *txt, Bool probe_only);
\r
128 /*decodes pending media and render frame.
\r
129 NOTE: This can only be used when the terminal runs without visual thread (GF_TERM_NO_VISUAL_THREAD flag set)
\r
131 GF_Err gf_term_process_step(GF_Terminal *term);
\r
133 /*decodes all pending media and render frame until no scene changes are detected.
\r
134 NOTE: This can only be used when the terminal runs without visual thread (GF_TERM_NO_VISUAL_THREAD flag set)
\r
136 GF_Err gf_term_process_flush(GF_Terminal *term);
\r
138 /*post user interaction to terminal*/
\r
139 /*NOT NEEDED WHEN THE TERMINAL IS HANDLING THE DISPLAY WINDOW (cf user.h)*/
\r
140 Bool gf_term_user_event(GF_Terminal *term, GF_Event *event);
\r
142 /*post extended user mouse interaction to terminal
\r
143 X and Y are point coordinates in the display expressed in 2D coord system top-left (0,0), Y increasing towards bottom
\r
144 @xxx_but_down: specifiy whether the mouse button is down(2) or up (1), 0 if unchanged
\r
145 @wheel: specifiy current wheel inc (0: unchanged , +1 for one wheel delta forward, -1 for one wheel delta backward)
\r
147 /*NOT NEEDED WHEN THE TERMINAL IS HANDLING THE DISPLAY WINDOW (cf user.h)*/
\r
148 void gf_term_mouse_input(GF_Terminal *term, GF_EventMouse *event);
\r
150 /*post extended user key interaction to terminal
\r
151 @key_code: GPAC DOM code of input key
\r
152 @hw_code: hardware code of input key
\r
153 @isKeyUp: set if key is released
\r
155 /*NOT NEEDED WHEN THE TERMINAL IS HANDLING THE DISPLAY WINDOW (cf user.h)*/
\r
156 void gf_term_keyboard_input(GF_Terminal *term, u32 key_code, u32 hw_code, Bool isKeyUp);
\r
158 /*post extended user character interaction to terminal
\r
159 @character: unicode character input
\r
161 /*NOT NEEDED WHEN THE TERMINAL IS HANDLING THE DISPLAY WINDOW (cf user.h)*/
\r
162 void gf_term_string_input(GF_Terminal *term, u32 character);
\r
166 /*framebuffer access*/
\r
167 #include <gpac/color.h>
\r
169 /*gets screen buffer - this locks the scene graph too until released is called*/
\r
170 GF_Err gf_term_get_screen_buffer(GF_Terminal *term, GF_VideoSurface *framebuffer);
\r
171 /*releases screen buffer and unlocks graph*/
\r
172 GF_Err gf_term_release_screen_buffer(GF_Terminal *term, GF_VideoSurface *framebuffer);
\r
175 /*ObjectManager used by both terminal and object browser (term_info.h)*/
\r
176 typedef struct _od_manager GF_ObjectManager;
\r
183 #endif /*_GF_TERMINAL_H_*/
\r