1/*
2\file
3\brief silence !
4*/
5
6typedef char *DOMString;
7
8/*!
9
10\defgroup jsf_grp JS Filter API
11\ingroup jsapi_grp
12\brief JavaScript API for filters.
13
14This section documents the JavaScript API used when developing JavaScript-based filters.
15JavaScript filters support all tools from native filters, see \ref filters_grp.
16
17Errors are handled through exceptions, except for callback function return values of the Filter object.
18
19@{
20
21*/
22
23/*! global context property containing the launch arguments*/
24attribute Array args;
25
26/*! global context property representing the one and only JSFilter object attached to the loaded filter*/
27attribute JSFilter filter;
28
29/*! global context function for printing
30\param log the string to write
31*/
32void print(DOMString log);
33/*! global context function for printing
34\param log_level the log level to use: GF_LOG_DEBUG, GF_LOG_INFO, GF_LOG_WARNING, GF_LOG_ERROR. The special value -2 means print as gf_sys_format_help without highlight, the special value -1 means print as gf_sys_format_help with hightlight of first)
35\param log_str the string to write
36*/
37void print(long log_level, DOMString log_str);
38
39
40/*!\brief JSFilter API
41
42The JSFilter interface has a single instance exposed to the script under the name "filter".
43It implements binding to the underlying filter object, see \ref GF_Filter.
44The JSFilter provides callback functions mapping the functionnalities of \ref __gf_filter_register.
45*/
46interface JSFilter {
47/*! initialize the filter. This is a callback function assignable by the script. It is called once all filter arguments have been parsed.
48See \ref __gf_filter_register.initialize.
49\return error code if any
50*/
51attribute GF_Err initialize();
52/*! finalize the filter. This is a callback function assignable by the script. It is called immediately before destruction of the JavaScript context.
53See \ref __gf_filter_register.finalize.
54\return void
55*/
56attribute void finalize();
57/*! configures or reconfigures an input pid
58See \ref __gf_filter_register.configure_pid.
59\param pid pid to (re)configure
60\return error code if any
61*/
62attribute GF_Err configure_pid(FilterPid pid);
63/*! removes an input pid
64See \ref __gf_filter_register.configure_pid.
65\param pid pid to remove
66\return error code if any
67*/
68attribute GF_Err remove_pid(FilterPid pid);
69/*! process
70See \ref __gf_filter_register.process.
71\return error code if any
72*/
73attribute GF_Err process();
74/*! process an event on a given pid
75See \ref __gf_filter_register.process_event.
76\param pid pid on which the event is received
77\param evt event tp process
78\return error code if any
79*/
80attribute boolean process_event(FilterPid pid, FilterEvent evt);
81/*! process an event on a given pid
82See \ref __gf_filter_register.process_event.
83\param arg_name argument name
84\param arg_val argument value
85\return error code if any
86*/
87attribute GF_Err update_arg(DOMString arg_name, DOMString arg_val);
88
89/*! see \ref gf_filter_get_max_extra_input_pids*/
90attribute long max_pids;
91/*! see \ref gf_filter_block_enabled*/
92readonly attribute boolean block_enabled;
93/*! see \ref gf_filter_get_output_buffer_max*/
94readonly attribute unsigned long output_buffer;
95/*! see \ref gf_filter_get_output_buffer_max*/
96readonly attribute unsigned long output_playout;
97/*! see \ref gf_filter_get_sep*/
98readonly attribute DOMString sep_args;
99/*! see \ref gf_filter_get_sep*/
100readonly attribute DOMString sep_name;
101/*! see \ref gf_filter_get_sep*/
102readonly attribute DOMString sep_list;
103/*! see \ref gf_filter_get_dst_args*/
104readonly attribute DOMString dst_args;
105/*! see \ref gf_filter_get_dst_name*/
106readonly attribute DOMString dst_name;
107/*! see \ref gf_filter_all_sinks_done*/
108readonly attribute boolean sinks_done;
109/*! see \ref gf_filter_reporting_enabled*/
110attribute boolean reports_on;
111/*! see \ref gf_filter_get_session_caps and \ref gf_filter_set_session_caps*/
112attribute unsigned long max_screen_width;
113/*! see \ref gf_filter_get_session_caps and \ref gf_filter_set_session_caps*/
114attribute unsigned long max_screen_height;
115/*! see \ref gf_filter_get_session_caps and \ref gf_filter_set_session_caps*/
116attribute unsigned long max_screen_depth;
117/*! see \ref gf_filter_get_session_caps and \ref gf_filter_set_session_caps*/
118attribute unsigned long max_screen_fps;
119/*! see \ref gf_filter_get_session_caps and \ref gf_filter_set_session_caps*/
120attribute unsigned long max_screen_views;
121/*! see \ref gf_filter_get_session_caps and \ref gf_filter_set_session_caps*/
122attribute unsigned long max_audio_channels;
123/*! see \ref gf_filter_get_session_caps and \ref gf_filter_set_session_caps*/
124attribute unsigned long max_audio_samplerate;
125/*! see \ref gf_filter_get_session_caps and \ref gf_filter_set_session_caps*/
126attribute unsigned long max_audio_depth;
127/*! see \ref gf_filter_get_num_events_queued*/
128readonly attribute unsigned long events_queued;
129/*! see \ref gf_filter_get_clock_hint*/
130readonly attribute unsigned long long readonly clock_hint_us;
131/*! see \ref gf_filter_get_clock_hint*/
132readonly attribute unsigned long long clock_hint_mediatime;
133/*! see \ref gf_filter_connections_pending*/
134readonly attribute unsigned long long connections_pending;
135
136/*! sets filter desciption as visible when checking filter info
137\param description description of filter*/
138void set_desc(DOMString description);
139/*! sets filter author as visible when checking filter info
140\param author author of filter*/
141void set_author(DOMString author);
142/*! sets filter version as visible when checking filter info
143\param version version of filter*/
144void set_version(DOMString version);
145/*! sets filter help as visible when checking filter info
146\param help help of filter - can use the usual MarkDown syntax of GPAC help*/
147void set_help(DOMString help);
148
149/*! adds an argument to the filter. JavaScript Filter arguments can be specified from command line in the same way as reguar filters.
150The argument is then exposed as a property of the "filter" object of the javascript context.
151\param arg object exposing the same interface as the JSArgDesc interface
152*/
153void set_arg(JSArgDesc arg);
154
155/*! sets a new capability for the filter. If no argument, starts a new capability bundle.
156\param cap_desc capability descriptor object
157*/
158void set_cap(optional JSCapDesc cap_desc = null);
159
160/*! sets the name of the filter, used for logs
161\param name the filter name
162*/
163void set_name(DOMString name)
164/*! creates a new PID - see \ref gf_filter_pid_new
165\return the new PID object
166*/
167FilterPid new_pid();
168/*! sends an event on the filter - see \ref gf_filter_send_event
169\param evt the event to send
170\param upstream sends the evnet upstream
171*/
172void send_event(FilterEvent evt, optional boolean upstream=false);
173
174/*! queries info on a filter
175 an event on the filter - see \ref gf_filter_get_info and \ref gf_filter_get_info_str
176\param info_name the property name or ID of the info to query
177\param is_string indicate if the name describes a built-in property or a user-defined property
178\return the property if found, null otherwise
179*/
180FilterProperty get_info(DOMString info_name, optional boolean is_string = false);
181
182/*! checks if a MIME type is supported - see \ref gf_filter_is_supported_mime
183\param mime the mime type to query
184\return true if supported
185*/
186boolean is_supported_mime(DOMStrin mime);
187
188/*! disables data probing  if a MIME type is supported - see \ref gf_filter_is_supported_mime
189\param mime the mime type to query
190\return true if supported
191*/
192boolean is_supported_mime(DOMStrin mime);
193
194/*! update filter status string - see \ref gf_filter_update_status
195\param status the status string, may be null to reset the status string
196\param percent percent of processing, if known
197*/
198void update_status(DOMString status, optional long percent=0);
199
200/*! reschedule filter - see \ref gf_filter_ask_rt_reschedule and \ref gf_filter_post_process_task
201\param reschedule_us if not 0, reschedule the filter in the given amount of microseconds. Otherwise post a filter processing task*/
202void reschedule(optional long reschedule_us=0);
203
204
205/*! posts a task to the main scheduler - see \ref gf_filter_post_task
206\param task_callback the callback function to use. This callback returns -1 or an exception to abort the task, or a reschedule time in milliseconds
207\param task_this optional value for this object of the callback function. If not set, the filter object is used
208*/
209void post_task(function task_callback, optional Object task_this=null);
210
211/*! notify a failure of the filter upon source connections - see \ref gf_filter_notification_failure, \ref gf_filter_notification_failure
212\param error the error code
213\param error_type the type of notification.\n
214- If JSF_NOTIF_ERROR_AND_DISCONNECT, calls \ref gf_filter_notification_failure and disconnect the filter
215- If JSF_NOTIF_ERROR, calls \ref gf_filter_notification_failure and does not disconnect the filter
216- If JSF_SETUP_ERROR, calls \ref gf_filter_setup_failure
217*/
218void notify_failure(GF_Err error, optional long error_type=JSF_SETUP_ERROR);
219
220/*! checks if a MIME type is supported - see \ref gf_filter_is_supported_mime
221\param source_url the URL to check
222\return true if supported
223*/
224boolean is_supported_source(DOMString source_url);
225
226/*! checks if a MIME type is supported - see \ref gf_filter_hint_single_clock
227\param time_in_microseconds time in microseconds
228\param media_time_sec media timestamp inseconds
229*/
230void hint_clock(unsigned long long time_in_microseconds, double media_time_sec);
231
232/*! sends an update to a filter - see \ref gf_filter_send_update
233\param filter_id ID of the filter
234\param arg_name name of the argument
235\param arg_value value of the argument
236\param propagate_mask propagate mask
237*/
238void send_update(DOMString filter_id, DOMString arg_name, DOMString arg_value, long propagate_mask);
239
240/*! adds a source filter in the media session - see \ref gf_filter_connect_source
241\param source URL of source to load
242\param parent URL of parent, used as baseURL for the source. May be NULL
243\return new loaded source filter or null
244*/
245FilterInstance add_source(DOMString source, optional DOMString parent = null);
246
247/*! adds a destination filter in the media session - see \ref gf_filter_connect_destination
248\param destination URL of destination to instantiate
249\param mux_mime mime identifying destination format. If not set or null, format will be guessed from URL
250\return new loaded destination filter or null
251*/
252FilterInstance add_destination(DOMString destination, optional DOMString mux_mime=null);
253
254/*! loads a new filter in the media session - see \ref gf_filter_load_filter
255\param args name and arguments of the filter to load
256\return new loaded filter or null
257*/
258FilterInstance add_filter(DOMString args);
259
260/*! makes the filter sticky - see \ref gf_filter_make_sticky*/
261void make_sticky();
262
263/*! makes the filter unblocking - see \ref gf_filter_prevent_blocking
264\param do_prevent if true, filter will not be blocking if all its output pids are blocking
265*/
266void prevent_blocking(boolean do_prevent);
267
268/*! makes the filter prevent EOS queries - see \ref gf_filter_block_eos
269\param do_block if true, filter input pids cannot be checked for end of stream during EOS queries
270*/
271void prevent_blocking(boolean do_block);
272
273};
274
275/*! FilterInstance wraps the set of functions available for filters loaded by the script*/
276interface FilterInstance {
277
278/*! setup failure notification. This is a callback function assignable by the script. It is when loading a source or destination filter fails asynchronously
279\param e error code if any
280\return void
281*/
282attribute void on_setup_failure(GF_Err e);
283
284/*! sends an event on the filter - see \ref gf_filter_send_event
285\param evt the event to send
286*/
287void send_event(FilterEvent evt);
288
289/*! queries info on a filter
290 an event on the filter - see \ref gf_filter_get_info and \ref gf_filter_get_info_str
291\param info_name the property name or ID of the info to query
292\param is_string indicate if the name describes a built-in property or a user-defined property
293\return the property if found, null otherwise
294*/
295FilterProperty get_info(DOMString info_name, optional boolean is_string = false);
296
297/*! sends an update to a filter - see gf_filter_send_update
298\param filter_id ID of the filter
299\param arg_name name of the argument
300\param arg_value value of the argument
301\param propagate_mask propagate mask
302*/
303void send_update(DOMString filter_id, DOMString arg_name, DOMString arg_value, long propagate_mask);
304
305/*! assigns source name to a filter - see \ref gf_filter_set_source
306\param from a Filter or a FilterInstance object to set a a source for this filter
307\param source_id the source ID to assign
308*/
309void set_source(Filter from, optional DOMString source_id=null);
310
311/*! removes a source filter - see \ref gf_filter_remove_src*/
312void remove();
313
314/*! checks if a filter and its connected output chain(s) have PID connection pending
315\param stop_at a Filter or a FilterInstance object indicating where to stop the analysis. If not set and the filter is a source filter, automatically set to the Filter running the script
316\return true if pid connections are pending
317*/
318boolean has_pid_connections_pending(optional Filter stop_at=null);
319
320/*! gets the value of a filter instance argument
321\param arg_name the argument name to query
322\param as_string if true, returns the value as a string, otherwise as a property object
323\return the argument value as string or object, or null if no such argument*/
324FilterProperty get_arg(DOMString arg_name, optional boolean as_string=false);
325
326/*! disables data probing on the filter - see \ref gf_filter_disable_probe*/
327void disable_probe();
328
329/*! disables input on the filter - see \ref gf_filter_disable_inputs*/
330void disable_inputs();
331
332/*! reset source identifier for the filter - see \ref gf_filter_reset_source*/
333void reset_source();
334};
335
336/*! The FilterPid object is a binding for \ref GF_FilterPid*/
337interface FilterPid {
338
339/*! name of the PID*/
340attribute DOMString name;
341/*! end of stream state - see \ref gf_filter_pid_set_eos and \ref gf_filter_pid_is_eos*/
342attribute boolean eos;
343/*! end of stream pending state - see \ref gf_filter_pid_has_seen_eos*/
344readonly attribute boolean eos_seen;
345/*! blocking state - see \ref gf_filter_pid_would_block*/
346readonly attribute boolean would_block;
347/*! name of parent filter*/
348readonly attribute DOMString filter_name;
349/*! name of source filter*/
350readonly attribute DOMString src_name;
351/*! arguments of parent filter*/
352readonly attribute DOMString args;
353/*! argument of source filter*/
354readonly attribute DOMString src_args;
355/*! max buffer requirement of the pid - see \ref gf_filter_pid_get_max_buffer and \ref gf_filter_pid_set_max_buffer*/
356attribute long max_buffer;
357/*! enables loose connect of the pid - see \ref gf_filter_pid_set_loose_connect*/
358writeonly boolean loose_connect;
359/*! sets framin mode of the pid - see \ref gf_filter_pid_set_framing_mode*/
360writeonly boolean framing;
361/*! buffer duration of the pid - see \ref gf_filter_pid_query_buffer_duration*/
362readonly attribute long long buffer;
363/*! pid buffer full flag - see \ref gf_filter_pid_query_buffer_duration */
364readonly attribute boolean full;
365/*! indicates if no valid packet with data is pending - see \ref gf_filter_pid_first_packet_is_empty*/
366readonly attribute boolean first_empty;
367/*! CTS of the first packet in packet queue - see \ref gf_filter_pid_get_first_packet_cts*/
368readonly attribute long long first_cts;
369/*! number of packets in pid buffer - see \ref gf_filter_pid_get_packet_count*/
370readonly attribute unsigned long nb_pck_queued;
371/*! current timescale for the pid - see \ref gf_filter_pid_get_timescale */
372readonly attribute unsigned long timescale;
373/*! sets clock mode of pid - see \ref gf_filter_pid_set_clock_mode*/
374writeonly unsigned long clock_mode;
375/*! sets discard mode of pid - see \ref gf_filter_pid_set_discard*/
376writeonly unsigned boolean discard;
377/*! source URL of input pids*/
378readonly attribute DOMString src_url;
379/*! destination URL of output pids*/
380readonly attribute DOMString dst_url;
381/*! requires source ID for the pid - see \ref gf_filter_pid_require_source_id*/
382writeonly unsigned boolean require_source_id;
383/*! enables DTS recomputing on the pid - see \ref gf_filter_pid_recompute_dts*/
384writeonly unsigned boolean recompute_dts;
385/*! gets minimum packet duration observed on the pid - see \ref gf_filter_pid_get_min_pck_duration*/
386readonly attribute unsigned long min_pck_dur;
387/*! playing state - see \ref gf_filter_pid_is_playing*/
388readonly attribute unsigned long playing;
389
390/*! sends an event on the pid - see \ref gf_filter_pid_send_event
391\param evt the event to send*/
392void send_event(FilterEvent evt);
393
394/*! enumerates properties or info on the pid - see \ref gf_filter_pid_enum_properties and \ref gf_filter_pid_enum_info
395\param index the 0-based index of the property.
396\param enum_info if set, enumerates info instead of properties
397\return null if no more properties to enumerate; otherwise an object:
398\code
399{
400   DOMString name;
401   unsigned long type;
402   FilterProperty value;
403}
404\endcode
405
406*/
407Object enum_properties(unsigned long index, optional boolean enum_info=false);
408
409/*! gets a property by name/id - see \ref gf_filter_pid_get_property and \ref gf_filter_pid_get_property_str
410\param name the ID or name of the builtin property
411\param is_user if set, indicates the queried property is a user-defined property rather than a built-in property
412\return property if found, null otherwise
413*/
414FilterProperty get_prop(DOMString name, optional boolean is_user=false);
415
416/*! gets info by name/id - see \ref gf_filter_pid_get_info and \ref gf_filter_pid_get_info_str
417\param name the ID or name of the builtin property
418\param is_user if set, indicates the queried property is a user-defined property rather than a built-in property
419\return the property if found, null otherwise
420*/
421FilterProperty get_info(DOMString name, optional boolean is_user=false);
422
423/*! gets first packet in pid buffer - see \ref gf_filter_pid_get_packet
424\return first packet of buffer or null*/
425FilterPaquet get_packet();
426/*! drops first packet in pid buffer - see \ref gf_filter_pid_drop_packet
427*/
428void drop_packet();
429
430/*! checks if a filter is in parent chain of pid - see \ref gf_filter_pid_get_buffer_occupancy
431\param filter filter to check
432\return true if in parent chain*/
433boolean is_filter_in_parents(GF_Filter filter);
434
435/*! gets buffer occupancy - see \ref gf_filter_pid_is_filter_in_parents
436\param filter the Filter or FilterInstance object to check
437\return a buffer occupancy object:
438\code
439{
440   unsigned long max_units;
441   unsigned long nb_pck;
442   unsigned long max_dur;
443   unsigned long dur;
444   boolean final_flush;
445}
446\endcode
447*/
448boolean is_filter_in_parents(GF_Filter filter);
449
450/*! clears EOS on pid - see \ref gf_filter_pid_clear_eos*/
451void clear_eos();
452
453/*! clears capability of pid - see \ref gf_filter_pid_check_caps
454\return true if all caps are honored by the PID properties, false otherwise*/
455boolean check_caps();
456/*! discard blocking mode of pid - see \ref gf_filter_pid_discard_block*/
457void discard_block();
458
459/*! allow direct disatch to next filter in chain - see \ref gf_filter_pid_allow_direct_dispatch*/
460void allow_direct_dispatch();
461
462/*! resolves a file template string - see \ref gf_filter_pid_resolve_file_template
463\param template the template string to resolve
464\param file_idx the file index for segmented outputs
465\param suffix the file suffix to append
466\return the resolved template
467*/
468DOMString resolve_file_template(DOMString template, unsigned long file_idx, optional DOMString suffix=null);
469
470/*! queries a capability marked for negotiation - see \ref gf_filter_pid_caps_query
471\param name the ID or name of the builtin property
472\param is_user if set, indicates the queried property is a user-defined property rather than a built-in property
473\return property if found, null otherwise*/
474FilterProperty query_caps(DOMString name, optional boolean is_user);
475
476
477/*! gets statistics for the pid
478\return A statistics object
479\code
480boolean disconnected;
481unsigned long average_process_rate;
482unsigned long max_process_rate;
483unsigned long avgerage_bitrate;
484unsigned long max_bitrate;
485unsigned long nb_processed;
486unsigned long max_process_time;
487unsigned long long total_process_time;
488unsigned long long first_process_time;
489unsigned long long last_process_time;
490unsigned long min_frame_dur;
491unsigned long nb_saps;
492unsigned long max_sap_process_time;
493unsigned long long total_sap_process_time;
494unsigned long long max_buffer_time;
495unsigned long long max_playout_time;
496unsigned long long min_playout_time;
497unsigned long long buffer_time;
498unsigned long nb_buffer_units;
499\endcode
500*/
501Object get_stats();
502
503/*! gets clock info for the pid
504\return A clock info object:
505\code
506unsigned long type;
507unsigned long timescale;
508unsigned long long value;
509\endcode
510*/
511Object get_clock_info();
512
513/*! sets property on a pid - see \ref gf_filter_pid_set_property and \ref gf_filter_pid_set_property_str
514\param name the ID or name of the builtin property
515\param prop the property to set
516\param is_user if set, indicates the queried property is a user-defined property rather than a built-in property
517*/
518void set_prop(DOMString name, FilterProperty prop, optional boolean is_user=false);
519
520/*! sets info on a pid - see \ref gf_filter_pid_set_info and \ref gf_filter_pid_set_info_str
521\param name the ID or name of the builtin property
522\param prop the property to set
523\param is_user if set, indicates the queried property is a user-defined property rather than a built-in property
524*/
525void set_info(DOMString name, FilterProperty prop, optional boolean is_user=false);
526
527/*! negociates property on an output pid - see \ref gf_filter_pid_negociate_property and \ref gf_filter_pid_negociate_property_str
528\param name the ID or name of the builtin property
529\param prop the property to set
530\param is_user if set, indicates the queried property is a user-defined property rather than a built-in property
531*/
532void negociate_prop(DOMString name, FilterProperty prop, optional boolean is_user=false);
533/*! removes an output pid - see \ref gf_filter_pid_remove*/
534void remove();
535
536/*! reset properties of a pid - see gf_filter_pid_reset_properties*/
537void reset_props();
538
539/*! copy properties of a pid - see gf_filter_pid_copy_properties*
540\param from source pid
541*/
542void copy_props(FilterPid from);
543
544/*! creates a new output packet with no associated data
545\return new packet or null*/
546FilterPacket new_packet();
547
548/*! creates a new output packet using string as payload
549\param str the string to use
550\param use_shared creates a shared packet, holding a GC reference to the string until release - see gf_filter_pck_new_shared
551\param destroy_callback_fun when shared mode is used, specify a callback function to be used upon destruction of the packet. The function takes no parameter and uses the pid as this object
552\return new packet or null*/
553FilterPacket new_packet(DOMString str, optional boolean use_shared=false, optional function destroy_callback_fun=null);
554
555/*! creates a new output packet of the given size, zero the payload
556\param size the desired size
557\return new packet or null*/
558FilterPacket new_packet(unsigned long size);
559
560/*! creates a new output packet using ArrayBuffer as payload
561\param ab the ArrayBuffer to use (views are also allowed)
562\param use_shared creates a shared packet, holding a GC reference to the array buffer until release - see gf_filter_pck_new_shared
563\param destroy_callback_fun when shared mode is used, specify a callback function to be used upon destruction of the packet. The function takes no parameter and uses the pid as this object
564\return new packet or null*/
565FilterPacket new_packet(ArrayBuffer ab, optional boolean use_shared=false, optional function destroy_callback_fun=null);
566
567
568/*! creates a new output packet from a source packet
569\param pck the source packet to use
570\param use_shared creates a shared packet - see gf_filter_pck_new_shared
571\param do_copy if set, indicates that the packet shall be copied rather than cloned (\ref gf_filter_pck_new_copy) otherwise clones the packet (\ref gf_filter_pck_new_clone). Ignored if use_shared is true
572\return new packet or null
573*/
574FilterPacket new_packet(FilterPacket pck, optional boolean use_shared=false, optional boolean do_copy=false);
575
576
577/*! creates a new output packet from a source packet
578\param pck the source packet to use
579\param use_shared creates a shared packet - see gf_filter_pck_new_shared
580\param destroy_callback_fun when shared mode is used, specify a callback function to be used upon destruction of the packet. The function takes no parameter and uses the pid as this object. Ignored if use_shared is false
581\return new packet or null
582*/
583FilterPacket new_packet(FilterPacket pck, optional boolean use_shared=false, optional function destroy_callback_fun=false);
584
585
586/*! forwards a source packet to outout - see \ref gf_filter_pck_forward
587\param pck the source packet to forward
588*/
589void forward(FilterPacket pck);
590
591};
592
593/*! FilterPacket provides binding for \ref GF_FilterPacket
594
595Packet data is made accessible through an ArrayBuffer object. This object is destroyed when truncating or expanding the data, you must get it again using pck.data.
596*/
597interface FilterPacket {
598/*!start flag*/
599attribute boolean start;
600/*!end flag*/
601attribute boolean end;
602/*!DTS*/
603attribute signed long long dts;
604/*!CTS*/
605attribute signed long long cts;
606/*!duration*/
607attribute unsigned long dur;
608/*!SAP type \ref GF_FilterSAPType*/
609attribute unsigned long sap;
610/*! timescale*/
611attribute unsigned long timescale;
612/*! interlaced flag*/
613attribute boolean interlaced;
614/*! corrupted flag*/
615attribute boolean corrupted;
616/*! seek flag*/
617attribute boolean seek;
618/*! byte offset in source*/
619attribute signed long long byte_offset;
620/*! roll distance*/
621attribute unsigned long roll;
622/*! crypt flag*/
623attribute unsigned long crypt;
624/*! clock type*/
625attribute unsigned long clock_type;
626/*! carousel version number*/
627attribute unsigned long carousel;
628/*! sequence number*/
629attribute unsigned long seqnum;
630/*! set if the packet is a blocking reference to a packet reference*/
631attribute boolean blocking_ref;
632/*! see \ref gf_filter_pck_set_dependency_flags*/
633attribute unsigned long is_leading;
634/*! see \ref gf_filter_pck_set_dependency_flags*/
635attribute unsigned long depends_on;
636/*! see \ref gf_filter_pck_set_dependency_flags*/
637attribute unsigned long depended_on;
638/*! see \ref gf_filter_pck_set_dependency_flags*/
639attribute unsigned long redundant;
640/*! size in bytes of the packet*/
641readonly attribute unsigned long size;
642/*! data of the packet if any
643	\warning This arraybuffer will be detached whenever the packet data is modified for a destination packet
644*/
645readonly attribute ArrayBuffer data;
646/*! set to true if data of the packet is available through a GF_FilterFrameInterface object*/
647readonly attribute boolean frame_ifce;
648
649/*! sets packet readonly - see gf_filter_pck_set_readonly*/
650void set_readonly();
651
652
653/*! enumerates properties of the packet
654
655\param index the 0-based index of the property.
656\return null if no more properties to enumerate; otherwise an object:
657\code
658{
659   DOMString name;
660   unsigned long type;
661   FilterProperty value;
662}
663\endcode
664
665*/
666Object enum_properties(unsigned long index);
667
668
669/*! gets a property by name/id - see \ref gf_filter_pid_get_property and \ref gf_filter_pid_get_property_str
670\param name the ID or name of the builtin property
671\param is_user if set, indicates the queried property is a user-defined property rather than a built-in property
672\return property if found, null otherwise*/
673FilterProperty get_prop(DOMString name, optional boolean is_user=false);
674
675/*! references a filter packet reference for later usage after drop from pid buffer - see \ref gf_filter_pck_ref and \ref gf_filter_pck_ref_props
676\param props_only if set, only packet properties are references, packet data is not
677\return the new packet reference*/
678FilterPacket ref(optional boolean props_only=false);
679
680/*! dereferences a filter packet reference - see gf_filter_pck_unref. Throws exception if object is not a packet reference. The object is no longer a valid packet after this.*/
681void unref();
682
683/*! sends packet - gf_filter_pck_send*/
684void send();
685
686/*! discard packet - gf_filter_pck_discard*/
687void discard();
688
689/*! sets a property on packet - see \ref gf_filter_pck_set_property
690\param name the ID or name of the builtin property
691\param is_user if set, indicates the queried property is a user-defined property rather than a built-in property
692*/
693void set_prop(DOMString name, optional boolean is_user=false);
694
695/*! appends data to packet - see \ref gf_filter_pck_expand. New data can be accessed by through the data field.
696\warning any previous access to the packet data will be in detached state (no more data in the array buffer) after the call.
697\param str the string to append
698\return an arraybuffer containing the corresponding appended packet data. Full packet data is available through FilterPacket.data
699*/
700ArrayBuffer append(DOMString str);
701
702/*! appends data to packet - see \ref gf_filter_pck_expand. New data can be accessed by through the data field.
703\warning any previous access to the packet data will be in detached state (no more data in the array buffer) after the call.
704\param size the number of bytes to append
705\return an arraybuffer containing the corresponding appended packet data. Full packet data is available through FilterPacket.data
706*/
707ArrayBuffer append(unsigned long size);
708
709
710/*! appends data to packet - see \ref gf_filter_pck_expand. New data can be accessed by through the data field.
711\warning any previous access to the packet data will be in detached state (no more data in the array buffer) after the call.
712\param ab the array buffer to append
713\return an arraybuffer containing the corresponding appended packet data. Full packet data is available through FilterPacket.data
714*/
715ArrayBuffer append(ArrayBuffer ab);
716
717/*! truncates the packet to the indicated size - \ref gf_filter_pck_truncate
718\warning any previous access to the packet data will be in detached state (no more data in the array buffer) after the call.
719\param size new packet size*/
720void truncate(unsigned long size);
721
722/*! copy properties of source packet
723\param from the source packet to copy properties from
724*/
725void copy_props(FilterPacket from);
726
727};
728
729/*! FilterEvent expose a filter event object, either for processing a received event or triggering a new event.
730The read access to the members of the structure is cross-checked with the event type and throw an error when attempting to access the wrong field
731*/
732
733interface FilterEvent {
734/*! constructor
735\param type the type of event. This type cannot be changed
736
737\code
738let evt = new FilterEvent(GF_FEVT_PLAY);
739\endcode
740*/
741FilterEvent(unsigned long type);
742
743/*! event type - see GF_FilterEvent*/
744attribute unsigned long type;
745/*! play event - see \ref GF_FEVT_Play*/
746attribute double start_range;
747/*! play event - see \ref GF_FEVT_Play*/
748attribute double speed;
749/*! play event - see \ref GF_FEVT_Play*/
750attribute boolean hw_buffer_reset;
751/*! play event - see \ref GF_FEVT_Play*/
752attribute boolean initial_broadcast_play;
753/*! play event - see \ref GF_FEVT_Play*/
754attribute boolean timestamp_based;
755/*! play event - see \ref GF_FEVT_Play*/
756attribute boolean full_file_only;
757/*! play event - see \ref GF_FEVT_Play*/
758attribute boolean forced_dash_segment_switch;
759/*! play event - see \ref GF_FEVT_Play*/
760attribute unsigned long from_pck;
761
762/*! source switch and source seek - see \ref GF_FEVT_SourceSeek*/
763attribute unsigned long long start_offset;
764/*! source switch and source seek - see \ref GF_FEVT_SourceSeek*/
765attribute unsigned long long end_offset;
766/*! source switch and source seek - see \ref GF_FEVT_SourceSeek*/
767attribute DOMString switch_url;
768/*! source switch and source seek - see \ref GF_FEVT_SourceSeek*/
769attribute boolean skip_cache_exp;
770/*! source switch and source seek - see \ref GF_FEVT_SourceSeek*/
771attribute unsigned long hint_block_size;
772
773/*! segment size - see \ref GF_FEVT_SegmentSize*/
774attribute DOMString seg_url;
775/*! segment size - see \ref GF_FEVT_SegmentSize*/
776attribute boolean is_init;
777/*! segment size - see \ref GF_FEVT_SegmentSize*/
778attribute unsigned long long media_start_range;
779/*! segment size - see \ref GF_FEVT_SegmentSize*/
780attribute unsigned long long media_end_range;
781/*! segment size - see \ref GF_FEVT_SegmentSize*/
782attribute unsigned long long index_start_range;
783/*! segment size - see \ref GF_FEVT_SegmentSize*/
784attribute unsigned long long index_end_range;
785
786/*! quality switch - see \ref GF_FEVT_QualitySwitch*/
787attribute boolean up;
788/*! quality switch - see \ref GF_FEVT_QualitySwitch*/
789attribute unsigned long dependent_group_index;
790/*! quality switch - see \ref GF_FEVT_QualitySwitch*/
791attribute long q_idx;
792/*! quality switch - see \ref GF_FEVT_QualitySwitch*/
793attribute unsigned long set_tile_mode_plus_one;
794/*! quality switch - see \ref GF_FEVT_QualitySwitch*/
795attribute unsigned long quality_degradation;
796
797/*! visibility hint - see \ref GF_FEVT_VisibililityHint*/
798attribute unsigned long min_x;
799/*! visibility hint - see \ref GF_FEVT_VisibililityHint*/
800attribute unsigned long min_y;
801/*! visibility hint - see \ref GF_FEVT_VisibililityHint*/
802attribute unsigned long max_x;
803/*! visibility hint - see \ref GF_FEVT_VisibililityHint*/
804attribute unsigned long max_y;
805/*! visibility hint - see \ref GF_FEVT_VisibililityHint*/
806attribute boolean is_gaze;
807
808/*! buffer reqs - see \ref GF_FEVT_BufferRequirement*/
809attribute unsigned long max_buffer_us;
810/*! buffer reqs - see \ref GF_FEVT_BufferRequirement*/
811attribute unsigned long max_playout_us;
812/*! buffer reqs - see \ref GF_FEVT_BufferRequirement*/
813attribute unsigned long min_playout_us;
814/*! buffer reqs - see \ref GF_FEVT_BufferRequirement*/
815attribute boolean pid_only;
816
817/*! ui event type of a \ref GF_Event
818only mouse and keyboard events are currently exposed
819*/
820attribute unsigned long ui_type;
821/*! see \ref GF_EventMouse*/
822attribute unsigned long mouse_x;
823/*! see \ref GF_EventMouse*/
824attribute unsigned long mouse_y;
825/*! see \ref GF_EventMouse*/
826attribute unsigned float wheel;
827/*! see \ref GF_EventMouse*/
828attribute unsigned long button;
829
830/*! see \ref GF_EventKey*/
831attribute unsigned long keycode;
832/*! see \ref GF_EventKey*/
833attribute unsigned long hwkey;
834
835/*! array of DOMString - see \ref GF_EventOpenFile*/
836attribute Array dropfiles;
837
838};
839
840/*! interface used to describe filter arguments*/
841interface JSArgDesc {
842    /*! name of the argument*/
843    attribute DOMString name;
844    /*! description of the argument*/
845    attribute DOMString desc;
846    /*! type of the argument*/
847    attribute unsigned long type;
848    /*! default value of the argument*/
849    optional attribute DOMString default=null;
850    /*! min/max or enum values of the argument*/
851    optional attribute DOMString minmax_enum=null;
852};
853
854/*! interface used to describe filter capability*/
855interface JSCapDesc {
856    /*! PropertyID of the capability - mandatory*/
857    attribute DOMString id;
858    /*! value of the property - mandatory*/
859    attribute DOMString value;
860    /*! input and output flag of the capability - if true, the output flag is ignored*/
861    attribute boolean inout;
862    /*! output flag of the capability - if undefined, the capability is an input one*/
863    attribute boolean output;
864    /*! excluded flag of the capability*/
865    optional attribute boolean excluded=false;
866    /*! loaded filter only flag of the capability*/
867    optional attribute boolean loaded_filter_only=false;
868    /*! static flag of the capability*/
869    optional attribute boolean static=false;
870    /*! optional flag of the capability*/
871    optional attribute boolean optional=false;
872};
873
874/*! Properties are mapped to JavaScript values as follows:
875
876GF_PROP_PID_CODECID: string containing the codec name\n
877GF_PROP_PID_STREAM_TYPE: string containing the stream type name\n
878GF_PROP_PID_AUDIO_FORMAT: string containing the audio format name\n
879GF_PROP_PID_PIXFMT: string containing the pixel format name\n
880\n
881Other properties are mapped by property type:\n
882GF_PROP_BOOL: boolean\n
883GF_PROP_UINT: integer\n
884GF_PROP_SINT: integer\n
885GF_PROP_LUINT: large integer\n
886GF_PROP_LSINT: large integer\n
887GF_PROP_FLOAT: double\n
888GF_PROP_FLOAT: double\n
889GF_PROP_STRING: string\n
890GF_PROP_STRING_NO_COPY: string\n
891GF_PROP_VEC2: object with number properties "x" and "y"\n
892GF_PROP_VEC2I: object with integer properties "x" and "y"\n
893GF_PROP_VEC3: object with number properties "x", "y" and "z"\n
894GF_PROP_VEC3I: object with integer properties "x", "y" and "z"\n
895GF_PROP_VEC4: object with number properties "x", "y", "z" and "w"\n
896GF_PROP_VEC4I: object with integer properties "x", "y", "z" and "w"\n
897GF_PROP_FRACTION: object with integer properties "n" and "d", representing fraction n/d\n
898GF_PROP_FRACTION64: object with large integer properties "n" and "d", representing fraction n/d\n
899GF_PROP_UINT_LIST: array of integers\n
900GF_PROP_STRING_LIST: array of strings\n
901*/
902typedef Object FilterProperty;
903
904
905/*! @} */
906
907