#include <cafe/mp4dmx.h>

///MP4 Sample Data Structure
typedef struct{
    ///Sample data start pointer
    void        *unit;
    ///Sample data Size
    s32         unit_size;
    ///Sample data offset
    s32         offset;
    ///Point synchronization flag
    s32         unit_code;
    ///Time Stamp
    u64         time_stamp;
    s32         duration;
    s32         descript_index;
    ///EEnd processing output flag
    s32         process_flag;
    ///Starting offset of the chunk
    u64         chunk_offset;
    ///Chunk Size
    u64         chunk_size;
    s32         num_of_sample;
    ///Show Time offset(If there is a B picture is always zero)
    ///Show Time(PTS) = time_stamp + cmp_offset
    s32         cmp_offset;
    s32         reserved[17];


unit ES media data.
unit_size The media data size.
offset An offset from the start of the MP4 data file to the media data.
unit_code This is used to specify key frames, for which it is MP4DMX_VIDEO_KEYFRAME.
time_stamp The timestamp (in milliseconds) at which media data is decoded.
duration The duration (in milliseconds) for which media data is displayed.
descript_index A description index.
process_flag A flag that indicates what the data contains. A value of MP4DMX_FLUSHED_DATA indicates data that was flushed when demultiplexing stopped (during the end process).
chunk_offset Starting offset address to the chunk with the corresponding unit. (Do not use the offset to a chunk that belongs to a moof Box because its value is not guaranteed.)
chunk_size The sum of the sample sizes included in the relevant chunk. (Do not use the total sample size of a chunk that belongs to a moof Box because its value is not guaranteed.)
num_of_sample The number of samples.
cmp_offset The offset to the presentation timestamp (PTS). (PTS = time_stamp + cmp_offset.)
reserved A reserved region for extensions.


This structure stores media data size, display timestamp, track index, and other attributes of media data, as well as the value of offset into the MP4 data file, indicating the location of the output data. Extracted data is given in units of Video Object Planes (VOPs) for video, and in frames for audio.

Data output as video data will consist of AVCSample data location information.

Data Structure for Video Output Data within a MediaDataBox

One unit of AVCSample is one unit of MP4DMXMpoUNIT. The beginning of the MP4DMXMpoUNIT is output as the offset, and NALUnitLength is output as the data size.

NALUnitLength can be obtained using the utility functions for retrieving information.

See Also


Revision History

2014/07/31 Initial topic creation.