1MP4(3) MP4 File Format Library MP4(3)
2
3
4
6 MP4ReadSampleFromEditTime - Read a track sample based on a specified
7 edit list time
8
10 #include <mp4.h>
11
12 bool MP4ReadSampleFromEditTime(
13 MP4FileHandle hFile,
14 MP4TrackId trackId,
15 MP4Timestamp editWhen,
16 u_int8_t** ppBytes,
17 u_int32_t* pNumBytes,
18 MP4Timestamp* pStartTime = NULL,
19 MP4Duration* pDuration = NULL,
20 MP4Duration* pRenderingOffset = NULL,
21 bool pIsSyncSample = NULL
22 );
23
25 hFile Specifies the mp4 file to which the operation applies.
26
27 trackId
28 Specifies the track to which the operation applies.
29
30 editWhen
31 Specifies which sample is to be read based on a time in the edit
32 list timeline. See MP4GetSampleIdFromEditTime() for details.
33
34 ppBytes
35 Pointer to the pointer to the sample data. See DESCRIPTION for
36 details on this argument.
37
38 pNumBytes
39 Pointer to variable that will be hold the size in bytes of the
40 sample.
41
42 pStartTime
43 If non-NULL, pointer to variable that will receive the starting
44 timestamp for this sample. Caveat: The timestamp is in the track
45 timescale.
46
47 pDuration
48 If non-NULL, pointer to variable that will receive the duration
49 for this sample. Caveat: The duration is in the track timescale
50 units.
51
52 pRenderingOffset
53 If non-NULL, pointer to variable that will receive the rendering
54 offset for this sample. Currently the only media type that needs
55 this feature is MPEG video. Caveat: The offset is in the track
56 timescale units.
57
58 pIsSyncSample
59 If non-NULL, pointer to variable that will receive the state of
60 the sync/random access flag for this sample.
61
63 Upon success, true (1). Upon an error, false (0).
64
66 MP4ReadSampleFromEditTime reads the sample corresponding to the time on
67 the track edit list timeline from the specified track. Typically this
68 sample is then decoded in a codec dependent fashion and rendered in an
69 appropriate fashion.
70
71 The argument, ppBytes, allows for two possible approaches for buffer‐
72 ing:
73
74 If the calling application wishes to handle its own buffering it can
75 set *ppBytes to the buffer it wishes to use. The calling application is
76 responsible for ensuring that the buffer is large enough to hold the
77 sample. This can be done by using either MP4GetSampleSize() or MP4Get‐
78 TrackMaxSampleSize() to determine before-hand how large the receiving
79 buffer must be.
80
81 If the value of *ppBytes is NULL, then an appropriately sized buffer is
82 automatically malloc'ed for the sample data and *ppBytes set to this
83 pointer. The calling application is responsible for free'ing this mem‐
84 ory.
85
86 The last four arguments are pointers to variables that can receive
87 optional sample information.
88
89 Typically for audio none of these are needed. MPEG audio such as MP3 or
90 AAC has a fixed sample duration and every sample can be accessed at
91 random.
92
93 For video, all of these optional values could be needed. MPEG video can
94 be encoded at a variable frame rate, with only occasional random access
95 points, and with "B frames" which cause the rendering (display) order
96 of the video frames to differ from the storage/decoding order.
97
98 Other media types fall between these two extremes.
99
101 MP4(3) MP4ReadSample(3) MP4GetSampleIdFromEditTime(3) MP4ReadSample‐
102 FromTime(3)
103
104
105
106Cisco Systems Inc. Version 0.9 MP4(3)