• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 /**
17  ************************************************************************
18  * @file   M4READER_Common.h
19  * @brief  Shell Reader common interface declaration
20  * @note   This file declares the common interfaces that reader shells must implement
21  *
22  ************************************************************************
23 */
24 #ifndef __M4READER_COMMON_H__
25 #define __M4READER_COMMON_H__
26 
27 #include "M4OSA_Types.h"
28 #include "M4OSA_Error.h"
29 #include "M4OSA_FileReader.h"
30 #include "M4OSA_CoreID.h"
31 #include "M4DA_Types.h"
32 #include "M4Common_types.h"
33 
34 /* ERRORS */
35 #define M4ERR_READER_UNKNOWN_STREAM_TYPE        M4OSA_ERR_CREATE(M4_ERR, M4READER_COMMON, 0x0001)
36 
37 /* WARNINGS */
38 #define M4WAR_READER_NO_METADATA                M4OSA_ERR_CREATE(M4_WAR, M4READER_COMMON, 0x0001)
39 #define M4WAR_READER_INFORMATION_NOT_PRESENT    M4OSA_ERR_CREATE(M4_WAR, M4READER_COMMON, 0x0002)
40 
41 
42 /**
43  ************************************************************************
44  * enum        M4READER_MediaType
45  * @brief    This enum defines the Media types used to create media readers
46  * @note    This enum is used internally by the VPS to identify a currently supported
47  *          media reader interface. Each reader is registered with one of this type associated.
48  *          When a reader instance is needed, this type is used to identify and
49  *          and retrieve its interface.
50  ************************************************************************
51 */
52 typedef enum
53 {
54     M4READER_kMediaTypeUnknown        = -1,    /**< Unknown media type */
55     M4READER_kMediaType3GPP            = 0,    /**< 3GPP file media type */
56     M4READER_kMediaTypeAVI            = 1,    /**< AVI file media type */
57     M4READER_kMediaTypeAMR            = 2,    /**< AMR file media type */
58     M4READER_kMediaTypeMP3            = 3,    /**< MP3 file media type */
59     M4READER_kMediaTypeRTSP            = 4,    /**< RTSP network accessed media type */
60     M4READER_kMediaType3GPPHTTP        = 5,    /**< Progressively downloaded 3GPP file media type */
61     M4READER_kMediaTypePVHTTP        = 6,    /**< Packet Video HTTP proprietary type */
62     M4READER_kMediaTypeWAV            = 7,    /**< WAV file media type */
63     M4READER_kMediaType3GPEXTHTTP    = 8,    /**< An external progressively downloaded 3GPP file
64                                                      media type */
65     M4READER_kMediaTypeAAC            = 9,    /**< ADTS and ADIF AAC support */
66     M4READER_kMediaTypeREAL            = 10,    /**< REAL Media type */
67     M4READER_kMediaTypeASF            = 11,    /**< ASF Media type */
68     M4READER_kMediaTypeFLEXTIME        = 12,    /**< FlexTime Media type */
69     M4READER_kMediaTypeBBA            = 13,    /**< Beatbrew audio Media type */
70     M4READER_kMediaTypeSYNTHAUDIO    = 14,    /**< Synthesis audio Media type */
71     M4READER_kMediaTypePCM            = 15,    /**< PCM Media type */
72     M4READER_kMediaTypeJPEG            = 16,    /**< JPEG Media type */
73     M4READER_kMediaTypeGIF            = 17,    /**< GIF Media type */
74     M4READER_kMediaTypeADIF            = 18,    /**< AAC-ADTS Media type */
75     M4READER_kMediaTypeADTS            = 19,    /**< AAC-ADTS Media type */
76 
77     M4READER_kMediaType_NB  /* number of readers, keep it as last enum entry */
78 
79 } M4READER_MediaType;
80 
81 /**
82  ************************************************************************
83  * enum        M4READER_MediaFamily
84  * @brief    This enum defines the Media family of a stream
85  * @note    This enum is used internally by the VPS to identify what kind of stream
86  *          has been retrieved via getNextStream() function.
87  ************************************************************************
88 */
89 typedef enum
90 {
91     M4READER_kMediaFamilyUnknown   = -1,
92     M4READER_kMediaFamilyVideo     = 0,
93     M4READER_kMediaFamilyAudio     = 1,
94     M4READER_kMediaFamilyText      = 2
95 } M4READER_MediaFamily;
96 
97 
98 
99 /**
100  ************************************************************************
101  * enum        M4READER_OptionID
102  * @brief    This enum defines the reader options
103  * @note    These options can be read from a reader via M4READER_getOption_fct
104  ************************************************************************
105 */
106 typedef enum
107 {
108     /**
109     Get the duration of the movie (in ms)
110     */
111     M4READER_kOptionID_Duration = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0),
112 
113     /**
114     Get the version of the core reader
115     */
116     M4READER_kOptionID_Version  = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 1),
117 
118     /**
119     Get the copyright from the media (if present)
120     (currently implemented for 3GPP only: copyright get from the cprt atom in the udta if present)
121     */
122     M4READER_kOptionID_Copyright= M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 2),
123 
124 
125     /**
126     Set the OSAL file reader functions to the reader (type of value: M4OSA_FileReadPointer*)
127     */
128     M4READER_kOptionID_SetOsaFileReaderFctsPtr = M4OSA_OPTION_ID_CREATE(M4_READ,\
129                                                      M4READER_COMMON, 3),
130 
131     /**
132     Set the OSAL file writer functions to the reader (type of value: M4OSA_FileWriterPointer*)
133     */
134     M4READER_kOptionID_SetOsaFileWriterFctsPtr = M4OSA_OPTION_ID_CREATE(M4_READ,\
135                                                      M4READER_COMMON, 4),
136 
137     /**
138     Set the OSAL file writer functions to the reader (type of value: M4OSA_NetFunction*)
139     */
140     M4READER_kOptionID_SetOsaNetFctsPtr = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 5),
141 
142     /**
143     Creation time in sec. since midnight, Jan. 1, 1970 (type of value: M4OSA_UInt32*)
144     (available only for 3GPP content, including PGD)
145     */
146     M4READER_kOptionID_CreationTime = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 6),
147 
148     /**
149     Bitrate in bps (type of value: M4OSA_Double*)
150     */
151     M4READER_kOptionID_Bitrate = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 7),
152 
153     /**
154     Tag ID3v1 of MP3 source (type of value: M4MP3R_ID3Tag*)
155     */
156     M4READER_kOptionID_Mp3Id3v1Tag = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 8),
157 
158     /**
159     Tag ID3v2 of MP3 source (type of value: M4MP3R_ID3Tag*)
160     */
161     M4READER_kOptionID_Mp3Id3v2Tag = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 9),
162 
163     /**
164     Number of Access Unit in the Audio stream (type of value: M4OSA_UInt32*)
165     */
166     M4READER_kOptionID_GetNumberOfAudioAu = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0xA),
167 
168     /**
169     Number of frames per bloc
170     */
171     M4READER_kOptionID_GetNbframePerBloc    = M4OSA_OPTION_ID_CREATE(M4_READ,\
172                                                              M4READER_COMMON, 0xB),
173 
174     /**
175     Flag for protection presence
176     */
177     M4READER_kOptionID_GetProtectPresence    = M4OSA_OPTION_ID_CREATE(M4_READ,\
178                                                              M4READER_COMMON, 0xC),
179 
180     /**
181     Set DRM Context
182     */
183     M4READER_kOptionID_SetDRMContext    = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0xD),
184 
185     /**
186     Get ASF Content Description Object
187     */
188     M4READER_kOptionID_ContentDescription = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0xE),
189 
190     /**
191     Get ASF Content Description Object
192     */
193     M4READER_kOptionID_ExtendedContentDescription = M4OSA_OPTION_ID_CREATE(M4_READ,\
194                                                              M4READER_COMMON, 0xF),
195 
196     /**
197     Get Asset 3gpp Fields
198     */
199     M4READER_kOptionID_3gpAssetFields = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x10),
200 
201     /**
202     Set the max metadata size supported in the reader
203     Only relevant in 3gp parser till now, but can be used for other readers
204     */
205     M4READER_kOptionID_MaxMetadataSize = M4OSA_OPTION_ID_CREATE(M4_WRITE, M4READER_COMMON, 0x11),
206 
207     M4READER_kOptionID_GetMetadata = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x12),
208     /**
209     Get 3gpp 'ftyp' atom
210     */
211     M4READER_kOptionID_3gpFtypBox  = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x13),
212 
213 
214     /* value is M4OSA_Bool* */
215     /* return the drm protection status of the file*/
216     M4READER_kOptionID_isProtected = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x14),
217 
218     /* value is a void* */
219     /* return the aggregate rights of the file*/
220     /* The buffer must be allocated by the application and must be big enough*/
221     /* By default, the size for WMDRM is 76 bytes */
222     M4READER_kOptionID_getAggregateRights = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x15),
223     /**
224     Get ASF Content Description Object
225     */
226     M4READER_kOptionID_ExtendedContentEncryption = M4OSA_OPTION_ID_CREATE(M4_READ,\
227                                                          M4READER_COMMON, 0x16),
228 
229     /**
230     Number of Access Unit in the Video stream (type of value: M4OSA_UInt32*)
231     */
232     M4READER_kOptionID_GetNumberOfVideoAu = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x17),
233 
234     /**
235     Chunk mode activation  size in case of JPG reader */
236     M4READER_kOptionID_JpegChunckSize = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x18),
237 
238     /**
239     Check if ASF file contains video */
240     M4READER_kOptionID_hasVideo = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x19),
241 
242     /**
243      Set specific read mode for Random Access JPEG */
244     M4READER_kOptionID_JpegRAMode = M4OSA_OPTION_ID_CREATE(M4_WRITE, M4READER_COMMON, 0x20),
245 
246     /**
247     Get Thumbnail buffer in case of JPG reader */
248     M4READER_kOptionID_JpegThumbnail = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x21),
249 
250     /**
251     Get FPDATA buffer in case of JPG reader */
252     M4READER_kOptionID_JpegFPData = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x22),
253 
254     /**
255     Get JPEG info (progressive, subsampling) */
256     M4READER_kOptionID_JpegInfo= M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_COMMON, 0x23)
257 
258 
259 /*****************************************/
260 } M4READER_OptionID;
261 /*****************************************/
262 
263 /**
264  ************************************************************************
265  * structure    M4READER_CopyRight
266  * @brief        This structure defines a copyRight description
267  * @note        This structure is used to retrieve the copyRight of the media
268  *              (if present) via the getOption() function
269  ************************************************************************
270 */
271 typedef struct _M4READER_CopyRight
272 {
273     /**
274     Pointer to copyright data (allocated by user)
275     */
276     M4OSA_UInt8*   m_pCopyRight;
277 
278     /**
279     Pointer to copyright size. The pCopyRightSize must
280     be Initialized with the size available in the pCopyRight buffer
281     */
282     M4OSA_UInt32   m_uiCopyRightSize;
283 
284 } M4READER_CopyRight;
285 
286 
287 
288 /**
289  ************************************************************************
290  * structure    M4READER_StreamDataOption
291  * @brief        This structure defines a generic stream data option
292  * @note        It is used is used to set or get a stream specific data defined
293  *              by a relevant reader option ID.
294  ************************************************************************
295 */
296 typedef struct _M4READER_StreamDataOption
297 {
298     M4_StreamHandler*     m_pStreamHandler; /**< identifier of the stream */
299     M4OSA_Void*           m_pOptionValue;   /**< value of the data option to get or to set */
300 
301 } M4READER_StreamDataOption;
302 
303 /**
304  ************************************************************************
305  * enumeration    M4_EncodingFormat
306  * @brief        Text encoding format
307  ************************************************************************
308 */
309 // typedef enum
310 // {
311 //     M4_kEncFormatUnknown    = 0,    /**< Unknown format                                    */
312 //     M4_kEncFormatASCII        = 1,  /**< ISO-8859-1. Terminated with $00                   */
313 //     M4_kEncFormatUTF8        = 2,   /**< UTF-8 encoded Unicode . Terminated with $00       */
314 //     M4_kEncFormatUTF16        = 3   /**< UTF-16 encoded Unicode. Terminated with $00 00    */
315 /*}  M4_EncodingFormat;*/
316 
317 /**
318  ************************************************************************
319  * structure    M4_StringAttributes
320  * @brief        This structure defines string attribute
321  ************************************************************************
322 */
323 // typedef struct
324 // {
325 //     M4OSA_Void*            m_pString;            /**< Pointer to text        */
326 //     M4OSA_UInt32        m_uiSize;            /**< Size of text            */
327 //     M4_EncodingFormat    m_EncodingFormat;    /**< Text encoding format    */
328 // } M4_StringAttributes;
329 
330 
331 /**
332  ************************************************************************
333  * structure    M4READER_Buffer
334  * @brief        This structure defines a buffer in all readers
335  ************************************************************************
336 */
337 typedef struct
338 {
339     M4OSA_UInt8*   m_pData;
340     M4OSA_UInt32   m_uiBufferSize;
341 } M4READER_Buffer;
342 
343 typedef struct
344 {
345      M4OSA_UInt32            m_uiSessionId;
346     M4OSA_UInt32            m_uiMediaId;
347     M4OSA_UInt32            m_uiNbInstance;
348     M4OSA_Char**            m_pInstance;
349 } M4_SdpAssetInstance;
350 /*
351 typedef enum
352 {
353      M4READER_kUnknownFormat    = 0,
354      M4READER_kTagID3V1,
355      M4READER_kTagID3V2,
356     M4READER_kASFContentDesc,
357     M4READER_k3GppAssetBoxFromUDTA,
358     M4READER_k3GppAssetBoxFromSDP,
359     M4READER_kJpegExif
360 } M4READER_MetaDataType;*/
361 
362 
363 /**
364  ************************************************************************
365  * structure    M4_3gpAssetFields
366  * @brief        This structure defines fields of a 3gpp asset information
367  ************************************************************************
368 */
369 typedef struct
370 {
371     M4COMMON_MetaDataFields    m_metadata;
372 
373     M4OSA_UInt32            m_uiSessionID;    /* For SDP */
374     M4OSA_UInt32            m_uiMediaID;    /* For SDP */
375 
376 
377     /* Note: The two following fields were added for internal use
378         (For Music manager project..) !! */
379     M4_StreamType       m_VideoStreamType;    /**< Video stream type */
380     M4_StreamType       m_AudioStreamType;    /**< Audio stream type */
381 
382 } M4_MetaDataFields;
383 
384 
385 #define M4_METADATA_STR_NB    22 /* one string in album art structure*/
386 
387 typedef struct
388 {
389     M4OSA_UInt32            m_uiNbBuffer;
390     M4_SdpAssetInstance*    m_pAssetInfoInst;    /* Set of 3gpp asset boxes */
391     M4COMMON_MetaDataAlbumArt        m_albumArt;            /* RC: PV specific album art:added
392                                                                here because this type is used by
393                                                                union below in streaming */
394 
395 } M4READER_netInfos;
396 
397 
398 typedef union
399 {
400     M4READER_Buffer        m_pTagID3Buffer[2];        /* Tag ID3 V1, V2 */
401     struct
402     {
403         M4READER_Buffer        m_pAsfDescContent;    /* ASF description content buffer */
404         M4READER_Buffer        m_pAsfExtDescContent; /* ASF extended description content buffer */
405     } m_asf;
406     M4_MetaDataFields    m_pMetadataFields;      /* Already parsed and filled 3gpp asset fields */
407     M4READER_netInfos    m_pAssetInfoInstance;   /* Set of 3gpp asset boxes in the sdp file */
408 
409 } M4_MetadataBuffer;
410 
411 
412 
413 
414 /*********** READER GLOBAL Interface ************************************/
415 
416 /**
417  ************************************************************************
418  * @brief    create an instance of the reader
419  * @note    create the context
420  * @param    pContext:            (OUT)    pointer on a reader context
421  * @return    M4NO_ERROR                     there is no error
422  * @return    M4ERR_PARAMETER                at least one parameter is not properly set
423  * @return    M4ERR_ALLOC                    a memory allocation has failed
424  ************************************************************************
425 */
426 typedef M4OSA_ERR (M4READER_create_fct)          (M4OSA_Context* pContext);
427 
428 /**
429  ************************************************************************
430  * @brief    destroy the instance of the reader
431  * @note    after this call the context is invalid
432  * @param    context:            (IN)    Context of the reader
433  * @return    M4NO_ERROR                     there is no error
434  * @return    M4ERR_PARAMETER                at least one parameter is not properly set
435  ************************************************************************
436 */
437 typedef M4OSA_ERR (M4READER_destroy_fct)         (M4OSA_Context context);
438 
439 
440 /**
441  ************************************************************************
442  * @brief    open the reader and initializes its created instance
443  * @note    this function, for the network reader, sends the DESCRIBE
444  * @param    context:            (IN)    Context of the reader
445  * @param    pFileDescriptor:    (IN)    Pointer to proprietary data identifying the media to open
446  * @return    M4NO_ERROR                     there is no error
447  * @return    M4ERR_PARAMETER                the context is NULL
448  * @return    M4ERR_BAD_CONTEXT            provided context is not a valid one
449  ************************************************************************
450 */
451 typedef M4OSA_ERR (M4READER_open_fct)    (M4OSA_Context context, M4OSA_Void* pFileDescriptor);
452 
453 
454 /**
455  ************************************************************************
456  * @brief    close the reader
457  * @note
458  * @param    context:        (IN)    Context of the reader
459  * @return    M4NO_ERROR                 there is no error
460  * @return    M4ERR_PARAMETER            the context is NULL
461  * @return    M4ERR_BAD_CONTEXT        provided context is not a valid one
462  ************************************************************************
463 */
464 typedef M4OSA_ERR   (M4READER_close_fct)    (M4OSA_Context context);
465 
466 
467 
468 /**
469  ************************************************************************
470  * @brief    Get the next stream found in the media
471  * @note
472  * @param    context:        (IN)    Context of the reader
473  * @param    pMediaFamily:    (OUT)    pointer to a user allocated M4READER_MediaFamily that will
474  *                                     be filled with the media family of the found stream
475  * @param    pStreamHandler:    (OUT)    pointer to a stream handler that will be allocated and
476  *                                       filled with the found stream description
477  * @return    M4NO_ERROR                 there is no error
478  * @return    M4ERR_BAD_CONTEXT        provided context is not a valid one
479  * @return    M4ERR_PARAMETER            at least one parameter is not properly set
480  * @return    M4WAR_NO_MORE_STREAM    no more available stream in the media (all streams found)
481  ************************************************************************
482 */
483 typedef M4OSA_ERR (M4READER_getNextStream_fct)   (M4OSA_Context context,
484                                                      M4READER_MediaFamily *pMediaFamily,
485                                                      M4_StreamHandler **pStreamHandler);
486 
487 
488 /**
489  ************************************************************************
490  * @brief    fill the access unit structure with initialization values
491  * @note
492  * @param    context:        (IN)     Context of the reader
493  * @param    pStreamHandler:    (IN)     pointer to the stream handler to which the access unit
494  *                                           will be associated
495  * @param    pAccessUnit:    (IN/OUT) pointer to the access unit (allocated by the caller)
496  *                                           to initialize
497  * @return    M4NO_ERROR                  there is no error
498  * @return    M4ERR_BAD_CONTEXT         provided context is not a valid one
499  * @return    M4ERR_PARAMETER             at least one parameter is not properly set
500  * @return    M4ERR_ALLOC                 there is no more memory available
501  ************************************************************************
502 */
503 typedef M4OSA_ERR (M4READER_fillAuStruct_fct)    (M4OSA_Context context,
504                                                    M4_StreamHandler *pStreamHandler,
505                                                    M4_AccessUnit *pAccessUnit);
506 
507 /**
508  ************************************************************************
509  * @brief    starts the instance of the reader
510  * @note    only needed for network until now...
511  * @param    context:        (IN)    Context of the reader
512  * @return    M4NO_ERROR                 there is no error
513  * @return    M4ERR_PARAMETER            the context is NULL
514  * @return    M4ERR_BAD_CONTEXT        provided context is not a valid one
515  ************************************************************************
516 */
517 typedef M4OSA_ERR (M4READER_start_fct)   (M4OSA_Context context);
518 
519 /**
520  ************************************************************************
521  * @brief    stop reading
522  * @note    only needed for network until now... (makes a pause)
523  * @param    context:        (IN)    Context of the reader
524  * @return    M4NO_ERROR                 there is no error
525  * @return    M4ERR_PARAMETER            the context is NULL
526  * @return    M4ERR_BAD_CONTEXT        provided context is not a valid one
527  ************************************************************************
528 */
529 typedef M4OSA_ERR (M4READER_stop_fct)   (M4OSA_Context context);
530 
531 
532 /**
533  ************************************************************************
534  * @brief    get an option value from the reader
535  * @note    this function follows the set/get option mechanism described in OSAL 3.0
536  *          it allows the caller to retrieve a property value:
537  *          -the duration of the longest stream of the media
538  *          -the version number of the reader
539  *
540  * @param    context:        (IN)    Context of the reader
541  * @param    optionId:        (IN)    indicates the option to get
542  * @param    pValue:            (OUT)    pointer to structure or value (allocated by user)
543  *                                          where option is stored
544  *
545  * @return    M4NO_ERROR                 there is no error
546  * @return    M4ERR_BAD_CONTEXT        provided context is not a valid one
547  * @return    M4ERR_PARAMETER            at least one parameter is not properly set
548  * @return    M4ERR_BAD_OPTION_ID        when the option ID is not a valid one
549  ************************************************************************
550 */
551 typedef M4OSA_ERR (M4READER_getOption_fct)       (M4OSA_Context context, M4OSA_OptionID optionId,
552                                                      M4OSA_DataOption pValue);
553 
554 
555 /**
556  ************************************************************************
557  * @brief   set en option value of the readder
558  * @note    this function follows the set/get option mechanism described in OSAL 3.0
559  *          it allows the caller to set a property value:
560  *          - nothing for the moment
561  *
562  * @param    context:        (IN)    Context of the reader
563  * @param    optionId:        (IN)    indicates the option to set
564  * @param    pValue:            (IN)    pointer to structure or value (allocated by user) where
565  *                                          option is stored
566  *
567  * @return    M4NO_ERROR                 there is no error
568  * @return    M4ERR_BAD_CONTEXT        provided context is not a valid one
569  * @return    M4ERR_PARAMETER            at least one parameter is not properly set
570  * @return    M4ERR_BAD_OPTION_ID        when the option ID is not a valid one
571  ************************************************************************
572 */
573 typedef M4OSA_ERR (M4READER_setOption_fct)       (M4OSA_Context context, M4OSA_OptionID optionId,
574                                                      M4OSA_DataOption pValue);
575 
576 
577 /**
578  ************************************************************************
579  * @brief    jump into the stream at the specified time
580  * @note
581  * @param    context:        (IN)     Context of the reader
582  * @param    pStreamHandler    (IN)     the stream handler of the stream to make jump
583  * @param    pTime            (IN/OUT) IN:  the time to jump to (in ms)
584  *                                     OUT: the time to which the stream really jumped
585  * @return    M4NO_ERROR                 there is no error
586  * @return    M4ERR_BAD_CONTEXT        provided context is not a valid one
587  * @return    M4ERR_PARAMETER            at least one parameter is not properly set
588  * @return    M4ERR_ALLOC                there is no more memory available
589  * @return    M4ERR_BAD_STREAM_ID        the streamID does not exist
590  ************************************************************************
591 */
592 typedef M4OSA_ERR   (M4READER_jump_fct)     (M4OSA_Context context,
593                                                 M4_StreamHandler *pStreamHandler,
594                                                 M4OSA_Int32* pTime);
595 
596 
597 /**
598  ************************************************************************
599  * @brief    reset the stream, that is seek it to beginning and make it ready to be read
600  * @note
601  * @param    context:        (IN)    Context of the reader
602  * @param    pStreamHandler    (IN)    The stream handler of the stream to reset
603  * @return    M4NO_ERROR                 there is no error
604  * @return    M4ERR_BAD_CONTEXT        provided context is not a valid one
605  * @return    M4ERR_PARAMETER            at least one parameter is not properly set
606  * @return    M4ERR_ALLOC                there is no more memory available
607  * @return    M4ERR_BAD_STREAM_ID        the streamID does not exist
608  ************************************************************************
609 */
610 typedef M4OSA_ERR   (M4READER_reset_fct)    (M4OSA_Context context,
611                                                 M4_StreamHandler *pStreamHandler);
612 
613 
614 /**
615  ************************************************************************
616  * @brief    get the time of the closest RAP access unit before the given time
617  * @note
618  * @param    context:        (IN)     Context of the reader
619  * @param    pStreamHandler    (IN)     the stream handler of the stream to search
620  * @param    pTime            (IN/OUT) IN:  the time to search from (in ms)
621  *                                     OUT: the time (cts) of the preceding RAP AU.
622  * @return    M4NO_ERROR                 there is no error
623  * @return    M4ERR_BAD_CONTEXT        provided context is not a valid one
624  * @return    M4ERR_PARAMETER            at least one parameter is not properly set
625  * @return    M4ERR_BAD_STREAM_ID        the streamID does not exist
626  ************************************************************************
627 */
628 typedef M4OSA_ERR   (M4READER_getPrevRapTime_fct) (M4OSA_Context context,
629                                                     M4_StreamHandler *pStreamHandler,
630                                                     M4OSA_Int32* pTime);
631 
632 
633 /**
634  ************************************************************************
635  * structure    M4READER_GlobalInterface
636  * @brief        This structure defines the generic media reader GLOBAL interface
637  * @note        This structure stores the pointers to functions concerning
638  *                creation and control of one reader type.
639  *                The reader type is one of the M4READER_MediaType
640  ************************************************************************
641 */
642 typedef struct _M4READER_GlobalInterface
643 /*****************************************/
644 {
645     M4READER_create_fct*            m_pFctCreate;
646     M4READER_destroy_fct*           m_pFctDestroy;
647     M4READER_open_fct*              m_pFctOpen;
648     M4READER_close_fct*             m_pFctClose;
649     M4READER_getOption_fct*         m_pFctGetOption;
650     M4READER_setOption_fct*         m_pFctSetOption;
651     M4READER_getNextStream_fct*     m_pFctGetNextStream;
652     M4READER_fillAuStruct_fct*      m_pFctFillAuStruct;
653     M4READER_start_fct*             m_pFctStart;
654     M4READER_stop_fct*              m_pFctStop;
655     M4READER_jump_fct*              m_pFctJump;
656     M4READER_reset_fct*             m_pFctReset;
657     M4READER_getPrevRapTime_fct*    m_pFctGetPrevRapTime;
658 
659 } M4READER_GlobalInterface;
660 
661 
662 /************* READER DATA Interface ************************************/
663 
664 
665 
666 /**
667  ************************************************************************
668  * @brief    Gets an access unit (AU) from the stream handler source.
669  * @note    An AU is the smallest possible amount of data to be decoded by a decoder (audio/video).
670  *
671  * @param    context:        (IN)        Context of the reader
672  * @param    pStreamHandler    (IN)        The stream handler of the stream to make jump
673  * @param    pAccessUnit        (IN/OUT)   Pointer to an access unit to fill with read data
674  *                                         (the au structure is allocated by the user, and must be
675  *                                         initialized by calling M4READER_fillAuStruct_fct after
676  *                                         creation)
677  * @return    M4NO_ERROR                     there is no error
678  * @return    M4ERR_BAD_CONTEXT            provided context is not a valid one
679  * @return    M4ERR_PARAMETER                at least one parameter is not properly set
680  * @returns    M4ERR_ALLOC                    memory allocation failed
681  * @returns    M4ERR_BAD_STREAM_ID            at least one of the stream Id. does not exist.
682  * @returns    M4WAR_NO_DATA_YET            there is no enough data on the stream for new
683  *                                          access unit
684  * @returns    M4WAR_NO_MORE_AU            there are no more access unit in the stream
685  *                                          (end of stream)
686  ************************************************************************
687 */
688 typedef M4OSA_ERR   (M4READER_getNextAu_fct)(M4OSA_Context context,
689                                              M4_StreamHandler *pStreamHandler,
690                                              M4_AccessUnit *pAccessUnit);
691 
692 
693 /**
694  ************************************************************************
695  * structure    M4READER_DataInterface
696  * @brief        This structure defines the generic media reader DATA interface
697  * @note        This structure stores the pointers to functions concerning
698  *                data access for one reader type.(those functions are typically called from
699  *                a decoder) The reader type is one of the M4READER_MediaType
700  ************************************************************************
701 */
702 typedef struct _M4READER_DataInterface
703 {
704     M4READER_getNextAu_fct*   m_pFctGetNextAu;
705 
706     /**
707     stores the context created by the M4READER_create_fct() function
708     so it is accessible without  decoder
709     */
710     M4OSA_Context m_readerContext;
711 /*****************************************/
712 } M4READER_DataInterface;
713 /*****************************************/
714 
715 
716 #endif /*__M4READER_COMMON_H__*/
717 
718