MWCapture SDK Mac 3.4.62314

- Home
- Development Library
- Release Notes

mw_mp4.h
1
2// CONFIDENTIAL and PROPRIETARY software of Magewell Electronics Co., Ltd.
3// Copyright (c) 2011-2020 Magewell Electronics Co., Ltd. (Nanjing)
4// All rights reserved.
5// This copyright notice MUST be reproduced on all authorized copies.
7
8#ifndef MW_MP4_H
9#define MW_MP4_H
10
11#include <stdint.h>
12#if !defined( _WIN32 )
13#include <stdbool.h>
14#endif
15
16#ifdef _WIN32
17#ifdef MW_MP4_EXPORTS
18#define MW_MP4_API __declspec(dllexport)
19#else
20#define MW_MP4_API __declspec(dllimport)
21#endif
22#else
23#define MW_MP4_API
24#endif
25
26 typedef struct _mw_mp4_handle_t{int32_t r;} *mw_mp4_handle_t;
27
28 typedef enum _mw_mp4_status
29{
30 MW_MP4_STATUS_SUCCESS = 0,
31 MW_MP4_STATUS_UNEXPECTED_ERROR,
32 MW_MP4_STATUS_INVALID_PARAM,
33} mw_mp4_status_t;
34
35 typedef enum _mw_mp4_video_type {
36 MW_MP4_VIDEO_TYPE_UNKNOWN = 0,
37 MW_MP4_VIDEO_TYPE_H264 = 1,
38 MW_MP4_VIDEO_TYPE_HEVC = 2,
39 MW_MP4_VIDEO_TYPE_H265 = MW_MP4_VIDEO_TYPE_HEVC
40}mw_mp4_video_type_t;
41
42 typedef struct _mw_mp4_h264_parameter_set {
43 uint8_t* sps; // can be nullptr if it's contained in the stream
44 int16_t sps_size; // can be 0 if it's contained in the stream
45 uint8_t* pps; // can be nullptr if it's contained in the stream
46 int16_t pps_size; // can be 0 if it's contained in the stream
47} mw_mp4_h264_parameter_set_t;
48
49 typedef struct _mw_mp4_hevc_parameter_set {
50 uint8_t* sps; // can be nullptr if it's contained in the stream
51 int16_t sps_size; // can be 0 if it's contained in the stream
52 uint8_t* pps; // can be nullptr if it's contained in the stream
53 int16_t pps_size; // can be 0 if it's contained in the stream
54 uint8_t* vps; // can be nullptr if it's contained in the stream
55 int16_t vps_size; // can be 0 if it's contained in the stream
56} mw_mp4_hevc_parameter_set_t;
57
58 typedef struct _mw_mp4_video_info {
59 mw_mp4_video_type_t codec_type;
60 uint32_t timescale;
61 uint16_t width;
62 uint16_t height;
63
64 union{
65 mw_mp4_h264_parameter_set_t h264;
66 mw_mp4_hevc_parameter_set_t hevc;
67 };
68} mw_mp4_video_info_t;
69
70 typedef enum _mw_mp4_audio_type {
71 MW_MP4_AUDIO_TYPE_UNKNOWN = 0,
72 MW_MP4_AUDIO_TYPE_AAC = 1,
73 MW_MP4_AUDIO_TYPE_ADTS_AAC = 2
74}mw_mp4_audio_codec_t;
75
76 typedef struct _mw_mp4_audio_info {
77 mw_mp4_audio_codec_t codec_type;
78 uint32_t timescale;
79 uint16_t sample_rate; // can be 0 if codec is aac with adts
80 uint16_t channels; // can be 0 if codec is aac with adts
81 uint8_t profile; // can be 0 if codec is aac with adts
82} mw_mp4_audio_info_t;
83
84 typedef enum _mw_mp4_subtitle_type {
85 MW_MP4_SUBTITLE_TYPE_UNKNOWN = 0,
86 MW_MP4_SUBTITLE_TYPE_CC608 = 1,
87 MW_MP4_SUBTITLE_TYPE_CC708 = 2
88}mw_mp4_subtitle_type_t;
89
90 typedef struct _mw_mp4_subtitle_info {
91 mw_mp4_subtitle_type_t codec_type;
92 uint32_t timescale;
93} mw_mp4_subtitle_info_t;
94
95#ifdef __cplusplus
96 extern "C"
97{
98#endif
99
106MW_MP4_API
107 mw_mp4_handle_t mw_mp4_open(const char * p_path);
108
116MW_MP4_API
117 mw_mp4_handle_t mw_mp4_open_ex(const wchar_t * p_path);
118
126MW_MP4_API
127mw_mp4_status_t mw_mp4_set_video(mw_mp4_handle_t handle, const mw_mp4_video_info_t* p_info);
128
136MW_MP4_API
137mw_mp4_status_t mw_mp4_set_audio(mw_mp4_handle_t handle, const mw_mp4_audio_info_t* p_info);
138
146MW_MP4_API
147mw_mp4_status_t mw_mp4_set_subtitle(mw_mp4_handle_t handle, const mw_mp4_subtitle_info_t* p_info);
148
158MW_MP4_API
159mw_mp4_status_t mw_mp4_write_video(mw_mp4_handle_t handle, const uint8_t * p_stream, uint32_t size, uint64_t timestamp);
160
170MW_MP4_API
171mw_mp4_status_t mw_mp4_write_audio(mw_mp4_handle_t handle, const uint8_t * p_stream, uint32_t size, uint64_t timestamp);
172
182MW_MP4_API
183mw_mp4_status_t mw_mp4_write_subtitle(mw_mp4_handle_t handle, const uint8_t * p_stream, uint32_t size, uint64_t timestamp);
184
191MW_MP4_API
192mw_mp4_status_t mw_mp4_close(mw_mp4_handle_t handle);
193
201MW_MP4_API
202mw_mp4_status_t mw_mp4_repair(const char * p_path, bool del);
203
211MW_MP4_API
212mw_mp4_status_t mw_mp4_repair_ex(const wchar_t * p_path, bool del);
213#ifdef __cplusplus
214}
215#endif
216#endif
_mw_mp4_audio_info
Definition: mw_mp4.h:76
_mw_mp4_h264_parameter_set
Definition: mw_mp4.h:42
_mw_mp4_handle_t
Definition: mw_mp4.h:26
_mw_mp4_hevc_parameter_set
Definition: mw_mp4.h:49
_mw_mp4_subtitle_info
Definition: mw_mp4.h:90
_mw_mp4_video_info
Definition: mw_mp4.h:58