+++ /dev/null
-/*\r
- * GPAC - Multimedia Framework C SDK\r
- *\r
- * Copyright (c) Jean Le Feuvre 2000-2005 \r
- * All rights reserved\r
- *\r
- * This file is part of GPAC / Stream Management sub-project\r
- *\r
- * GPAC is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU Lesser General Public License as published by\r
- * the Free Software Foundation; either version 2, or (at your option)\r
- * any later version.\r
- * \r
- * GPAC is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU Lesser General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU Lesser General Public\r
- * License along with this library; see the file COPYING. If not, write to\r
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
- *\r
- */\r
-\r
-#ifndef _GF_TERMINAL_DEV_H_\r
-#define _GF_TERMINAL_DEV_H_\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-\r
-#include <gpac/terminal.h>\r
-#include <gpac/mpeg4_odf.h>\r
-\r
-#include <gpac/modules/service.h>\r
-#include <gpac/modules/codec.h>\r
-#include <gpac/modules/ipmp.h>\r
-#include <gpac/mediaobject.h>\r
-#include <gpac/thread.h>\r
-\r
-typedef struct _inline_scene GF_InlineScene;\r
-typedef struct _media_manager GF_MediaManager;\r
-typedef struct _object_clock GF_Clock;\r
-typedef struct _es_channel GF_Channel;\r
-typedef struct _generic_codec GF_Codec;\r
-typedef struct _composition_memory GF_CompositionMemory;\r
-\r
-\r
-struct _net_service\r
-{\r
- /*the module handling this service - must be declared first to typecast with GF_DownlaodSession upon deletion*/\r
- GF_InputService *ifce;\r
-\r
- /*the terminal*/\r
- struct _tag_terminal *term;\r
- /*service url*/\r
- char *url;\r
- /*od_manager owning service, NULL for services created for remote channels*/\r
- struct _od_manager *owner;\r
- /*number of attached remote channels ODM (ESD URLs)*/\r
- u32 nb_ch_users;\r
- /*number of attached remote ODM (OD URLs)*/\r
- u32 nb_odm_users;\r
- \r
- /*clock objects. Kept at service level since ESID namespace is the service one*/\r
- GF_List *Clocks;\r
- /*all downloaders objects used in this service*/\r
- GF_List *dnloads;\r
- /*cache asscoiated with service, if any*/\r
- GF_StreamingCache *cache;\r
-};\r
-\r
-\r
-/*opens service - performs URL concatenation if parent service specified*/\r
-GF_ClientService *gf_term_service_new(GF_Terminal *term, GF_ObjectManager *owner, const char *url, const char *parent_url, GF_Err *ret_code);\r
-/*destroy service*/\r
-void gf_term_service_del(GF_ClientService *nets);\r
-\r
-/*access to the module interfaces - cf net_api.h GF_InputService for details*/\r
-GF_Err gf_term_service_command(GF_ClientService *ns, GF_NetworkCommand *com);\r
-Bool gf_term_service_can_handle_url(GF_ClientService *ns, char *url);\r
-\r
-GF_Err gf_term_channel_get_sl_packet(GF_ClientService *ns, LPNETCHANNEL channel, char **out_data_ptr, u32 *out_data_size, GF_SLHeader *out_sl_hdr, Bool *is_compressed, GF_Err *out_reception_status, Bool *is_new_data);\r
-GF_Err gf_term_channel_release_sl_packet(GF_ClientService *ns, LPNETCHANNEL channel);\r
-\r
-/*cache open/close*/\r
-GF_Err gf_term_service_cache_load(GF_ClientService *ns);\r
-GF_Err gf_term_service_cache_close(GF_ClientService *ns, Bool no_save);\r
-\r
-/*forwards all clocks of the given amount of time. Can only be used when terminal is in paused mode\r
-this is mainly designed for movie dumping in MP4Client*/\r
-GF_Err gf_term_step_clocks(GF_Terminal * term, u32 ms_diff);\r
-\r
-void gf_term_sample_clocks(GF_Terminal *term);\r
-\r
-/*\r
- Inline scene stuff\r
-*/\r
-struct _inline_scene\r
-{\r
- /*root OD of the subscene, ALWAYS namespace of the parent scene*/\r
- struct _od_manager *root_od;\r
- /*scene codec: top level decoder decoding/generating the scene - can be BIFS, VRML parser, etc*/\r
- struct _generic_codec *scene_codec;\r
- /*OD codec - specific to MPEG-4, only present at the inline level (media ressources are always scoped here)*/\r
- struct _generic_codec *od_codec;\r
-\r
- /*struct _od_managers used, namespace of this scene. The chain does not have the root_od\r
- it only contains OD sent through OD UPDATE in the OD stream(s) attached \r
- to this scene. Remote ODs are not added, only there parents are*/\r
- GF_List *ODlist;\r
- /*list of MOs (links between OD and nodes)*/\r
- GF_List *media_objects;\r
- /*list of externproto libraries*/\r
- GF_List *extern_protos;\r
- /*list of nodes using this inline*/\r
- GF_List *inline_nodes;\r
- /*list of extra scene graphs (text streams, generic OSDs, ...)*/\r
- GF_List *extra_scenes;\r
- /*inline scene graph*/\r
- GF_SceneGraph *graph;\r
- /*graph state - if not attached, no traversing of inline\r
- 0: not attached\r
- 1: attached\r
- 2: temp graph attached. The temp graph is generated when waiting for the first scene AU to be processed\r
- */\r
- u32 graph_attached;\r
- /*togles inline restart - needed because the restart may be triggered from inside the scene or from\r
- parent scene, hence 2 render passes must be used\r
- special value 2 means scene URL changes (for anchor navigation*/\r
- u32 needs_restart;\r
- /*duration of inline scene*/\r
- u64 duration;\r
- /*if not 0, all objects in the scene will run on this clock. Needed in GPAC when clock references do not\r
- respect object graph (eg IOD depending on external stream for clock)*/\r
- u16 force_sub_clock_id;\r
- /*world info node or title node*/\r
- void *world_info;\r
-\r
- Bool is_dynamic_scene;\r
- /*clock for dynamic scene - current assumption is that all selected streams are synchronized in the dyn scene*/\r
- GF_Clock *dyn_ck;\r
- /*URLs of current video, audio and subs (we can't store objects since they may be destroyed when seeking)*/\r
- SFURL visual_url, audio_url, text_url;\r
- /*set to 1 when single time-line presentation with ONE OD AU is detected - the goal is to prevent\r
- OD shutdown/startup when seeking. This will also remove unneeded net traffic for AddChannel/RemoveChannel\r
- like RTSP TEARDOWN/SETUP*/\r
- Bool static_media_ressources;\r
-\r
- /*current simulation time of the compositor*/\r
- Double simulation_time;\r
-\r
- /*current IRI fragment if any*/\r
- char *fragment_uri;\r
-\r
- /*secondary resource scene*/\r
- Bool secondary_resource;\r
-\r
- char *redirect_xml_base;\r
-};\r
-\r
-GF_InlineScene *gf_inline_new(GF_InlineScene *parentScene);\r
-void gf_inline_del(GF_InlineScene *is);\r
-struct _od_manager *gf_inline_find_odm(GF_InlineScene *is, u16 OD_ID);\r
-void gf_inline_disconnect(GF_InlineScene *is, Bool for_shutdown);\r
-void gf_inline_remove_object(GF_InlineScene *is, GF_ObjectManager *odm, Bool for_shutdown);\r
-/*browse all (media) channels and send buffering info to the app*/\r
-void gf_inline_buffering_info(GF_InlineScene *is);\r
-void gf_inline_attach_to_compositor(GF_InlineScene *is);\r
-struct _mediaobj *gf_inline_get_media_object(GF_InlineScene *is, MFURL *url, u32 obj_type_hint, Bool lock_timelines);\r
-struct _mediaobj *gf_inline_get_media_object_ex(GF_InlineScene *is, MFURL *url, u32 obj_type_hint, Bool lock_timelines, struct _mediaobj *sync_ref, Bool always_load_new, GF_Node *node_ptr);\r
-void gf_inline_setup_object(GF_InlineScene *is, GF_ObjectManager *odm);\r
-/*restarts inline scene - care has to be taken not to remove the scene while it is traversed*/\r
-void gf_inline_restart(GF_InlineScene *is);\r
-/*updates scene duration based on settings*/\r
-void gf_inline_set_duration(GF_InlineScene *is);\r
-/*locate media object by ODID (non dynamic ODs) or URL (dynamic ODs)*/\r
-struct _mediaobj *gf_inline_find_object(GF_InlineScene *is, u16 ODID, char *url);\r
-/*returns scene time in sec - exact meaning of time depends on standard used*/\r
-Double gf_inline_get_time(void *_is);\r
-/*returns true if the given node DEF name is the url target view (eg blabla#myview)*/\r
-Bool gf_inline_default_scene_viewpoint(GF_Node *node);\r
-/*register extra scene graph for on-screen display*/\r
-void gf_inline_register_extra_graph(GF_InlineScene *is, GF_SceneGraph *extra_scene, Bool do_remove);\r
-/*forces scene size info (without changing pixel metrics) - this may be needed by modules using extra graphs (like timedtext)*/\r
-void gf_inline_force_scene_size(GF_InlineScene *is, u32 width, u32 height);\r
-/*regenerate a scene graph based on available objects - can only be called for dynamic OD streams*/\r
-void gf_inline_regenerate(GF_InlineScene *is);\r
-/*selects given ODM for dynamic scenes*/\r
-void gf_inline_select_object(GF_InlineScene *is, GF_ObjectManager *odm);\r
-/*restarts dynamic scene from given time: scene graph is not reseted, objects are just restarted\r
-instead of closed and reopened. If a media control is present on inline, from_time is overriden by MC range*/\r
-void gf_inline_restart_dynamic(GF_InlineScene *is, u64 from_time);\r
-/*owner inline node has been modified*/\r
-void gf_inline_on_modified(GF_Node *node);\r
-/*returns scene graph associated with an externProto lib - exported for VRML/X3D loaded*/\r
-GF_SceneGraph *gf_inline_get_proto_lib(void *_is, MFURL *lib_url);\r
-/*exported for compositor: handles filtering of "self" parameter indicating anchor only acts on container inline scene\r
-not root one. Returns 1 if handled (cf user.h, navigate event)*/\r
-Bool gf_inline_process_anchor(GF_Node *caller, GF_Event *evt);\r
-/*extern proto fetcher*/\r
-GF_SceneGraph *gf_inline_get_proto_lib(void *SceneCallback, MFURL *lib_url);\r
-void gf_inline_force_scene_size_video(GF_InlineScene *is, GF_MediaObject *mo);\r
-void gf_inline_sample_time(GF_InlineScene *is);\r
-/*compares object URL with another URL - ONLY USE THIS WITH DYNAMIC ODs*/\r
-Bool gf_mo_is_same_url(GF_MediaObject *obj, MFURL *inline_url);\r
-\r
-void gf_mo_update_caps(GF_MediaObject *mo);\r
-\r
-\r
-const char *gf_inline_get_fragment_uri(GF_Node *node);\r
-void gf_inline_set_fragment_uri(GF_Node *node, const char *uri);\r
-\r
-enum\r
-{\r
- /*threading up to decoder*/\r
- GF_TERM_THREAD_FREE,\r
- /*single thread for all decoders*/\r
- GF_TERM_THREAD_SINGLE,\r
- /*all media (image, video, audio) decoders are threaded*/\r
- GF_TERM_THREAD_MULTI,\r
-};\r
-\r
-enum\r
-{\r
- GF_TERM_RUNNING= 1,\r
- GF_TERM_DEAD = 1<<1,\r
- GF_TERM_SINGLE_THREAD = 1<<2,\r
- GF_TERM_MULTI_THREAD = 1<<3,\r
- GF_TERM_SYSDEC_RESYNC = 1<<4,\r
- GF_TERM_SINGLE_CLOCK = 1<<5,\r
- GF_TERM_DRAW_FRAME = 1<<6\r
-};\r
-\r
-\r
-\r
-struct _tag_terminal\r
-{\r
- u32 flags;\r
-\r
- /*callback to user application*/ \r
- GF_User *user;\r
- /*scene compositor*/\r
- struct __tag_compositor *compositor;\r
- /*file downloader*/\r
- GF_DownloadManager *downloader;\r
- /*top level scene*/\r
- GF_InlineScene *root_scene;\r
-\r
- /*Media manager*/\r
- GF_List *codecs;\r
- /*mutex for decoder access*/\r
- GF_Mutex *mm_mx;\r
- /*decoding thread*/\r
- GF_Thread *mm_thread;\r
- /*last codec used in mm loop*/\r
- u32 last_codec;\r
- /*thread priority*/\r
- s32 priority;\r
- u32 cumulated_priority;\r
- /*frame duration*/\r
- u32 frame_duration;\r
-\r
- /*net services*/\r
- GF_List *net_services;\r
- /*net services to be destroyed*/\r
- GF_List *net_services_to_remove;\r
- /*channels waiting for service CONNECT ack to be setup*/\r
- GF_List *channels_pending;\r
- /*media objects pending for stop/play*/\r
- GF_List *media_queue;\r
- /*network lock*/\r
- GF_Mutex *net_mx;\r
- /*all X3D key/mouse/string sensors*/\r
- GF_List *x3d_sensors;\r
- /*all input stream decoders*/\r
- GF_List *input_streams;\r
- \r
- /*options (cf config doc)*/\r
- Bool enable_cache;\r
- /*data timeout for network buffering in ms - if no data is received within this timeout\r
- the initial buffering aborts. */\r
- u32 net_data_timeout;\r
-\r
- u32 play_state;\r
-\r
- u32 reload_state;\r
- char *reload_url;\r
-\r
- /*special list used by nodes needing a call to RenderNode but not in the traverese scene graph (VRML/MPEG-4 protos only). \r
- For these nodes, the traverse effect passed will be NULL. This is only used by InputSensor node at the moment*/\r
- GF_List *nodes_pending;\r
-\r
- /*root node of the user prefs*/\r
- GF_SceneGraph *dcci_doc;\r
-\r
- GF_List *extensions;\r
- GF_List *unthreaded_extensions;\r
-};\r
-\r
-\r
-\r
-GF_Err gf_term_init_scheduler(GF_Terminal *term, u32 threading_mode);\r
-void gf_term_stop_scheduler(GF_Terminal *term);\r
-void gf_term_add_codec(GF_Terminal *term, GF_Codec *codec);\r
-void gf_term_remove_codec(GF_Terminal *term, GF_Codec *codec);\r
-void gf_term_start_codec(GF_Codec *codec);\r
-void gf_term_stop_codec(GF_Codec *codec);\r
-void gf_term_set_threading(GF_Terminal *term, u32 mode);\r
-void gf_term_set_priority(GF_Terminal *term, s32 Priority);\r
-\r
-\r
-/*error report function*/\r
-void gf_term_message(GF_Terminal *app, const char *service, const char *message, GF_Err error);\r
-/*creates service for given OD / URL*/\r
-void gf_term_connect_object(GF_Terminal *app, GF_ObjectManager *odm, char *serviceURL, char *parent_url);\r
-/*creates service for given channel / URL*/\r
-GF_Err gf_term_connect_remote_channel(GF_Terminal *app, GF_Channel *ch, char *URL);\r
-\r
-/*called by media manager to perform service maintenance:\r
-servive shutdown: this is needed because service handler may be asynchronous\r
-object Play: this is needed to properly handle multiplexed sources (all channels must be connected before play)\r
-service restart\r
-*/\r
-void gf_term_handle_services(GF_Terminal *app);\r
-/*close service and queue for delete*/\r
-void gf_term_close_services(GF_Terminal *app, GF_ClientService *service);\r
-\r
-/*locks net manager*/\r
-void gf_term_lock_net(GF_Terminal *app, Bool LockIt);\r
-\r
-\r
-/*locks scene compositor*/\r
-void gf_term_lock_compositor(GF_Terminal *app, Bool LockIt);\r
-/*get scene compositor time - FIXME this is not flexible enough for SMIL/Multiple time containers*/\r
-u32 gf_term_get_time(GF_Terminal *term);\r
-/*forces scene composition*/\r
-void gf_term_invalidate_compositor(GF_Terminal *term);\r
-\r
-/*callbacks for scene graph library so that all related ESM nodes are properly instanciated*/\r
-void gf_term_node_callback(void *_is, u32 type, GF_Node *node, void *param);\r
-\r
-/*add/rem node requiring a call to render without being present in traversed graph (VRML/MPEG-4 protos). \r
-For these nodes, the traverse effect passed will be NULL.*/\r
-void gf_term_queue_node_traverse(GF_Terminal *term, GF_Node *node);\r
-void gf_term_unqueue_node_traverse(GF_Terminal *term, GF_Node *node);\r
-\r
-\r
-\r
-/*clock*/\r
-struct _object_clock \r
-{\r
- u16 clockID; \r
- GF_Terminal *term;\r
- GF_Mutex *mx;\r
- /*no_time_ctrl : set if ANY stream running on this clock has no time control capabilities - this avoids applying\r
- mediaControl and others that would break stream dependencies*/\r
- Bool use_ocr, clock_init, has_seen_eos, no_time_ctrl;\r
- u32 init_time, StartTime, PauseTime, Paused;\r
- /*the number of streams buffering on this clock*/\r
- u32 Buffering;\r
- /*associated media control if any*/\r
- struct _media_control *mc;\r
- /*for MC only (no FlexTime)*/\r
- Fixed speed;\r
- u32 discontinuity_time;\r
- s32 drift;\r
-};\r
-\r
-/*destroys clock*/\r
-void gf_clock_del(GF_Clock *ck);\r
-/*finds a clock by ID or by ES_ID*/\r
-GF_Clock *gf_clock_find(GF_List *Clocks, u16 clockID, u16 ES_ID);\r
-/*attach clock returns a new clock or the clock this stream (ES_ID) depends on (OCR_ES_ID)\r
-hasOCR indicates whether the stream being attached carries object clock references\r
-@clocks: list of clocks in ES namespace (service)\r
-@is: inline scene to solve clock dependencies\r
-*/\r
-GF_Clock *gf_clock_attach(GF_List *clocks, GF_InlineScene *is, u16 OCR_ES_ID, u16 ES_ID, s32 hasOCR);\r
-/*reset clock (only called by channel owning clock)*/\r
-void gf_clock_reset(GF_Clock *ck);\r
-/*stops clock (only called for scene clock)*/\r
-void gf_clock_stop(GF_Clock *ck);\r
-/*return clock time in ms*/\r
-u32 gf_clock_time(GF_Clock *ck);\r
-/*return ellapsed time in ms since start of the clock*/\r
-u32 gf_clock_ellapse_time(GF_Clock *ck);\r
-/*sets clock time - FIXME: drift updates for OCRs*/\r
-void gf_clock_set_time(GF_Clock *ck, u32 TS);\r
-/*return clock time in ms without drift adjustment - used by audio objects only*/\r
-u32 gf_clock_real_time(GF_Clock *ck);\r
-/*pause the clock*/\r
-void gf_clock_pause(GF_Clock *ck);\r
-/*resume the clock*/\r
-void gf_clock_resume(GF_Clock *ck);\r
-/*returns true if clock started*/\r
-Bool gf_clock_is_started(GF_Clock *ck);\r
-/*toggles buffering on (clock is paused at the first stream buffering) */\r
-void gf_clock_buffer_on(GF_Clock *ck);\r
-/*toggles buffering off (clock is paused at the last stream restarting) */\r
-void gf_clock_buffer_off(GF_Clock *ck);\r
-/*set clock speed scaling factor*/\r
-void gf_clock_set_speed(GF_Clock *ck, Fixed speed);\r
-/*set clock drift - used to resync audio*/\r
-void gf_clock_adjust_drift(GF_Clock *ck, s32 ms_drift);\r
-\r
-enum\r
-{\r
- /*channel is setup and waits for connection request*/\r
- GF_ESM_ES_SETUP = 0,\r
- /*waiting for server reply*/\r
- GF_ESM_ES_WAIT_FOR_ACK,\r
- /*connection OK*/\r
- GF_ESM_ES_CONNECTED,\r
- /*data exchange on this service/channel*/\r
- GF_ESM_ES_RUNNING,\r
- /*deconnection OK - a download channel can automatically disconnect when download is done*/\r
- GF_ESM_ES_DISCONNECTED,\r
- /*service/channel is not (no longer) available/found and should be removed*/\r
- GF_ESM_ES_UNAVAILABLE\r
-};\r
-\r
-/*data channel (elementary stream)*/\r
-struct _es_channel \r
-{\r
- /*security check on channel*/\r
- u32 chan_id;\r
- /*service this channel belongs to*/\r
- GF_ClientService *service;\r
- /*stream descriptor*/\r
- GF_ESD *esd;\r
- /*parent OD for this stream*/\r
- struct _od_manager *odm;\r
- u32 es_state;\r
- Bool is_pulling;\r
- u32 media_padding_bytes;\r
- /*IO mutex*/\r
- GF_Mutex *mx;\r
- u32 AU_Count;\r
- /*decoding buffers for push mode*/\r
- struct _decoding_buffer * AU_buffer_first, * AU_buffer_last;\r
- /*static decoding buffer for pull mode*/\r
- struct _decoding_buffer * AU_buffer_pull;\r
- /*channel buffer flag*/\r
- Bool BufferOn;\r
- /*min level to trigger buffering on, max to trigger it off. */\r
- u32 MinBuffer, MaxBuffer;\r
- /*amount of buffered media - this is the DTS of the last received AU minus the onject clock time, to make sure\r
- we always have MaxBuffer ms ready for composition when resuming the clock*/\r
- s32 BufferTime;\r
- /*last received AU time - if exceeding a certain time and buffering is on, buffering is turned off.\r
- This is needed for streams with very short duration (less than buffer time) and stream with only one AU (BIFS/OD)*/\r
- u32 last_au_time;\r
- /*Current reassemnbling buffer - currently packets are NOT reordered, only AUs are*/\r
- char *buffer;\r
- u32 len, allocSize;\r
- /*only for last packet of an AU*/\r
- u8 padingBits;\r
- Bool IsEndOfStream;\r
- /* SL reassembler */\r
- /*current AU TSs*/\r
- u32 DTS, CTS;\r
- /*AU and Packet seq num info*/\r
- u32 au_sn, pck_sn;\r
- u32 max_au_sn, max_pck_sn;\r
- /*the AU length indicated in the SL Header. */\r
- u32 AULength;\r
- /*state indicator: 0 OK, 1: not tuned in, 2: has error and needs RAP*/\r
- u32 stream_state;\r
- /*the AU in reception is RAP*/\r
- Bool IsRap;\r
- /*signal that next AU is an AU start*/\r
- Bool NextIsAUStart;\r
- /*if codec resilient, packet drops are not considered as fatal for AU reconstruction (eg no wait for RAP)*/\r
- Bool codec_resilient;\r
- /*when starting a channel, the first AU is ALWAYS fetched when buffering - this forces\r
- BIFS and OD to be decoded and first frame render, in order to detect media objects that would also need\r
- buffering - note this doesn't affect the clock, it is still paused if buffering*/\r
- Bool first_au_fetched;\r
-\r
- /* used in Carousel, to skip packets until the end of AU */ \r
- Bool skip_carousel_au;\r
- \r
- /* TimeStamp to Media Time mapping*/\r
- /*TS (in TSResolution) corresponding to the SeedTime of the decoder. Delivered by net, otherwise 0*/\r
- u64 seed_ts;\r
- /*media time offset corresponding to SeedTS. This is needed when the channel doesn't own the clock*/\r
- u32 ts_offset;\r
- /*scaling factors to remap to timestamps in milliseconds*/\r
- u64 ts_res;\r
- Double ocr_scale;\r
- /*clock driving this stream - currently only CTS is supported (no OCR)*/\r
- struct _object_clock *clock;\r
- /*flag for clock init. Only a channel owning the clock will set this flag on clock init*/\r
- Bool IsClockInit;\r
-\r
- /*duration of last received AU if any, 0 if not known (most of the time)*/\r
- u32 au_duration;\r
- /*A channel with this flag set considers each incoming packet as a complete AU and assigns timestamps \r
- upon reception matching the reception time, then dispatching it into the decoding buffer (only tested\r
- with audi video). This flag is turned on by setting esd->slconfig->predefined to 'SLPredef_SkipSL' */\r
- Bool skip_sl;\r
-\r
- /*indicates that decoding can be called directly when receiving a complete AU on this channel\r
- This is used by systems streams in non-seekable (eg broadcast/multicast, MPEG-2 TS multiplexes) to \r
- make sure resources are setup as fast as possible. If the AU is too early, it will be kept in the \r
- decoding buffer*/\r
- Bool dispatch_after_db;\r
-\r
- /*indicates that decoding is called directly when receiving a packet on this channel\r
- This is used to bypass SL defragmenting and decoding buffer for EIT internal streams*/\r
- Bool bypass_sl_and_db;\r
-\r
- GF_IPMPTool *ipmp_tool;\r
- Bool is_protected;\r
-\r
- /*TSs as received from network - these are used for cache storage*/\r
- u64 net_dts, net_cts;\r
-};\r
-\r
-/*creates a new channel for this stream*/\r
-GF_Channel *gf_es_new(GF_ESD *esd);\r
-/*destroys channel*/\r
-void gf_es_del(GF_Channel *ch);\r
-/*(un)locks channel*/\r
-void gf_es_lock(GF_Channel *ch, u32 LockIt);\r
-/*setup channel for reception of data*/\r
-GF_Err gf_es_start(GF_Channel *ch);\r
-/*stop channel from receiving data*/\r
-GF_Err gf_es_stop(GF_Channel *ch);\r
-/*handles reception of an SL PDU*/\r
-void gf_es_receive_sl_packet(GF_ClientService *serv, GF_Channel *ch, char *StreamBuf, u32 StreamLength, GF_SLHeader *header, GF_Err reception_status);\r
-/*signals end of stream on the channel*/\r
-void gf_es_on_eos(GF_Channel *ch);\r
-/*fetches first AU available for decoding on this channel*/\r
-struct _decoding_buffer *gf_es_get_au(GF_Channel *ch);\r
-/*drops first AU on this channel*/\r
-void gf_es_drop_au(GF_Channel *ch);\r
-/*performs final setup upon connection confirm*/\r
-void gf_es_on_connect(GF_Channel *ch);\r
-/*reconfigure SL for this channel*/\r
-void gf_es_reconfig_sl(GF_Channel *ch, GF_SLConfig *slc);\r
-/*hack for streaming: whenever a time map (media time <-> TS time) event is received on the channel reset decoding buffer\r
-this is needed because all server tested resend packets on already running channel*/\r
-void gf_es_map_time(GF_Channel *ch, Bool reset);\r
-/*dummy channels are used by scene decoders which don't use ESM but load directly the scene graph themselves\r
-these channels are ALWAYS pulling ones, and this function will init the channel clock if needed*/\r
-void gf_es_init_dummy(GF_Channel *ch);\r
-/*setup DRM info*/\r
-void gf_es_config_drm(GF_Channel *ch, GF_NetComDRMConfig *isma_cryp);\r
-\r
-/*\r
- decoder stuff\r
-*/\r
-enum\r
-{\r
- /*stop: the decoder is not playing*/\r
- GF_ESM_CODEC_STOP = 0,\r
- /*stop: the decoder is playing*/\r
- GF_ESM_CODEC_PLAY = 1,\r
- /*End Of Stream: when the base layer signals it's done, this triggers media-specific\r
- handling of the CB. \r
- For video, the output is kept alive, For audio, the output is reseted (don't want audio loop ;)*/\r
- GF_ESM_CODEC_EOS = 2,\r
- /*pause: the decoder is stoped but the CB is kept intact\r
- THIS IS NOT USED AS A CODEC STATUS, but only for signaling that the CB shouldn't \r
- be reseted - the real status of a "paused" decoder is STOP*/\r
- GF_ESM_CODEC_PAUSE = 3,\r
- /*Buffer: transition state: the decoder runs (fetch data/decode) but the clock\r
- is not running (no composition). This is used for rebuffering channels (rtp...)*/\r
- GF_ESM_CODEC_BUFFER = 4\r
-};\r
-\r
-enum\r
-{\r
- GF_ESM_CODEC_HAS_UPSTREAM = 1,\r
- /*the codec uses the interface from another codec (only used by private scene streams to handle\r
- any intern sprite/animation streams)*/\r
- GF_ESM_CODEC_IS_USE = 1<<1,\r
- /*set for OD codec when static (ressources are declared in OD stream esd a la ISMA*/\r
- GF_ESM_CODEC_IS_STATIC_OD = 1<<2,\r
-};\r
-\r
-struct _generic_codec \r
-{\r
- /*codec type (streamType from base layer)*/\r
- u32 type;\r
- u32 flags;\r
- /*current decoder interface */\r
- GF_BaseDecoder *decio;\r
- /*composition memory for media streams*/\r
- struct _composition_memory *CB;\r
- /*input media channles*/\r
- GF_List *inChannels;\r
- /*a pointer to the OD that owns the decoder.*/\r
- struct _od_manager *odm;\r
- u32 Status;\r
- Bool Muted;\r
- struct _object_clock *ck;\r
- /*priority of this media object. This is ALWAYS the base layer priority\r
- PriorityBoost is set when the CB is under critical limit (for now only audio uses the feature)\r
- and results in a bigger time slice for the codec. Only on/off value for now*/\r
- u32 Priority, PriorityBoost;\r
- /*last processed DTS - sanity check for scalability*/\r
- u32 last_unit_dts;\r
- /*last processed CTS on base layer - seeking detection*/\r
- u32 last_unit_cts;\r
- /*in case the codec performs temporal re-ordering itself*/\r
- Bool is_reordering;\r
- u32 prev_au_size;\r
- u32 bytes_per_sec;\r
- Double fps;\r
-\r
- /*statistics*/\r
- u32 last_stat_start, cur_bit_size;\r
- u32 avg_bit_rate, max_bit_rate;\r
- u32 total_dec_time, nb_dec_frames, max_dec_time;\r
- /*number of droped frames*/\r
- u32 nb_droped;\r
-\r
- /*for CTS reconstruction (channels not using SL): we cannot just update timing at each frame, not precise enough \r
- since we use ms and not microsec TSs*/\r
- u32 cur_audio_bytes, cur_video_frames;\r
-};\r
-\r
-GF_Codec *gf_codec_new(GF_ObjectManager *odm, GF_ESD *base_layer, s32 PL, GF_Err *e);\r
-void gf_codec_del(GF_Codec *codec);\r
-GF_Err gf_codec_add_channel(GF_Codec *codec, GF_Channel *ch);\r
-/*returns TRUE if stream was present, false otherwise*/\r
-Bool gf_codec_remove_channel(GF_Codec *codec, GF_Channel *ch);\r
-GF_Err gf_codec_process(GF_Codec *codec, u32 TimeAvailable);\r
-GF_Err gf_codec_get_capability(GF_Codec *codec, GF_CodecCapability *cap);\r
-GF_Err gf_codec_set_capability(GF_Codec *codec, GF_CodecCapability cap);\r
-void gf_codec_set_status(GF_Codec *codec, u32 Status);\r
-/*returns a new codec using an existing loaded decoder - only used by private scene to handle != timelines, for \r
-instance when loading a BT with an animation stream*/\r
-GF_Codec *gf_codec_use_codec(GF_Codec *codec, GF_ObjectManager *odm);\r
-\r
-/*OD manager*/\r
-\r
-enum\r
-{\r
- /*flag set if object cannot be time-controloed*/\r
- GF_ODM_NO_TIME_CTRL = (1<<1),\r
- /*flag set if subscene uses parent scene timeline*/\r
- GF_ODM_INHERIT_TIMELINE = (1<<2),\r
- /*flag set if object has been redirected*/\r
- GF_ODM_REMOTE_OD = (1<<3),\r
- /*flag set if object has profile indications*/\r
- GF_ODM_HAS_PROFILES = (1<<4),\r
- /*flag set if object governs profile of inline subscenes*/\r
- GF_ODM_INLINE_PROFILES = (1<<5),\r
- /*flag set if object declared by network service, not from OD stream*/\r
- GF_ODM_NOT_IN_OD_STREAM = (1<<6),\r
-\r
- /*dynamic flags*/\r
- \r
- /*flag set if associated subscene must be regenerated*/\r
- GF_ODM_REGENERATE_SCENE = (1<<10),\r
-};\r
-\r
-enum\r
-{\r
- GF_ODM_STATE_STOP,\r
- GF_ODM_STATE_PLAY,\r
- GF_ODM_STATE_IN_SETUP,\r
- GF_ODM_STATE_BLOCKED,\r
-};\r
-\r
-struct _od_manager\r
-{\r
- /*pointer to terminal*/\r
- struct _tag_terminal *term;\r
- /*the service used by this ODM. If the service private data is this ODM, then the service was created for this ODM*/\r
- GF_ClientService *net_service;\r
- /*parent scene or NULL for root scene*/\r
- struct _inline_scene *parentscene;\r
- /*channels associated with this object (media channels, OCR, IPMP, OCI, etc)*/\r
- GF_List *channels;\r
- /*sub scene for inline/animation or NULL */\r
- struct _inline_scene *subscene;\r
- /*object codec (media or BIFS for AnimationStream) attached if any*/\r
- struct _generic_codec *codec;\r
- /*OCI codec attached if any*/\r
- struct _generic_codec *oci_codec;\r
- /*OCR codec attached if any*/\r
- struct _generic_codec *ocr_codec;\r
-\r
- /*MPEG-4 object descriptor*/\r
- GF_ObjectDescriptor *OD;\r
-\r
- /*exclusive access is required since rendering and media management don't always take place in the same thread*/\r
- GF_Mutex *mx;\r
-\r
- u32 flags;\r
-\r
- /*PLs*/\r
- u8 Audio_PL, Graphics_PL, OD_PL, Scene_PL, Visual_PL;\r
- \r
- /*interface with scene rendering*/\r
- struct _mediaobj *mo;\r
- \r
- /*number of channels with connection not yet acknowledge*/\r
- u32 pending_channels;\r
- u32 state;\r
- /* during playback: timing as evaluated by the composition memory or the scene codec */\r
- u32 current_time;\r
- /*full object duration 0 if unknown*/\r
- u64 duration;\r
- /*\r
- upon start: media start time as requested by scene compositor (eg not media control)\r
- set to -1 upon stop to postpone stop request\r
- */\r
- u64 media_start_time, media_stop_time;\r
-\r
- /*the one and only media control currently attached to this object*/\r
- struct _media_control *media_ctrl;\r
- /*the list of media control controling the object*/\r
- GF_List *mc_stack;\r
- /*the media sensor(s) attached to this object*/\r
- GF_List *ms_stack;\r
-};\r
-\r
-\r
-GF_ObjectManager *gf_odm_new();\r
-void gf_odm_del(GF_ObjectManager *ODMan);\r
-void gf_odm_lock(GF_ObjectManager *odm, u32 LockIt);\r
-\r
-/*setup service entry point*/\r
-void gf_odm_setup_entry_point(GF_ObjectManager *odm, const char *sub_url);\r
-/*setup OD*/\r
-void gf_odm_setup_object(GF_ObjectManager *odm, GF_ClientService *parent_serv);\r
-/*disctonnect OD and removes it if desired (otherwise only STOP is propagated)*/\r
-void gf_odm_disconnect(GF_ObjectManager *odman, Bool do_remove);\r
-/*setup an ESD*/\r
-GF_Err gf_odm_setup_es(GF_ObjectManager *odm, GF_ESD *esd, GF_ClientService *service, GF_MediaObject *sync_ref);\r
-/*removes an ESD (this destroys associated channel if any)*/\r
-void gf_odm_remove_es(GF_ObjectManager *odm, u16 ES_ID);\r
-/*set stream duration - updates object duration accordingly*/\r
-void gf_odm_set_duration(GF_ObjectManager *odm, GF_Channel *, u64 stream_duration);\r
-/*signals end of stream on channels*/\r
-void gf_odm_on_eos(GF_ObjectManager *odm, GF_Channel *);\r
-/*start Object streams and queue object for network PLAY*/\r
-void gf_odm_start(GF_ObjectManager *odm);\r
-/*stop OD streams*/\r
-void gf_odm_stop(GF_ObjectManager *odm, Bool force_close);\r
-/*send PLAY request to network - needed to properly handle multiplexed inputs \r
-ONLY called by service handler (media manager thread)*/\r
-void gf_odm_play(GF_ObjectManager *odm);\r
-\r
-/*returns 1 if this is a segment switch, 0 otherwise - takes care of object restart if segment switch*/\r
-Bool gf_odm_check_segment_switch(GF_ObjectManager *odm);\r
-/*pause object (mediaControl use only)*/\r
-void gf_odm_pause(GF_ObjectManager *odm);\r
-/*resume object (mediaControl use only)*/\r
-void gf_odm_resume(GF_ObjectManager *odm);\r
-/*set object speed*/\r
-void gf_odm_set_speed(GF_ObjectManager *odm, Fixed speed);\r
-/*returns the clock of the media stream (video, audio or bifs), NULL otherwise */\r
-struct _object_clock *gf_odm_get_media_clock(GF_ObjectManager *odm);\r
-/*adds segment descriptors targeted by the URL to the list and sort them - the input list must be empty*/\r
-void gf_odm_init_segments(GF_ObjectManager *odm, GF_List *list, MFURL *url);\r
-/*returns true if this OD depends on the given clock*/\r
-Bool gf_odm_shares_clock(GF_ObjectManager *odm, struct _object_clock *ock);\r
-\r
-GF_Segment *gf_odm_find_segment(GF_ObjectManager *odm, char *descName);\r
-/*locks ODM with destruction check - returns 0 if object manager is not attached to object*/\r
-Bool gf_odm_lock_mo(struct _mediaobj *mo);\r
-\r
-\r
-/*GF_MediaObject: link between real object manager and scene. although there is a one-to-one mapping between a \r
-MediaObject and an ObjectManager, we have to keep them seperated in order to handle OD remove commands which destroy\r
-ObjectManagers. */\r
-struct _mediaobj\r
-{\r
- /*type is as defined in constants.h # GF_MEDIA_OBJECT_* */\r
- u32 type;\r
- /*one of the above flags*/\r
- u32 flags;\r
-\r
-\r
- /* private to ESM*/\r
-\r
- /*media object manager - private to the sync engine*/\r
- struct _od_manager *odm;\r
- /*OD ID of the object*/\r
- u32 OD_ID;\r
- /*OD URL for object not using MPEG4 OD urls*/\r
- MFURL URLs;\r
- /*session join*/\r
- u32 num_open;\r
- /*shared object restart handling*/\r
- u32 num_to_restart, num_restart;\r
- Fixed speed;\r
-\r
- /*shared object info: if 0 a new frame will be checked, otherwise current is returned*/\r
- u32 nb_fetch;\r
- /*frame presentation time*/\r
- u32 timestamp;\r
- /*data frame size*/\r
- u32 framesize;\r
- /*pointer to data frame */\r
- char *frame;\r
- /*nodes currently registered with the media object - used to dispatch MediaAccessEvents*/\r
- GF_List *nodes;\r
- /*pointer to the node responsible for the creation of this media object\r
- ONLY used for scene media type (animationStreams) \r
- Reset upon creation of the decoder.\r
- */\r
- void *node_ptr;\r
-};\r
-\r
-GF_MediaObject *gf_mo_new();\r
-\r
-\r
-/*used for delayed channel setup*/\r
-typedef struct \r
-{\r
- struct _generic_codec *dec;\r
- struct _es_channel *ch; \r
-} GF_ChannelSetup;\r
-\r
-/*post-poned channel connect*/\r
-GF_Err gf_odm_post_es_setup(struct _es_channel *ch, struct _generic_codec *dec, GF_Err err);\r
-\r
-/*\r
- special entry point: specify directly a service interface for service input\r
-*/\r
-void gf_term_attach_service(GF_Terminal *term, GF_InputService *service_hdl);\r
-\r
-/*media access events */\r
-void gf_term_service_media_event(GF_ObjectManager *odm, u32 event_type);\r
-\r
-u32 URL_GetODID(MFURL *url);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-\r
-#endif /*_GF_TERMINAL_DEV_H_*/\r
-\r
-\r