📄 service.h
字号:
/* * GPAC - Multimedia Framework C SDK * * Copyright (c) Jean Le Feuvre 2000-2005 * All rights reserved * * This file is part of GPAC / modules interfaces * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * GPAC is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */#ifndef _GF_SERVICE_H_#define _GF_SERVICE_H_#ifdef __cplusplusextern "C" {#endif/*for SL, ESD and OD*/#include <gpac/mpeg4_odf.h>#include <gpac/download.h>/*handle to service*/typedef struct _net_service GF_ClientService;/*handle to channel*/typedef void *LPNETCHANNEL;enum{ /*channel control, app->module. Note that most modules don't need to handle pause/resume/set_speed*/ GF_NET_CHAN_PLAY, GF_NET_CHAN_STOP, GF_NET_CHAN_PAUSE, GF_NET_CHAN_RESUME, GF_NET_CHAN_SET_SPEED, /*channel configuration, app->module*/ GF_NET_CHAN_CONFIG, /*channel duration, app<->module (in case duration is not known at setup)*/ GF_NET_CHAN_DURATION, /*channel buffer, app->module*/ GF_NET_CHAN_BUFFER, /*channel buffer query, app<-module*/ GF_NET_CHAN_BUFFER_QUERY, /*retrieves DSI from channel (DSI may be caried by net with a != value than OD), app->module*/ GF_NET_CHAN_GET_DSI, /*set media padding for all AUs fetched (pull mode only). If not supported the channel will have to run in push mode. app->module*/ GF_NET_CHAN_SET_PADDING, /*sets input channel to pull mode if possible, app->module*/ GF_NET_CHAN_SET_PULL, /*query channel capability to pause/resume and seek(play from an arbitrary range) a non-interactive channel doesn't have to handle SET_SPEED, PAUSE and RESUME commands but can still work in pull mode*/ GF_NET_CHAN_INTERACTIVE, /*map net time (OTB) to media time (up only) - this is needed by some signaling protocols when the real play range is not the requested one */ GF_NET_CHAN_MAP_TIME, /*reconfiguration of channel comming from network (up only) - this is used to override the SL config if it differs from the one specified at config*/ GF_NET_CHAN_RECONFIG, /*signal channel is ISMACryp'ted (net->term only)*/ GF_NET_CHAN_DRM_CFG, /*retrieves ESD for channel - net->term only, for cache configuration*/ GF_NET_CHAN_GET_ESD, /*service buffer query (for all channels running in service), app<-module*/ GF_NET_BUFFER_QUERY, /*retrieves network stats for service/channel; app->module*/ GF_NET_GET_STATS, /*retrieves whether service can be cached (rtp, http streaming radios, etc) or not. No associated struct*/ GF_NET_IS_CACHABLE, /*sets info for service - net->term only*/ GF_NET_SERVICE_INFO, /*checks if there is an audio stream in the service - term->net only*/ GF_NET_SERVICE_HAS_AUDIO,};/*channel command for all commands that don't need params:GF_NET_CHAN_SET_PULL: module shall return GF_OK or GF_NOT_SUPPORTEDGF_NET_CHAN_INTERACTIVE: module shall return GF_OK or GF_NOT_SUPPORTED*/typedef struct{ /*command type*/ u32 command_type; /*channel*/ LPNETCHANNEL on_channel;} GF_NetComBase;/*GF_NET_CHAN_PLAY, GF_NET_CHAN_SET_SPEED*/typedef struct{ u32 command_type; LPNETCHANNEL on_channel; /*params for GF_NET_CHAN_PLAY, ranges in sec - if range is <0, then it is ignored (eg [2, -1] with speed>0 means 2 +oo) */ Double start_range, end_range; /*params for GF_NET_CHAN_PLAY and GF_NET_CHAN_SPEED*/ Double speed;} GF_NetComPlay;/*GF_NET_CHAN_CONFIG, GF_NET_CHAN_RECONFIGchannel config may happen as soon as the channel is open, even if the module hasn't acknowledge creationchannel config can also be used from network to app, with GF_NET_CHAN_RECONFIG type - only the SL config is then used*/typedef struct{ u32 command_type; LPNETCHANNEL on_channel; /*SL config of the stream as delivered in OD (app->channel) or by network (channel->app)*/ GF_SLConfig sl_config; /*stream priority packet drops are more tolerable if low priority - app->channel only*/ u32 priority; /*sync ID: all channels with the same sync ID run on the same timeline, thus the module should try to match this - note this may not be possible (typically RTP/RTSP)*/ u32 sync_id; /*audio frame duration and sample rate if any - this is needed by some RTP payload*/ u32 frame_duration, sample_rate;} GF_NetComConfig;/*GF_NET_CHAN_BUFFER, GF_NET_CHAN_BUFFER_QUERY*/typedef struct{ u32 command_type; LPNETCHANNEL on_channel; /*the recommended buffering limits in ms - this depends on the modules preferences and on the service type (multicast, vod, ...) - below buffer_min the stream will pause if possible until buffer_max is reached note the app will fill in default values before querying*/ u32 min, max; /*only used with GF_NET_CHAN_BUFFER_QUERY - amount of media in decoding buffer, in ms*/ u32 occupancy;} GF_NetComBuffer;/*GF_NET_CHAN_DURATION*/typedef struct{ u32 command_type; LPNETCHANNEL on_channel; /*duration in sec*/ Double duration;} GF_NetComDuration;/*GF_NET_CHAN_GET_DSI*/typedef struct{ u32 command_type; LPNETCHANNEL on_channel; /*carries specific info for codec - data shall be allocated by service and is freed by user*/ char *dsi; u32 dsi_len;} GF_NetComGetDSI;/*GF_NET_CHAN_SET_PADDING*/typedef struct{ u32 command_type; LPNETCHANNEL on_channel; u32 padding_bytes;} GF_NetComPadding;/*GF_NET_CHAN_MAP_TIME*/typedef struct{ u32 command_type; LPNETCHANNEL on_channel; /*MediaTime at this timestamp*/ Double media_time; /*TS where mapping is done (in SL TS resolution)*/ u64 timestamp; /*specifies whether decoder input data shall be discarded or only have its timing updated*/ Bool reset_buffers;} GF_NetComMapTime;/*GF_NET_CHAN_ISMACRYP_CFG*/typedef struct{ u32 command_type; LPNETCHANNEL on_channel; /*per channel, regardless of DRM schemes (ISMA, OMA, )*/ u32 scheme_version; u32 scheme_type; const char *scheme_uri; const char *kms_uri; /*OMA DRM info*/ const char *contentID; u32 oma_drm_crypt_type; Bool oma_drm_use_pad, oma_drm_use_hdr; const char *oma_drm_textual_headers; u32 oma_drm_textual_headers_len; /*SHA-1 file hash*/ u8 hash[20];} GF_NetComDRMConfig;/*GF_NET_CHAN_GET_ESD*/typedef struct{ u32 command_type; LPNETCHANNEL on_channel; const GF_ESD *esd; Bool is_iod_stream;} GF_NetComGetESD;/*GF_NET_GET_STATSNotes1: only channels using network must reply. All channels fetching data through a
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -