1MP4(3) MP4 File Format Library MP4(3)
2
3
4
6 MP4CopySample - Make a copy of a specified sample
7
9 #include <mp4.h>
10
11 MP4TrackId MP4CopySample(
12 MP4FileHandle srcFile,
13 MP4TrackId srcTrackId,
14 MP4SampleId srcSampleId,
15 MP4FileHandle dstFile = MP4_INVALID_FILE_HANDLE,
16 MP4TrackId dstTrackId = MP4_INVALID_TRACK_ID,
17 MP4Duration dstSampleDuration = MP4_INVALID_DURATION
18 )
19
21 srcFile
22 Specifies the mp4 file of the source of the operation.
23
24 srcTrackId
25 Specifies the track of the source sample.
26
27 srcSampleId
28 Specifies the sample to be copied.
29
30 dstFile
31 Specifies the mp4 file of the new, copied sample. If the value
32 is MP4_INVALID_FILE_HANDLE, the new sample is created in the
33 same file as the source sample.
34
35 dstTrackId
36 Specifies the track of the new sample. If the value is
37 MP4_INVALID_TRACK_ID, the new sample is created in the same
38 track as the source sample.
39
40 dstSampleDuration
41 Specifies the duration in the track time scale of the new sam‐
42 ple. If the value is MP4_INVALID_DURATION, then the duration of
43 the source sample is used.
44
46 Upon success, the sample id of the new sample. Upon an error,
47 MP4_INVALID_SAMPLE_ID.
48
49
51 MP4CopySample creates a new sample based on an existing sample. Note
52 that another copy of the media sample data is created in the file using
53 this function. I.e. this call is equivalent to MP4ReadSample() followed
54 by MP4WriteSample().
55
56 Note that is the responsibility of the caller to ensure that the copied
57 media sample makes sense in the destination track. E.g. copying a video
58 sample to an audio track is unlikely to result in anything good happen‐
59 ing, even copying a sample from video track to another requires that
60 the tracks use the same encoding and that issues such as image size are
61 addressed.
62
63
65 MP4(3) MP4ReadSample(3) MP4WriteSample(3)
66
67
68
69Cisco Systems Inc. Version 0.9 MP4(3)