Pepper_37_C_interfaces
ppb_stream_parser_samsung.h
Go to the documentation of this file.
1 /* Copyright (c) 2015 Samsung Electronics. All rights reserved.
2  */
3 
4 /* From samsung/ppb_stream_parser_samsung.idl,
5  * modified Mon Jun 22 14:26:33 2015.
6  */
7 
8 #ifndef PPAPI_C_SAMSUNG_PPB_STREAM_PARSER_SAMSUNG_H_
9 #define PPAPI_C_SAMSUNG_PPB_STREAM_PARSER_SAMSUNG_H_
10 
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_completion_callback.h"
13 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/c/pp_macros.h"
15 #include "ppapi/c/pp_resource.h"
16 #include "ppapi/c/pp_stdint.h"
17 #include "ppapi/c/pp_var.h"
18 #include "ppapi/c/samsung/pp_media_codecs_samsung.h"
19 #include "ppapi/c/samsung/pp_media_common_samsung.h"
20 #include "ppapi/c/samsung/pp_stream_parser_samsung.h"
21 #include "ppapi/c/samsung/ppp_stream_parser_samsung.h"
22 
23 #define PPB_STREAMPARSER_SAMSUNG_INTERFACE_0_9 "PPB_StreamParser_Samsung;0.9"
24 #define PPB_STREAMPARSER_SAMSUNG_INTERFACE_0_10 "PPB_StreamParser_Samsung;0.10"
25 #define PPB_STREAMPARSER_SAMSUNG_INTERFACE \
26  PPB_STREAMPARSER_SAMSUNG_INTERFACE_0_10
27 
28 /**
29  * @file
30  *
31  * This file defines the <code>PPB_StreamParser_Samsung</code> interface.
32  */
33 
34 
35 /**
36  * @addtogroup Interfaces
37  * @{
38  */
39 /*
40  * This interface is part of framework, used to parse media data stream.
41  * Multimedia pipeline supports Media Source Extensions (MSE) for JS which
42  * deliver limited set of supported media containers / container formats
43  * (usually streaming media).
44  * Thanks to this interface it's possible to register custom parser to extend
45  * the set of build in which could be used to parse data stream and deliver
46  * result to multimedia pipeline for unusual or unsupported formats.
47  * Typical scenario:
48  * 1. registering parser (by MimeType).
49  * 2. waiting for request to initialize parser - it starts parsing procedure.
50  * 3. waiting for request to parse - delivers data to parse.
51  * 4. serve a result of stream parsing or error message if error occurs, handle
52  * flush/close requests if occurs.
53  *
54  * As a result of Parsing, parser should deliver audio/video configuration,
55  * buffers with frames / samples data, and optionally encryption information
56  * (used to decrypting encrypted streams). There are valid bellow sequences:
57  * - Call Init (API v0.9) or InitSegmentReceived (API v0.10) as a result of
58  * parse request.
59  * - Delivering audio/video configuration after call Init/InitSegmentReceived
60  * and not between NewSegment/EndOfSegment calls.
61  * - Delivering NewBuffers only between NewSegment/EndOfSegment calls.
62  */
64  /*
65  * Method used for registering stream parser in Browser. |stream_type| is
66  * a MIME type of stream, to witch parser be registered.
67  * |stream_parser_interface| is a PPP interface which stream parser (user
68  * NaCl application) delivering to browser to handle parsing process.
69  * |user_data| The user data to be passed to the PPP functions.
70  * This is optional and is typically used to help track state in case of
71  * multiple parsers.
72  * (see ppp_stream_parser_samsung.h for details).
73  */
74  int32_t (*RegisterParser)(
75  PP_Instance instance,
76  struct PP_Var stream_type,
77  const struct PPP_StreamParser_Samsung_0_9* stream_parser_interface,
78  struct PP_CompletionCallback callback,
79  void* user_data);
80  /*
81  * Indicates completion of parser initialization. |stream_id| is an id of
82  * the stream, that Browser request to parse, if browser request parsing more
83  * that one stream of that type, it allows to recognize that stream.
84  * |init_status| a status of initialization.
85  * If initializations is successful, the |duration| contains stream duration
86  * (in microseconds) if it's possible to recognize it.
87  * Equivalent for API v0.9 is |Init| method, which return status (|result|)
88  * as PP_OK, or PP_FALSE if an error occurred.
89  */
90  int32_t (*InitSegmentReceived)(PP_Instance instance,
91  int32_t stream_id,
92  PP_Parser_InitStatus init_status,
93  PP_MicrosecondsDelta duration,
94  struct PP_CompletionCallback callback);
95  /*
96  * Indicates when new audio configuration have been parsed,
97  * |config| it's a configuration structure.
98  */
99  int32_t (*NewAudioConfig)(PP_Instance instance,
100  int32_t stream_id,
101  const struct PP_SP_AudioDecoderConfig* config,
102  struct PP_CompletionCallback callback);
103  /*
104  * Indicates when new video configuration have been parsed,
105  * |config| it's a configuration structure.
106  */
107  int32_t (*NewVideoConfig)(PP_Instance instance,
108  int32_t stream_id,
109  const struct PP_SP_VideoDecoderConfig* config,
110  struct PP_CompletionCallback callback);
111  /*
112  * New stream buffers have been parsed, |type| indicates type of track it's
113  * enum defined in pp_stream_parser_samsung.h, |track_id| it's id of track,
114  * useful if is more that one track of that type. Frames data are send by
115  * buffer. |buffer| size must be of at least sum of all frames |size|.
116  * |key_id| |key_id_size| |iv| and |iv_size| - describes global id of key and
117  * initialization vector used to decrypting the blocks. Global means that this
118  * pair key_id / iv is common for all samples from this buffer. Global
119  * pair has lower priority than individual (per sample) pair passed by
120  * |PP_Sample|.
121  * |samples| a array of |PP_Sample| that contain |samples_count| structures
122  * of |PP_Sample| that contains information like sample data size, flags
123  * used to describe sample, individual key id / initialization vector and
124  * other data required to decryption encrypted sample, decode timestamp,
125  * duration etc. (for details see pp_stream_parser_samsung.h : PP_Sample).
126  * If sample isn't encrypted related individual key_id / iv are
127  * ignored, and should be empty (NULL pointer with size set to zero).
128  * If any sample in buffer isn't encrypted also global key id / iv should be
129  * empty.
130  * (for details see pp_stream_parser_samsung.h : PP_Sample structure).
131  */
132  int32_t (*NewBuffers)(PP_Instance instance,
133  int32_t stream_id,
135  int32_t track_id,
136  PP_Resource buffer,
137  uint16_t key_id_size,
138  const uint8_t key_id[],
139  uint8_t iv_size,
140  const uint8_t iv[],
141  uint32_t samples_count,
142  const struct PP_Sample samples[],
143  struct PP_CompletionCallback callback);
144  /*
145  * Signals the beginning od a new media segment, |timestamp| the earliest
146  * timestamp of all the frames / samples in the segment.
147  */
148  void (*NewMediaSegment)(PP_Instance instance,
149  int32_t stream_id,
150  PP_MicrosecondsDelta timestamp);
151  /*
152  * Signals end of the segment.
153  */
154  void (*EndOfSegment)(PP_Instance instance, int32_t stream_id);
155  /*
156  * Method used to signal ending of |parse| for current buffer.
157  */
158  void (*ParseFinished)(PP_Instance instance,
159  int32_t stream_id,
160  PP_ParseResult result);
161  /*
162  * A new potentialy encrypted stream has been parsed. |type| describes type
163  * of the initialization data |init_data| associated with the stream.
164  */
165  int32_t (*NeedKey)(PP_Instance instance,
166  int32_t stream_id,
167  struct PP_Var type,
168  struct PP_Var init_data,
169  struct PP_CompletionCallback callback);
170 };
171 
173 
176  PP_Instance instance,
177  struct PP_Var stream_type,
178  const struct PPP_StreamParser_Samsung_0_9* stream_parser_interface,
179  void* user_data);
180  PP_Bool (*Init)(PP_Instance instance,
181  int32_t stream_id,
182  PP_Bool result,
183  PP_MicrosecondsDelta duration);
185  PP_Instance instance,
186  int32_t stream_id,
187  const struct PP_SP_AudioDecoderConfig_0_9* config);
189  PP_Instance instance,
190  int32_t stream_id,
191  const struct PP_SP_VideoDecoderConfig_0_9* config);
193  int32_t stream_id,
195  int32_t track_id,
196  PP_Resource buffer,
197  uint32_t frames_count,
198  const struct PP_Frames frames[]);
199  void (*NewMediaSegment)(PP_Instance instance,
200  int32_t stream_id,
201  PP_MicrosecondsDelta timestamp);
202  void (*EndOfSegment)(PP_Instance instance, int32_t stream_id);
204  int32_t stream_id,
205  struct PP_Var type,
206  struct PP_Var init_data);
207 };
208 /**
209  * @}
210  */
211 
212 #endif /* PPAPI_C_SAMSUNG_PPB_STREAM_PARSER_SAMSUNG_H_ */
213 
PP_Bool(* NewBuffers)(PP_Instance instance, int32_t stream_id, PP_ElementaryStream_Type_Samsung type, int32_t track_id, PP_Resource buffer, uint32_t frames_count, const struct PP_Frames frames[])
void(* ParseFinished)(PP_Instance instance, int32_t stream_id, PP_ParseResult result)
int32_t(* NewVideoConfig)(PP_Instance instance, int32_t stream_id, const struct PP_SP_VideoDecoderConfig *config, struct PP_CompletionCallback callback)
int32_t(* NeedKey)(PP_Instance instance, int32_t stream_id, struct PP_Var type, struct PP_Var init_data, struct PP_CompletionCallback callback)
void(* NewMediaSegment)(PP_Instance instance, int32_t stream_id, PP_MicrosecondsDelta timestamp)
int32_t(* InitSegmentReceived)(PP_Instance instance, int32_t stream_id, PP_Parser_InitStatus init_status, PP_MicrosecondsDelta duration, struct PP_CompletionCallback callback)
int64_t PP_MicrosecondsDelta
PP_VarType type
Definition: pp_var.h:167
int32_t(* RegisterParser)(PP_Instance instance, struct PP_Var stream_type, const struct PPP_StreamParser_Samsung_0_9 *stream_parser_interface, struct PP_CompletionCallback callback, void *user_data)
int32_t PP_Resource
Definition: pp_resource.h:40
void(* NewMediaSegment)(PP_Instance instance, int32_t stream_id, PP_MicrosecondsDelta timestamp)
PP_Bool(* Init)(PP_Instance instance, int32_t stream_id, PP_Bool result, PP_MicrosecondsDelta duration)
PP_Bool(* NeedKey)(PP_Instance instance, int32_t stream_id, struct PP_Var type, struct PP_Var init_data)
Definition: pp_var.h:166
PP_Bool(* NewVideoConfig)(PP_Instance instance, int32_t stream_id, const struct PP_SP_VideoDecoderConfig_0_9 *config)
PP_Bool(* RegisterParser)(PP_Instance instance, struct PP_Var stream_type, const struct PPP_StreamParser_Samsung_0_9 *stream_parser_interface, void *user_data)
void(* EndOfSegment)(PP_Instance instance, int32_t stream_id)
int32_t PP_Instance
Definition: pp_instance.h:34
PP_Bool(* NewAudioConfig)(PP_Instance instance, int32_t stream_id, const struct PP_SP_AudioDecoderConfig_0_9 *config)
PP_Bool
Definition: pp_bool.h:30
int32_t(* NewBuffers)(PP_Instance instance, int32_t stream_id, PP_ElementaryStream_Type_Samsung type, int32_t track_id, PP_Resource buffer, uint16_t key_id_size, const uint8_t key_id[], uint8_t iv_size, const uint8_t iv[], uint32_t samples_count, const struct PP_Sample samples[], struct PP_CompletionCallback callback)
void(* EndOfSegment)(PP_Instance instance, int32_t stream_id)
PP_ElementaryStream_Type_Samsung
int32_t(* NewAudioConfig)(PP_Instance instance, int32_t stream_id, const struct PP_SP_AudioDecoderConfig *config, struct PP_CompletionCallback callback)