1MP4(3) MP4 File Format Library MP4(3)
2
3
4
6 MP4WriteSample - Write a track sample
7
9 #include <mp4.h>
10
11 bool MP4WriteSample(
12 MP4FileHandle hFile,
13 MP4TrackId trackId,
14 u_int8_t* pBytes,
15 u_int32_t numBytes,
16 MP4Duration duration = MP4_INVALID_DURATION,
17 MP4Duration renderingOffset = 0,
18 bool isSyncSample = true
19 );
20
22 hFile Specifies the mp4 file to which the operation applies.
23
24 trackId
25 Specifies the track to which the operation applies.
26
27 pBytes Pointer to the sample data.
28
29 numBytes
30 The size in bytes of the sample.
31
32 duration
33 The duration for this sample. Caveat: The duration should be in
34 the track timescale units.
35
36 renderingOffset
37 The rendering offset for this sample. Currently the only media
38 type that needs this feature is MPEG video. Caveat: The offset
39 should be in the track timescale units.
40
41 isSyncSample
42 The sync/random access flag for this sample.
43
45 Upon success, true (1). Upon an error, false (0).
46
48 MP4WriteSample writes the given sample at the end of the specified
49 track. Currently the library does not support random insertion of sam‐
50 ples into the track timeline. Note that with mp4 there cannot be any
51 holes or overlapping samples in the track timeline. The last three
52 arguments give optional sample information.
53
54 The value of duration can be given as MP4_INVALID_DURATION if all sam‐
55 ples in the track have the same duration. This can be specified with
56 MP4AddTrack() and related functions.
57
58 Typically for audio none of the optional arguments are needed. MPEG
59 audio such as MP3 or AAC has a fixed sample duration and every sample
60 can be accessed at random.
61
62 For video, all of the optional arguments could be needed. MPEG video
63 can be encoded at a variable frame rate, with only occasional random
64 access points, and with "B frames" which cause the rendering (display)
65 order of the video frames to differ from the storage/decoding order.
66
67 Other media types fall between these two extremes.
68
70 MP4(3)
71
72
73
74Cisco Systems Inc. Version 0.9 MP4(3)