More fixes, moves, etc. don't really remember what I did here.
[libmkv.git] / include / libmkv.h
blob38d0aeb7f2a084c08c291a9335a78034bf022ffc
1 /*****************************************************************************
2 * matroska.h:
3 *****************************************************************************
4 * Copyright (C) 2005 x264 project
5 * $Id: $
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 *****************************************************************************/
24 #ifndef _LIBMKV_H
25 #define _LIBMKV_H 1
27 #ifdef HAVE_STDINT_H
28 #include <stdint.h>
29 #else
30 #include <inttypes.h>
31 #endif
33 /* Video codecs */
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"
41 /* Audio codecs */
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"
55 /* Subtitles */
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
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
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)
85 char flagDefault;
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)
89 unsigned maxCache;
90 int64_t defaultDuration; // Optional: Number of nanoseconds per frame.
91 char *name;
92 char *language;
93 char *codecID; // Required: See codecs above.
94 void *codecPrivate;
95 unsigned codecPrivateSize;
96 char *codecName;
97 mk_VideoConfig *video;
98 mk_AudioConfig *audio;
99 mk_Track *track; // Handle for this track.
102 struct mk_VideoConfig_s {
103 char flagInterlaced;
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,
118 int64_t timescale);
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 );
127 #ifdef __cplusplus
129 #endif
131 #endif