1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2005 x264 project
7 * Authors: Mike Matsnev
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
34 #define MK_VCODEC_MPEG1 "V_MPEG1"
35 #define MK_VCODEC_MPEG2 "V_MPEG2"
36 #define MK_VCODEC_THEORA "V_THEORA"
37 #define MK_VCODEC_SNOW "V_SNOW"
38 #define MK_VCODEC_MP4ASP "V_MPEG4/ISO/ASP"
39 #define MK_VCODEC_MP4AVC "V_MPEG4/ISO/AVC"
42 #define MK_ACODEC_AC3 "A_AC3"
43 #define MK_ACODEC_MP3 "A_MPEG/L3"
44 #define MK_ACODEC_MP2 "A_MPEG/L2"
45 #define MK_ACODEC_MP1 "A_MPEG/L1"
46 #define MK_ACODEC_DTS "A_DTS"
47 #define MK_ACODEC_PCMINTLE "A_PCM/INT/LIT"
48 #define MK_ACODEC_PCMFLTLE "A_PCM/FLOAT/IEEE"
49 #define MK_ACODEC_TTA1 "A_TTA1"
50 #define MK_ACODEC_WAVPACK "A_WAVPACK4"
51 #define MK_ACODEC_VORBIS "A_VORBIS"
52 #define MK_ACODEC_FLAC "A_FLAC"
53 #define MK_ACODEC_AAC "A_AAC"
56 #define MK_SUBTITLE_ASCII "S_TEXT/ASCII"
57 #define MK_SUBTITLE_UTF8 "S_TEXT/UTF8"
58 #define MK_SUBTITLE_SSA "S_TEXT/SSA"
59 #define MK_SUBTITLE_ASS "S_TEXT/ASS"
60 #define MK_SUBTITLE_USF "S_TEXT/USF"
61 #define MK_SUBTITLE_VOBSUB "S_VOBSUB"
63 #define MK_TRACK_VIDEO 0x01
64 #define MK_TRACK_AUDIO 0x02
65 #define MK_TRACK_COMPLEX 0x03
66 #define MK_TRACK_LOGO 0x10
67 #define MK_TRACK_SUBTITLE 0x11
68 #define MK_TRACK_BUTTONS 0x12
69 #define MK_TRACK_CONTROL 0x20
75 typedef struct mk_Writer_s mk_Writer
;
76 typedef struct mk_Track_s mk_Track
;
77 typedef struct mk_TrackConfig_s mk_TrackConfig
;
78 typedef struct mk_VideoConfig_s mk_VideoConfig
;
79 typedef struct mk_AudioConfig_s mk_AudioConfig
;
81 struct mk_TrackConfig_s
{
82 unsigned trackUID
; // Optional: Unique identifier for the track.
83 unsigned trackType
; // Required: 1 = Video, 2 = Audio.
84 char flagEnabled
; // Optional: Set 1 if the track is used (Default: enabled)
86 char flagForced
; // Optional: Set 1 if the track MUST be shown during playback (Default: disabled)
87 char flagLacing
; // Required: Set 1 if the track may contain blocks using lacing.
88 unsigned minCache
; // Optional: See Matroska spec. (Default: cache disabled)
90 int64_t defaultDuration
; // Optional: Number of nanoseconds per frame.
93 char *codecID
; // Required: See codecs above.
95 unsigned codecPrivateSize
;
97 mk_VideoConfig
*video
;
98 mk_AudioConfig
*audio
;
99 mk_Track
*track
; // Handle for this track.
102 struct mk_VideoConfig_s
{
104 unsigned width
; // Pixel width
105 unsigned height
; // Pixel height
106 unsigned d_width
; // Display width
107 unsigned d_height
; // Display height
110 struct mk_AudioConfig_s
{
111 float samplingFreq
; // Sampling Frequency in Hz
112 unsigned channels
; // Number of channels for this track
113 unsigned bitDepth
; // Bits per sample (PCM)
116 mk_Writer
*mk_createWriter(const char *filename
,
117 // int64_t default_frame_duration,
119 mk_Track
*mk_createTrack(mk_Writer
*w
, mk_TrackConfig
*tc
);
120 int mk_writeHeader(mk_Writer
*w
, const char *writingApp
);
122 int mk_startFrame( mk_Writer
*w
, mk_Track
*track
);
123 int mk_addFrameData(mk_Writer
*w
, mk_Track
*track
, const void *data
, unsigned size
);
124 int mk_setFrameFlags(mk_Writer
*w
, mk_Track
*track
, int64_t timestamp
, int keyframe
);
125 int mk_close( mk_Writer
*w
);