MP4v2

sample.h
1#ifndef MP4V2_SAMPLE_H
2#define MP4V2_SAMPLE_H
3
4/**************************************************************************/
15 typedef enum MP4SampleDependencyType_e {
16 MP4_SDT_UNKNOWN = 0x00,
17 MP4_SDT_HAS_REDUNDANT_CODING = 0x01,
18 MP4_SDT_HAS_NO_REDUNDANT_CODING = 0x02,
19 MP4_SDT_HAS_DEPENDENTS = 0x04,
20 MP4_SDT_HAS_NO_DEPENDENTS = 0x08,
21 MP4_SDT_IS_DEPENDENT = 0x10,
22 MP4_SDT_IS_INDEPENDENT = 0x20,
23 MP4_SDT_EARLIER_DISPLAY_TIMES_ALLOWED = 0x40,
24 _MP4_SDT_RESERVED = 0x80
25} MP4SampleDependencyType;
26
87MP4V2_EXPORT
88 bool MP4ReadSample(
89 /* input parameters */
90 MP4FileHandle hFile,
91 MP4TrackId trackId,
92 MP4SampleId sampleId,
93 /* input/output parameters */
94 uint8_t** ppBytes,
95 uint32_t* pNumBytes,
96 /* output parameters */
97 MP4Timestamp* pStartTime DEFAULT(NULL),
98 MP4Duration* pDuration DEFAULT(NULL),
99 MP4Duration* pRenderingOffset DEFAULT(NULL),
100 bool* pIsSyncSample DEFAULT(NULL) );
101
165MP4V2_EXPORT
166 bool MP4ReadSampleFromTime(
167 /* input parameters */
168 MP4FileHandle hFile,
169 MP4TrackId trackId,
170 MP4Timestamp when,
171 /* input/output parameters */
172 uint8_t** ppBytes,
173 uint32_t* pNumBytes,
174 /* output parameters */
175 MP4Timestamp* pStartTime DEFAULT(NULL),
176 MP4Duration* pDuration DEFAULT(NULL),
177 MP4Duration* pRenderingOffset DEFAULT(NULL),
178 bool* pIsSyncSample DEFAULT(NULL) );
179
217MP4V2_EXPORT
218 bool MP4WriteSample(
219 MP4FileHandle hFile,
220 MP4TrackId trackId,
221 const uint8_t* pBytes,
222 uint32_t numBytes,
223 MP4Duration duration DEFAULT(MP4_INVALID_DURATION),
224 MP4Duration renderingOffset DEFAULT(0),
225 bool isSyncSample DEFAULT(true) );
226
265MP4V2_EXPORT
266 bool MP4WriteSampleDependency(
267 MP4FileHandle hFile,
268 MP4TrackId trackId,
269 const uint8_t* pBytes,
270 uint32_t numBytes,
271 MP4Duration duration,
272 MP4Duration renderingOffset,
273 bool isSyncSample,
274 uint32_t dependencyFlags );
275
308MP4V2_EXPORT
309 bool MP4CopySample(
310 MP4FileHandle srcFile,
311 MP4TrackId srcTrackId,
312 MP4SampleId srcSampleId,
313 MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE),
314 MP4TrackId dstTrackId DEFAULT(MP4_INVALID_TRACK_ID),
315 MP4Duration dstSampleDuration DEFAULT(MP4_INVALID_DURATION) );
316
342MP4V2_EXPORT
343 bool MP4EncAndCopySample(
344 MP4FileHandle srcFile,
345 MP4TrackId srcTrackId,
346 MP4SampleId srcSampleId,
347 encryptFunc_t encfcnp,
348 uint32_t encfcnparam1,
349 MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE),
350 MP4TrackId dstTrackId DEFAULT(MP4_INVALID_TRACK_ID),
351 MP4Duration dstSampleDuration DEFAULT(MP4_INVALID_DURATION) );
352
355MP4V2_EXPORT
356 bool MP4ReferenceSample(
357 MP4FileHandle srcFile,
358 MP4TrackId srcTrackId,
359 MP4SampleId srcSampleId,
360 MP4FileHandle dstFile,
361 MP4TrackId dstTrackId,
362 MP4Duration dstSampleDuration DEFAULT(MP4_INVALID_DURATION) );
363
376MP4V2_EXPORT
377uint32_t MP4GetSampleSize(
378 MP4FileHandle hFile,
379 MP4TrackId trackId,
380 MP4SampleId sampleId);
381
394MP4V2_EXPORT
395uint32_t MP4GetTrackMaxSampleSize(
396 MP4FileHandle hFile,
397 MP4TrackId trackId );
398
429MP4V2_EXPORT
430MP4SampleId MP4GetSampleIdFromTime(
431 MP4FileHandle hFile,
432 MP4TrackId trackId,
433 MP4Timestamp when,
434 bool wantSyncSample DEFAULT(false) );
435
454MP4V2_EXPORT
455MP4Timestamp MP4GetSampleTime(
456 MP4FileHandle hFile,
457 MP4TrackId trackId,
458 MP4SampleId sampleId );
459
478MP4V2_EXPORT
479MP4Duration MP4GetSampleDuration(
480 MP4FileHandle hFile,
481 MP4TrackId trackId,
482 MP4SampleId sampleId );
483
514MP4V2_EXPORT
515MP4Duration MP4GetSampleRenderingOffset(
516 MP4FileHandle hFile,
517 MP4TrackId trackId,
518 MP4SampleId sampleId );
519
540MP4V2_EXPORT
541 bool MP4SetSampleRenderingOffset(
542 MP4FileHandle hFile,
543 MP4TrackId trackId,
544 MP4SampleId sampleId,
545 MP4Duration renderingOffset );
546
559MP4V2_EXPORT
560int8_t MP4GetSampleSync(
561 MP4FileHandle hFile,
562 MP4TrackId trackId,
563 MP4SampleId sampleId );
564
567#endif /* MP4V2_SAMPLE_H */
MP4_INVALID_TRACK_ID
#define MP4_INVALID_TRACK_ID
Constant: invalid MP4TrackId.
Definition: general.h:49
MP4_INVALID_DURATION
#define MP4_INVALID_DURATION
Constant: invalid MP4Duration.
Definition: general.h:52
encryptFunc_t
uint32_t(* encryptFunc_t)(uint32_t, uint32_t, uint8_t *, uint32_t *, uint8_t **)
Encryption function pointer.
Definition: general.h:44
MP4_INVALID_FILE_HANDLE
#define MP4_INVALID_FILE_HANDLE
Constant: invalid MP4FileHandle.
Definition: general.h:48
MP4GetSampleSize
uint32_t MP4GetSampleSize(MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId)
Get size of a track sample.
MP4GetTrackMaxSampleSize
uint32_t MP4GetTrackMaxSampleSize(MP4FileHandle hFile, MP4TrackId trackId)
Get the maximum sample size of a track.
MP4ReadSampleFromTime
bool MP4ReadSampleFromTime(MP4FileHandle hFile, MP4TrackId trackId, MP4Timestamp when, uint8_t **ppBytes, uint32_t *pNumBytes, MP4Timestamp *pStartTime=NULL, MP4Duration *pDuration=NULL, MP4Duration *pRenderingOffset=NULL, bool *pIsSyncSample=NULL)
Read a track sample based on a specified time.
MP4GetSampleDuration
MP4Duration MP4GetSampleDuration(MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId)
Get the duration of a track sample.
MP4CopySample
bool MP4CopySample(MP4FileHandle srcFile, MP4TrackId srcTrackId, MP4SampleId srcSampleId, MP4FileHandle dstFile=MP4_INVALID_FILE_HANDLE, MP4TrackId dstTrackId=MP4_INVALID_TRACK_ID, MP4Duration dstSampleDuration=MP4_INVALID_DURATION)
Make a copy of a sample.
MP4SampleDependencyType_e
MP4SampleDependencyType_e
Sample dependency types.
Definition: sample.h:15
MP4GetSampleSync
int8_t MP4GetSampleSync(MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId)
Get sync/random access state of sample.
MP4SampleDependencyType
enum MP4SampleDependencyType_e MP4SampleDependencyType
Sample dependency types.
MP4WriteSampleDependency
bool MP4WriteSampleDependency(MP4FileHandle hFile, MP4TrackId trackId, const uint8_t *pBytes, uint32_t numBytes, MP4Duration duration, MP4Duration renderingOffset, bool isSyncSample, uint32_t dependencyFlags)
Write a track sample and supply dependency information.
MP4ReadSample
bool MP4ReadSample(MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId, uint8_t **ppBytes, uint32_t *pNumBytes, MP4Timestamp *pStartTime=NULL, MP4Duration *pDuration=NULL, MP4Duration *pRenderingOffset=NULL, bool *pIsSyncSample=NULL)
Read a track sample.
MP4ReferenceSample
bool MP4ReferenceSample(MP4FileHandle srcFile, MP4TrackId srcTrackId, MP4SampleId srcSampleId, MP4FileHandle dstFile, MP4TrackId dstTrackId, MP4Duration dstSampleDuration=MP4_INVALID_DURATION)
Not implemented.
MP4WriteSample
bool MP4WriteSample(MP4FileHandle hFile, MP4TrackId trackId, const uint8_t *pBytes, uint32_t numBytes, MP4Duration duration=MP4_INVALID_DURATION, MP4Duration renderingOffset=0, bool isSyncSample=true)
Write a track sample.
MP4GetSampleRenderingOffset
MP4Duration MP4GetSampleRenderingOffset(MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId)
Get the rendering offset of a track sample.
MP4EncAndCopySample
bool MP4EncAndCopySample(MP4FileHandle srcFile, MP4TrackId srcTrackId, MP4SampleId srcSampleId, encryptFunc_t encfcnp, uint32_t encfcnparam1, MP4FileHandle dstFile=MP4_INVALID_FILE_HANDLE, MP4TrackId dstTrackId=MP4_INVALID_TRACK_ID, MP4Duration dstSampleDuration=MP4_INVALID_DURATION)
Make a copy of a sample.
MP4GetSampleIdFromTime
MP4SampleId MP4GetSampleIdFromTime(MP4FileHandle hFile, MP4TrackId trackId, MP4Timestamp when, bool wantSyncSample=false)
Get sample id of a specified time.
MP4SetSampleRenderingOffset
bool MP4SetSampleRenderingOffset(MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId, MP4Duration renderingOffset)
Set the rendering offset of a track sample.
MP4GetSampleTime
MP4Timestamp MP4GetSampleTime(MP4FileHandle hFile, MP4TrackId trackId, MP4SampleId sampleId)
Get start time of track sample.
MP4_SDT_IS_DEPENDENT
@ MP4_SDT_IS_DEPENDENT
references other samples
Definition: sample.h:21
MP4_SDT_IS_INDEPENDENT
@ MP4_SDT_IS_INDEPENDENT
does not reference other samples
Definition: sample.h:22
MP4_SDT_UNKNOWN
@ MP4_SDT_UNKNOWN
unknown
Definition: sample.h:16
_MP4_SDT_RESERVED
@ _MP4_SDT_RESERVED
reserved
Definition: sample.h:24
MP4_SDT_HAS_REDUNDANT_CODING
@ MP4_SDT_HAS_REDUNDANT_CODING
contains redundant coding
Definition: sample.h:17
MP4_SDT_HAS_NO_DEPENDENTS
@ MP4_SDT_HAS_NO_DEPENDENTS
not referenced by other samples
Definition: sample.h:20
MP4_SDT_HAS_NO_REDUNDANT_CODING
@ MP4_SDT_HAS_NO_REDUNDANT_CODING
does not contain redundant coding
Definition: sample.h:18
MP4_SDT_HAS_DEPENDENTS
@ MP4_SDT_HAS_DEPENDENTS
referenced by other samples
Definition: sample.h:19
MP4_SDT_EARLIER_DISPLAY_TIMES_ALLOWED
@ MP4_SDT_EARLIER_DISPLAY_TIMES_ALLOWED
subequent samples in GOP may display earlier
Definition: sample.h:23