Changes of Revision 26
makemkv.spec
Changed
x
1
2
3
Name: makemkv
4
Summary: DVD and BlueRay Ripping tool
5
-Version: 1.8.5
6
+Version: 1.8.6
7
Release: 0.pm.1
8
License: see eula_en_linux.txt
9
Group: Productivity/Multimedia/Video/Editors and Convertors
10
11
12
13
%changelog
14
+* Mon Nov 11 2013 Manfred Tremmel <Manfred.Tremmel@iiv.de> - 1.8.6-0.pm.1
15
+- update to 1.8.6
16
* Sat Sep 14 2013 Manfred Tremmel <Manfred.Tremmel@iiv.de> - 1.8.5-0.pm.1
17
- update to 1.8.5
18
* Wed May 22 2013 Manfred Tremmel <Manfred.Tremmel@iiv.de> - 1.8.3-0.pm.1
19
makemkv-bin-1.8.5.tar.gz/bin/amd64/makemkvcon -> makemkv-bin-1.8.6.tar.gz/bin/amd64/makemkvcon
Changed
makemkv-bin-1.8.5.tar.gz/bin/i386/makemkvcon -> makemkv-bin-1.8.6.tar.gz/bin/i386/makemkvcon
Changed
makemkv-bin-1.8.5.tar.gz/bin/i386/mmdtsdec -> makemkv-bin-1.8.6.tar.gz/bin/i386/mmdtsdec
Changed
makemkv-bin-1.8.5.tar.gz/src/share/makemkv_chi.mo.gz -> makemkv-bin-1.8.6.tar.gz/src/share/makemkv_chi.mo.gz
Changed
makemkv-bin-1.8.5.tar.gz/src/share/makemkv_ita.mo.gz -> makemkv-bin-1.8.6.tar.gz/src/share/makemkv_ita.mo.gz
Changed
makemkv-bin-1.8.5.tar.gz/src/share/makemkv_pol.mo.gz -> makemkv-bin-1.8.6.tar.gz/src/share/makemkv_pol.mo.gz
Changed
makemkv-oss-1.8.5.tar.gz/libffcodec
Deleted
2
1
-(directory)
2
makemkv-oss-1.8.5.tar.gz/libffcodec/inc
Deleted
2
1
-(directory)
2
makemkv-oss-1.8.5.tar.gz/libffcodec/inc/ffcodec
Deleted
2
1
-(directory)
2
makemkv-oss-1.8.5.tar.gz/libffcodec/inc/ffcodec/ffcodec.h
Deleted
10
1
2
-/*
3
- Written by GuinpinSoft inc <oss@makemkv.com>
4
-
5
- This file is hereby placed into public domain,
6
- no copyright is claimed.
7
-
8
-*/
9
-#include "../../src/ffcodec.h"
10
makemkv-oss-1.8.5.tar.gz/libffcodec/src
Deleted
2
1
-(directory)
2
makemkv-oss-1.8.5.tar.gz/libffcodec/src/audioconvert.c
Deleted
173
1
2
-/*
3
- * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
4
- *
5
- * This file is part of FFmpeg.
6
- *
7
- * FFmpeg is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
11
- *
12
- * FFmpeg is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with FFmpeg; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
- */
21
-
22
-/**
23
- * @file
24
- * audio conversion routines
25
- */
26
-
27
-#include "avstring.h"
28
-#include "avutil.h"
29
-#include "audioconvert.h"
30
-
31
-static const char * const channel_names[] = {
32
- [0] = "FL", /* front left */
33
- [1] = "FR", /* front right */
34
- [2] = "FC", /* front center */
35
- [3] = "LFE", /* low frequency */
36
- [4] = "BL", /* back left */
37
- [5] = "BR", /* back right */
38
- [6] = "FLC", /* front left-of-center */
39
- [7] = "FRC", /* front right-of-center */
40
- [8] = "BC", /* back-center */
41
- [9] = "SL", /* side left */
42
- [10] = "SR", /* side right */
43
- [11] = "TC", /* top center */
44
- [12] = "TFL", /* top front left */
45
- [13] = "TFC", /* top front center */
46
- [14] = "TFR", /* top front right */
47
- [15] = "TBL", /* top back left */
48
- [16] = "TBC", /* top back center */
49
- [17] = "TBR", /* top back right */
50
- [29] = "DL", /* downmix left */
51
- [30] = "DR", /* downmix right */
52
-};
53
-
54
-static const char *get_channel_name(int channel_id)
55
-{
56
- if (channel_id < 0 || channel_id >= FF_ARRAY_ELEMS(channel_names))
57
- return NULL;
58
- return channel_names[channel_id];
59
-}
60
-
61
-static const struct {
62
- const char *name;
63
- int nb_channels;
64
- uint64_t layout;
65
-} channel_layout_map[] = {
66
- { "mono", 1, AV_CH_LAYOUT_MONO },
67
- { "stereo", 2, AV_CH_LAYOUT_STEREO },
68
- { "2.1", 3, AV_CH_LAYOUT_2POINT1 },
69
- { "4.0", 4, AV_CH_LAYOUT_4POINT0 },
70
- { "quad", 4, AV_CH_LAYOUT_QUAD },
71
- { "5.0", 5, AV_CH_LAYOUT_5POINT0_BACK },
72
- { "5.0(side)", 5, AV_CH_LAYOUT_5POINT0 },
73
- { "5.1", 6, AV_CH_LAYOUT_5POINT1_BACK },
74
- { "5.1(side)", 6, AV_CH_LAYOUT_5POINT1 },
75
- { "7.1", 8, AV_CH_LAYOUT_7POINT1 },
76
- { "7.1(wide)", 8, AV_CH_LAYOUT_7POINT1_WIDE },
77
- { "downmix", 2, AV_CH_LAYOUT_STEREO_DOWNMIX, },
78
- { 0 }
79
-};
80
-
81
-static uint64_t get_channel_layout_single(const char *name, int name_len)
82
-{
83
- int i;
84
- char *end;
85
- int64_t layout;
86
-
87
- for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map) - 1; i++) {
88
- if (strlen(channel_layout_map[i].name) == name_len &&
89
- !memcmp(channel_layout_map[i].name, name, name_len))
90
- return channel_layout_map[i].layout;
91
- }
92
- for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++)
93
- if (channel_names[i] &&
94
- strlen(channel_names[i]) == name_len &&
95
- !memcmp(channel_names[i], name, name_len))
96
- return (int64_t)1 << i;
97
- i = strtol(name, &end, 10);
98
- if (end - name == name_len ||
99
- (end + 1 - name == name_len && *end == 'c'))
100
- return av_get_default_channel_layout(i);
101
- layout = strtoll(name, &end, 0);
102
- if (end - name == name_len)
103
- return FFMAX(layout, 0);
104
- return 0;
105
-}
106
-
107
-uint64_t av_get_channel_layout(const char *name)
108
-{
109
- const char *n, *e;
110
- const char *name_end = name + strlen(name);
111
- int64_t layout = 0, layout_single;
112
-
113
- for (n = name; n < name_end; n = e + 1) {
114
- for (e = n; e < name_end && *e != '+' && *e != '|'; e++);
115
- layout_single = get_channel_layout_single(n, e - n);
116
- if (!layout_single)
117
- return 0;
118
- layout |= layout_single;
119
- }
120
- return layout;
121
-}
122
-
123
-void av_get_channel_layout_string(char *buf, int buf_size,
124
- int nb_channels, uint64_t channel_layout)
125
-{
126
- int i;
127
-
128
- if (nb_channels <= 0)
129
- nb_channels = av_get_channel_layout_nb_channels(channel_layout);
130
-
131
- for (i = 0; channel_layout_map[i].name; i++)
132
- if (nb_channels == channel_layout_map[i].nb_channels &&
133
- channel_layout == channel_layout_map[i].layout) {
134
- av_strlcpy(buf, channel_layout_map[i].name, buf_size);
135
- return;
136
- }
137
-
138
- snprintf(buf, buf_size, "%d channels", nb_channels);
139
- if (channel_layout) {
140
- int i, ch;
141
- av_strlcat(buf, " (", buf_size);
142
- for (i = 0, ch = 0; i < 64; i++) {
143
- if ((channel_layout & (UINT64_C(1) << i))) {
144
- const char *name = get_channel_name(i);
145
- if (name) {
146
- if (ch > 0)
147
- av_strlcat(buf, "+", buf_size);
148
- av_strlcat(buf, name, buf_size);
149
- }
150
- ch++;
151
- }
152
- }
153
- av_strlcat(buf, ")", buf_size);
154
- }
155
-}
156
-
157
-int av_get_channel_layout_nb_channels(uint64_t channel_layout)
158
-{
159
- int count;
160
- uint64_t x = channel_layout;
161
- for (count = 0; x; count++)
162
- x &= x-1; // unset lowest set bit
163
- return count;
164
-}
165
-
166
-int64_t av_get_default_channel_layout(int nb_channels) {
167
- int i;
168
- for (i = 0; channel_layout_map[i].name; i++)
169
- if (nb_channels == channel_layout_map[i].nb_channels)
170
- return channel_layout_map[i].layout;
171
- return 0;
172
-}
173
makemkv-oss-1.8.5.tar.gz/libffcodec/src/audioconvert.h
Deleted
149
1
2
-/*
3
- * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
4
- * Copyright (c) 2008 Peter Ross
5
- *
6
- * This file is part of FFmpeg.
7
- *
8
- * FFmpeg is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * FFmpeg is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with FFmpeg; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-#ifndef AVUTIL_AUDIOCONVERT_H
24
-#define AVUTIL_AUDIOCONVERT_H
25
-
26
-#include <stdint.h>
27
-
28
-/**
29
- * @file
30
- * audio conversion routines
31
- */
32
-
33
-/**
34
- * @addtogroup lavu_audio
35
- * @{
36
- */
37
-
38
-/**
39
- * @defgroup channel_masks Audio channel masks
40
- * @{
41
- */
42
-#define AV_CH_FRONT_LEFT 0x00000001
43
-#define AV_CH_FRONT_RIGHT 0x00000002
44
-#define AV_CH_FRONT_CENTER 0x00000004
45
-#define AV_CH_LOW_FREQUENCY 0x00000008
46
-#define AV_CH_BACK_LEFT 0x00000010
47
-#define AV_CH_BACK_RIGHT 0x00000020
48
-#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040
49
-#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080
50
-#define AV_CH_BACK_CENTER 0x00000100
51
-#define AV_CH_SIDE_LEFT 0x00000200
52
-#define AV_CH_SIDE_RIGHT 0x00000400
53
-#define AV_CH_TOP_CENTER 0x00000800
54
-#define AV_CH_TOP_FRONT_LEFT 0x00001000
55
-#define AV_CH_TOP_FRONT_CENTER 0x00002000
56
-#define AV_CH_TOP_FRONT_RIGHT 0x00004000
57
-#define AV_CH_TOP_BACK_LEFT 0x00008000
58
-#define AV_CH_TOP_BACK_CENTER 0x00010000
59
-#define AV_CH_TOP_BACK_RIGHT 0x00020000
60
-#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix.
61
-#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT.
62
-#define AV_CH_WIDE_LEFT 0x0000000080000000ULL
63
-#define AV_CH_WIDE_RIGHT 0x0000000100000000ULL
64
-#define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL
65
-#define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL
66
-
67
-/** Channel mask value used for AVCodecContext.request_channel_layout
68
- to indicate that the user requests the channel order of the decoder output
69
- to be the native codec channel order. */
70
-#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL
71
-
72
-/**
73
- * @}
74
- * @defgroup channel_mask_c Audio channel convenience macros
75
- * @{
76
- * */
77
-#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER)
78
-#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
79
-#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY)
80
-#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
81
-#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
82
-#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)
83
-#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
84
-#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY)
85
-#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
86
-#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
87
-#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
88
-#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
89
-#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
90
-#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
91
-#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)
92
-#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
93
-#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)
94
-#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)
95
-#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)
96
-#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)
97
-#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
98
-#define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
99
-#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
100
-#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
101
-#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
102
-#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
103
-
104
-/**
105
- * @}
106
- */
107
-
108
-/**
109
- * Return a channel layout id that matches name, 0 if no match.
110
- * name can be one or several of the following notations,
111
- * separated by '+' or '|':
112
- * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0,
113
- * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix);
114
- * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC,
115
- * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR);
116
- * - a number of channels, in decimal, optionnally followed by 'c', yielding
117
- * the default channel layout for that number of channels (@see
118
- * av_get_default_channel_layout);
119
- * - a channel layout mask, in hexadecimal starting with "0x" (see the
120
- * AV_CH_* macros).
121
- + Example: "stereo+FC" = "2+FC" = "2c+1c" = "0x7"
122
- */
123
-uint64_t av_get_channel_layout(const char *name);
124
-
125
-/**
126
- * Return a description of a channel layout.
127
- * If nb_channels is <= 0, it is guessed from the channel_layout.
128
- *
129
- * @param buf put here the string containing the channel layout
130
- * @param buf_size size in bytes of the buffer
131
- */
132
-void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout);
133
-
134
-/**
135
- * Return the number of channels in the channel layout.
136
- */
137
-int av_get_channel_layout_nb_channels(uint64_t channel_layout);
138
-
139
-/**
140
- * Return default channel layout for a given number of channels.
141
- */
142
-int64_t av_get_default_channel_layout(int nb_channels);
143
-
144
-/**
145
- * @}
146
- */
147
-
148
-#endif /* AVUTIL_AUDIOCONVERT_H */
149
makemkv-oss-1.8.5.tar.gz/libffcodec/src/aviobuf.c
Deleted
227
1
2
-/*
3
- * buffered I/O
4
- * Copyright (c) 2000,2001 Fabrice Bellard
5
- *
6
- * This file is part of FFmpeg.
7
- *
8
- * FFmpeg is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * FFmpeg is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with FFmpeg; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-#include "misc.h"
24
-
25
-void avio_wl32(AVIOContext *s, unsigned int val)
26
-{
27
- avio_w8(s, val);
28
- avio_w8(s, val >> 8);
29
- avio_w8(s, val >> 16);
30
- avio_w8(s, val >> 24);
31
-}
32
-
33
-void avio_wb32(AVIOContext *s, unsigned int val)
34
-{
35
- avio_w8(s, val >> 24);
36
- avio_w8(s, val >> 16);
37
- avio_w8(s, val >> 8);
38
- avio_w8(s, val);
39
-}
40
-
41
-#define GET(name, type) \
42
- type get_be ##name(AVIOContext *s) \
43
-{\
44
- return avio_rb ##name(s);\
45
-}\
46
- type get_le ##name(AVIOContext *s) \
47
-{\
48
- return avio_rl ##name(s);\
49
-}
50
-
51
-GET(16, unsigned int)
52
-GET(24, unsigned int)
53
-GET(32, unsigned int)
54
-GET(64, uint64_t)
55
-
56
-#undef GET
57
-
58
-#define PUT(name, type ) \
59
- void put_le ##name(AVIOContext *s, type val)\
60
-{\
61
- avio_wl ##name(s, val);\
62
-}\
63
- void put_be ##name(AVIOContext *s, type val)\
64
-{\
65
- avio_wb ##name(s, val);\
66
-}
67
-
68
-PUT(16, unsigned int)
69
-PUT(24, unsigned int)
70
-PUT(32, unsigned int)
71
-PUT(64, uint64_t)
72
-#undef PUT
73
-
74
-int get_byte(AVIOContext *s)
75
-{
76
- return avio_r8(s);
77
-}
78
-int get_buffer(AVIOContext *s, unsigned char *buf, int size)
79
-{
80
- return avio_read(s, buf, size);
81
-}
82
-void put_byte(AVIOContext *s, int val)
83
-{
84
- avio_w8(s, val);
85
-}
86
-void put_buffer(AVIOContext *s, const unsigned char *buf, int size)
87
-{
88
- avio_write(s, buf, size);
89
-}
90
-
91
-int avio_put_str(AVIOContext *s, const char *str)
92
-{
93
- int len = 1;
94
- if (str) {
95
- len += strlen(str);
96
- avio_write(s, (const unsigned char *) str, len);
97
- } else
98
- avio_w8(s, 0);
99
- return len;
100
-}
101
-
102
-void avio_wl64(AVIOContext *s, uint64_t val)
103
-{
104
- avio_wl32(s, (uint32_t)(val & 0xffffffff));
105
- avio_wl32(s, (uint32_t)(val >> 32));
106
-}
107
-
108
-void avio_wb64(AVIOContext *s, uint64_t val)
109
-{
110
- avio_wb32(s, (uint32_t)(val >> 32));
111
- avio_wb32(s, (uint32_t)(val & 0xffffffff));
112
-}
113
-
114
-void avio_wl16(AVIOContext *s, unsigned int val)
115
-{
116
- avio_w8(s, val);
117
- avio_w8(s, val >> 8);
118
-}
119
-
120
-void avio_wb16(AVIOContext *s, unsigned int val)
121
-{
122
- avio_w8(s, val >> 8);
123
- avio_w8(s, val);
124
-}
125
-
126
-void avio_wl24(AVIOContext *s, unsigned int val)
127
-{
128
- avio_wl16(s, val & 0xffff);
129
- avio_w8(s, val >> 16);
130
-}
131
-
132
-void avio_wb24(AVIOContext *s, unsigned int val)
133
-{
134
- avio_wb16(s, val >> 8);
135
- avio_w8(s, val);
136
-}
137
-
138
-unsigned int avio_rl16(AVIOContext *s)
139
-{
140
- unsigned int val;
141
- val = avio_r8(s);
142
- val |= avio_r8(s) << 8;
143
- return val;
144
-}
145
-
146
-unsigned int avio_rl24(AVIOContext *s)
147
-{
148
- unsigned int val;
149
- val = avio_rl16(s);
150
- val |= avio_r8(s) << 16;
151
- return val;
152
-}
153
-
154
-unsigned int avio_rl32(AVIOContext *s)
155
-{
156
- unsigned int val;
157
- val = avio_rl16(s);
158
- val |= avio_rl16(s) << 16;
159
- return val;
160
-}
161
-
162
-uint64_t avio_rl64(AVIOContext *s)
163
-{
164
- uint64_t val;
165
- val = (uint64_t)avio_rl32(s);
166
- val |= (uint64_t)avio_rl32(s) << 32;
167
- return val;
168
-}
169
-
170
-unsigned int avio_rb16(AVIOContext *s)
171
-{
172
- unsigned int val;
173
- val = avio_r8(s) << 8;
174
- val |= avio_r8(s);
175
- return val;
176
-}
177
-
178
-unsigned int avio_rb24(AVIOContext *s)
179
-{
180
- unsigned int val;
181
- val = avio_rb16(s) << 8;
182
- val |= avio_r8(s);
183
- return val;
184
-}
185
-unsigned int avio_rb32(AVIOContext *s)
186
-{
187
- unsigned int val;
188
- val = avio_rb16(s) << 16;
189
- val |= avio_rb16(s);
190
- return val;
191
-}
192
-
193
-int ff_get_line(AVIOContext *s, char *buf, int maxlen)
194
-{
195
- int i = 0;
196
- char c;
197
-
198
- do {
199
- c = avio_r8(s);
200
- if (c && i < maxlen-1)
201
- buf[i++] = c;
202
- } while (c != '\n' && c);
203
-
204
- buf[i] = 0;
205
- return i;
206
-}
207
-
208
-uint64_t avio_rb64(AVIOContext *s)
209
-{
210
- uint64_t val;
211
- val = (uint64_t)avio_rb32(s) << 32;
212
- val |= (uint64_t)avio_rb32(s);
213
- return val;
214
-}
215
-
216
-uint64_t ffio_read_varlen(AVIOContext *bc){
217
- uint64_t val = 0;
218
- int tmp;
219
-
220
- do{
221
- tmp = avio_r8(bc);
222
- val= (val<<7) + (tmp&127);
223
- }while(tmp&128);
224
- return val;
225
-}
226
-
227
makemkv-oss-1.8.5.tar.gz/libffcodec/src/crc.c
Deleted
167
1
2
-/*
3
- * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
4
- *
5
- * This file is part of FFmpeg.
6
- *
7
- * FFmpeg is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
11
- *
12
- * FFmpeg is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with FFmpeg; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
- */
21
-
22
-#include "misc.h"
23
-#include "crc.h"
24
-
25
-#if CONFIG_HARDCODED_TABLES
26
-/*#include "crc_data.h"*/
27
-#else
28
-static struct {
29
- uint8_t le;
30
- uint8_t bits;
31
- uint32_t poly;
32
-} av_crc_table_params[AV_CRC_MAX] = {
33
- [AV_CRC_8_ATM] = { 0, 8, 0x07 },
34
- [AV_CRC_16_ANSI] = { 0, 16, 0x8005 },
35
- [AV_CRC_16_CCITT] = { 0, 16, 0x1021 },
36
- [AV_CRC_32_IEEE] = { 0, 32, 0x04C11DB7 },
37
- [AV_CRC_32_IEEE_LE] = { 1, 32, 0xEDB88320 },
38
-};
39
-static AVCRC av_crc_table[AV_CRC_MAX][257];
40
-#endif
41
-
42
-/**
43
- * Initialize a CRC table.
44
- * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024
45
- * @param le If 1, the lowest bit represents the coefficient for the highest
46
- * exponent of the corresponding polynomial (both for poly and
47
- * actual CRC).
48
- * If 0, you must swap the CRC parameter and the result of av_crc
49
- * if you need the standard representation (can be simplified in
50
- * most cases to e.g. bswap16):
51
- * av_bswap32(crc << (32-bits))
52
- * @param bits number of bits for the CRC
53
- * @param poly generator polynomial without the x**bits coefficient, in the
54
- * representation as specified by le
55
- * @param ctx_size size of ctx in bytes
56
- * @return <0 on failure
57
- */
58
-int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size)
59
-{
60
- unsigned i, j;
61
- uint32_t c;
62
-
63
- if (bits < 8 || bits > 32 || poly >= (1LL << bits))
64
- return -1;
65
- if (ctx_size != sizeof(AVCRC) * 257 && ctx_size != sizeof(AVCRC) * 1024)
66
- return -1;
67
-
68
- for (i = 0; i < 256; i++) {
69
- if (le) {
70
- for (c = i, j = 0; j < 8; j++)
71
- c = (c >> 1) ^ (poly & (-(c & 1)));
72
- ctx[i] = c;
73
- } else {
74
- for (c = i << 24, j = 0; j < 8; j++)
75
- c = (c << 1) ^ ((poly << (32 - bits)) & (((int32_t) c) >> 31));
76
- ctx[i] = av_bswap32(c);
77
- }
78
- }
79
- ctx[256] = 1;
80
-#if !CONFIG_SMALL
81
- if (ctx_size >= sizeof(AVCRC) * 1024)
82
- for (i = 0; i < 256; i++)
83
- for (j = 0; j < 3; j++)
84
- ctx[256 *(j + 1) + i] =
85
- (ctx[256 * j + i] >> 8) ^ ctx[ctx[256 * j + i] & 0xFF];
86
-#endif
87
-
88
- return 0;
89
-}
90
-
91
-/**
92
- * Get an initialized standard CRC table.
93
- * @param crc_id ID of a standard CRC
94
- * @return a pointer to the CRC table or NULL on failure
95
- */
96
-/*
97
-const AVCRC *av_crc_get_table(AVCRCId crc_id)
98
-{
99
-#if !CONFIG_HARDCODED_TABLES
100
- if (!av_crc_table[crc_id][FF_ARRAY_ELEMS(av_crc_table[crc_id]) - 1])
101
- if (av_crc_init(av_crc_table[crc_id],
102
- av_crc_table_params[crc_id].le,
103
- av_crc_table_params[crc_id].bits,
104
- av_crc_table_params[crc_id].poly,
105
- sizeof(av_crc_table[crc_id])) < 0)
106
- return NULL;
107
-#endif
108
- return av_crc_table[crc_id];
109
-}
110
-*/
111
-
112
-/**
113
- * Calculate the CRC of a block.
114
- * @param crc CRC of previous blocks if any or initial value for CRC
115
- * @return CRC updated with the data from the given block
116
- *
117
- * @see av_crc_init() "le" parameter
118
- */
119
-uint32_t av_crc(const AVCRC *ctx, uint32_t crc,
120
- const uint8_t *buffer, size_t length)
121
-{
122
- const uint8_t *end = buffer + length;
123
-
124
-#if !CONFIG_SMALL
125
- if (!ctx[256]) {
126
- while (((intptr_t) buffer & 3) && buffer < end)
127
- crc = ctx[((uint8_t) crc) ^ *buffer++] ^ (crc >> 8);
128
-
129
- while (buffer < end - 3) {
130
- crc ^= av_le2ne32(*(const uint32_t *) buffer); buffer += 4;
131
- crc = ctx[3 * 256 + ( crc & 0xFF)] ^
132
- ctx[2 * 256 + ((crc >> 8 ) & 0xFF)] ^
133
- ctx[1 * 256 + ((crc >> 16) & 0xFF)] ^
134
- ctx[0 * 256 + ((crc >> 24) )];
135
- }
136
- }
137
-#endif
138
- while (buffer < end)
139
- crc = ctx[((uint8_t) crc) ^ *buffer++] ^ (crc >> 8);
140
-
141
- return crc;
142
-}
143
-
144
-#ifdef TEST
145
-#undef printf
146
-int main(void)
147
-{
148
- uint8_t buf[1999];
149
- int i;
150
- int p[4][3] = { { AV_CRC_32_IEEE_LE, 0xEDB88320, 0x3D5CDD04 },
151
- { AV_CRC_32_IEEE , 0x04C11DB7, 0xC0F5BAE0 },
152
- { AV_CRC_16_ANSI , 0x8005 , 0x1FBB },
153
- { AV_CRC_8_ATM , 0x07 , 0xE3 }
154
- };
155
- const AVCRC *ctx;
156
-
157
- for (i = 0; i < sizeof(buf); i++)
158
- buf[i] = i + i * i;
159
-
160
- for (i = 0; i < 4; i++) {
161
- ctx = av_crc_get_table(p[i][0]);
162
- printf("crc %08X = %X\n", p[i][1], av_crc(ctx, 0, buf, sizeof(buf)));
163
- }
164
- return 0;
165
-}
166
-#endif
167
makemkv-oss-1.8.5.tar.gz/libffcodec/src/crc.h
Deleted
46
1
2
-/*
3
- * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
4
- *
5
- * This file is part of FFmpeg.
6
- *
7
- * FFmpeg is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
11
- *
12
- * FFmpeg is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with FFmpeg; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
- */
21
-
22
-#ifndef AVUTIL_CRC_H
23
-#define AVUTIL_CRC_H
24
-
25
-#include <stdint.h>
26
-#include <stddef.h>
27
-#include "misc.h"
28
-
29
-typedef uint32_t AVCRC;
30
-
31
-typedef enum {
32
- AV_CRC_8_ATM,
33
- AV_CRC_16_ANSI,
34
- AV_CRC_16_CCITT,
35
- AV_CRC_32_IEEE,
36
- AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */
37
- AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */
38
-}AVCRCId;
39
-
40
-int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size);
41
-const AVCRC *av_crc_get_table(AVCRCId crc_id);
42
-uint32_t av_crc(const AVCRC *ctx, uint32_t start_crc, const uint8_t *buffer, size_t length) av_pure;
43
-
44
-#endif /* AVUTIL_CRC_H */
45
-
46
makemkv-oss-1.8.5.tar.gz/libffcodec/src/ffcodec.c
Deleted
185
1
2
-/*
3
- libMakeMKV - MKV multiplexer library
4
-
5
- Copyright (C) 2007-2013 GuinpinSoft inc <libmkv@makemkv.com>
6
-
7
- This library is free software; you can redistribute it and/or
8
- modify it under the terms of the GNU Lesser General Public
9
- License as published by the Free Software Foundation; either
10
- version 2.1 of the License, or (at your option) any later version.
11
-
12
- This library is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- Lesser General Public License for more details.
16
-
17
- You should have received a copy of the GNU Lesser General Public
18
- License along with this library; if not, write to the Free Software
19
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
-
21
-*/
22
-#include "ffcodec.h"
23
-#include "get_bits.h"
24
-#include "mlp.h"
25
-#include "mpegaudiodecheader.h"
26
-#include <stdlib.h>
27
-
28
-int ffm_read_header(AVFormatContext *s);
29
-int ffm_read_packet(AVFormatContext *s, AVPacket *pkt);
30
-int ffm_write_header(AVFormatContext *s);
31
-int ffm_write_packet(AVFormatContext *s, AVPacket *pkt);
32
-int ffm_write_trailer(AVFormatContext *s);
33
-
34
-int ffcdecl ffcodec_ff_mlp_read_major_sync(MLPHeaderInfo *mh, const uint8_t* data, unsigned int size)
35
-{
36
- GetBitContext gb;
37
-
38
- init_get_bits(&gb,data,size*8);
39
-
40
- ff_mlp_init_crc();
41
-
42
- return ff_mlp_read_major_sync(NULL,mh,&gb);
43
-}
44
-
45
-int ffcdecl ffcodec_ff_mpegaudio_decode_header(MPADecodeHeader *s, const uint8_t* data, unsigned int size)
46
-{
47
- uint32_t header;
48
-
49
- if (size<4) return -2;
50
-
51
- header = AV_RB32(data);
52
-
53
- return avpriv_mpegaudio_decode_header(s,header);
54
-}
55
-
56
-int ffcdecl ffcodec_ff_mpa_check_header( const uint8_t* data, unsigned int size)
57
-{
58
- uint32_t header;
59
-
60
- if (size<4) return -2;
61
-
62
- header = AV_RB32(data);
63
-
64
- return ff_mpa_check_header(header);
65
-}
66
-
67
-int ffcdecl ffcodec_ffm_init_context_r(FFCFFMContextR *s,uintptr_t fd,AVIOReadProc read)
68
-{
69
- memset(s,0,sizeof(*s));
70
- s->avio.fd=fd;
71
- s->avio.read=read;
72
- s->fmt.pb=&s->avio;
73
- s->fmt.priv_data=&s->ffm;
74
- return 0;
75
-}
76
-
77
-int ffcdecl ffcodec_ffm_init_context_w(FFCFFMContextW *s,uintptr_t fd,AVIOWriteProc write)
78
-{
79
- ffcodec_ffm_init_context_r(&s->ctx,fd,NULL);
80
- s->ctx.avio.write=write;
81
- s->ctx.avio.buffer=s->avio_buffer;
82
- s->ctx.avio.buffer_max_size=8*FFM_PACKET_SIZE;
83
- return 0;
84
-}
85
-
86
-
87
-int ffcdecl ffcodec_ffm_read_header(FFCFFMContextR *s)
88
-{
89
- return ffm_read_header(&s->fmt);
90
-}
91
-
92
-int ffcdecl ffcodec_ffm_read_packet_header(FFCFFMContextR *s, uint32_t *size)
93
-{
94
- int err;
95
-
96
- if (s->ffm.read_state!=READ_HEADER) return -1;
97
- if ((err=ffm_read_packet(&s->fmt,NULL))<0) return err;
98
-
99
- *size = AV_RB24(s->ffm.header + 2);
100
-
101
- return 0;
102
-}
103
-
104
-int ffcdecl ffcodec_ffm_read_packet_data(FFCFFMContextR *s, AVPacket *pkt)
105
-{
106
- if (s->ffm.read_state!=READ_DATA) return -1;
107
-
108
- return ffm_read_packet(&s->fmt,pkt);
109
-}
110
-
111
-int ffcdecl ffcodec_ffm_write_header(FFCFFMContextW *s)
112
-{
113
- return ffm_write_header(&s->ctx.fmt);
114
-}
115
-
116
-int ffcdecl ffcodec_ffm_write_packet(FFCFFMContextW *s, AVPacket *pkt)
117
-{
118
- return ffm_write_packet(&s->ctx.fmt,pkt);
119
-}
120
-
121
-int ffcdecl ffcodec_ffm_write_trailer(FFCFFMContextW *s)
122
-{
123
- return ffm_write_trailer(&s->ctx.fmt);
124
-}
125
-
126
-void avio_flush(AVIOContext *s)
127
-{
128
- if (s->buffer_size)
129
- {
130
- (*s->write)(s->fd,s->buffer,s->buffer_size);
131
- s->buffer_size = 0;
132
- }
133
-}
134
-
135
-int64_t avio_tell(AVIOContext *s)
136
-{
137
- return s->pos;
138
-}
139
-
140
-int avio_read(AVIOContext *s, unsigned char *buf, int size)
141
-{
142
- int err = (*s->read)(s->fd,buf,size);
143
- if (err>=0)
144
- {
145
- s->pos += err;
146
- }
147
- return err;
148
-}
149
-
150
-void avio_write(AVIOContext *s, const unsigned char *buf, int size)
151
-{
152
- int err;
153
-
154
- if ((size+s->buffer_size)<=s->buffer_max_size)
155
- {
156
- memcpy(s->buffer+s->buffer_size,buf,size);
157
- s->buffer_size += size;
158
- s->pos += size;
159
- } else {
160
- avio_flush(s);
161
-
162
- err = (*s->write)(s->fd,buf,size);
163
- if (err>=0)
164
- {
165
- s->pos += err;
166
- }
167
- }
168
-}
169
-
170
-int avio_r8(AVIOContext *s)
171
-{
172
- unsigned char buf=0;
173
-
174
- avio_read(s,&buf,1);
175
-
176
- return buf;
177
-}
178
-
179
-void avio_w8(AVIOContext *s, int b)
180
-{
181
- unsigned char buf=(unsigned char)b;
182
- avio_write(s,&buf,1);
183
-}
184
-
185
makemkv-oss-1.8.5.tar.gz/libffcodec/src/ffcodec.h
Deleted
71
1
2
-/*
3
- libMakeMKV - MKV multiplexer library
4
-
5
- Copyright (C) 2007-2013 GuinpinSoft inc <libmkv@makemkv.com>
6
-
7
- This library is free software; you can redistribute it and/or
8
- modify it under the terms of the GNU Lesser General Public
9
- License as published by the Free Software Foundation; either
10
- version 2.1 of the License, or (at your option) any later version.
11
-
12
- This library is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- Lesser General Public License for more details.
16
-
17
- You should have received a copy of the GNU Lesser General Public
18
- License along with this library; if not, write to the Free Software
19
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
-
21
-*/
22
-#ifndef FFCODEC_H
23
-#define FFCODEC_H
24
-
25
-#include <stdint.h>
26
-#include "mlp_parser.h"
27
-#include "mpegaudiodecheader.h"
28
-#include "mpegaudiomisc.h"
29
-#include "ffm.h"
30
-
31
-typedef struct FFCFFMContextR
32
-{
33
- AVFormatContext fmt;
34
- AVIOContext avio;
35
- FFMContext ffm;
36
-} FFCFFMContextR;
37
-
38
-typedef struct FFCFFMContextW
39
-{
40
- FFCFFMContextR ctx;
41
- uint8_t avio_buffer[8*FFM_PACKET_SIZE];
42
-} FFCFFMContextW;
43
-
44
-
45
-#ifdef __cplusplus
46
-extern "C" {
47
-#endif
48
-
49
-int ffcdecl ffcodec_ff_mlp_read_major_sync(MLPHeaderInfo *mh, const uint8_t* data, unsigned int size);
50
-int ffcdecl ffcodec_ff_mlp_get_audio_info(const MLPHeaderInfo *mh,AVAudioInfo* avctx);
51
-
52
-
53
-int ffcdecl ffcodec_ff_mpegaudio_decode_header(MPADecodeHeader *s, const uint8_t* data, unsigned int size);
54
-int ffcdecl ffcodec_ff_mpa_check_header( const uint8_t* data, unsigned int size);
55
-
56
-int ffcdecl ffcodec_ffm_init_context_r(FFCFFMContextR *s,uintptr_t fd,AVIOReadProc read);
57
-int ffcdecl ffcodec_ffm_init_context_w(FFCFFMContextW *s,uintptr_t fd,AVIOWriteProc write);
58
-int ffcdecl ffcodec_ffm_read_header(FFCFFMContextR *s);
59
-int ffcdecl ffcodec_ffm_read_packet_header(FFCFFMContextR *s, uint32_t *size);
60
-int ffcdecl ffcodec_ffm_read_packet_data(FFCFFMContextR *s, AVPacket *pkt);
61
-int ffcdecl ffcodec_ffm_write_header(FFCFFMContextW *s);
62
-int ffcdecl ffcodec_ffm_write_packet(FFCFFMContextW *s, AVPacket *pkt);
63
-int ffcdecl ffcodec_ffm_write_trailer(FFCFFMContextW *s);
64
-
65
-#ifdef __cplusplus
66
-}
67
-#endif
68
-
69
-#endif /* FFCODEC_H */
70
-
71
makemkv-oss-1.8.5.tar.gz/libffcodec/src/ffm.h
Deleted
64
1
2
-/*
3
- * FFM (ffserver live feed) common header
4
- * Copyright (c) 2001 Fabrice Bellard
5
- *
6
- * This file is part of FFmpeg.
7
- *
8
- * FFmpeg is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * FFmpeg is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with FFmpeg; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-#ifndef AVFORMAT_FFM_H
24
-#define AVFORMAT_FFM_H
25
-
26
-#include <stdint.h>
27
-#include "misc.h"
28
-
29
-/* The FFM file is made of blocks of fixed size */
30
-#define FFM_HEADER_SIZE 14
31
-#define FFM_PACKET_SIZE 4096
32
-#define PACKET_ID 0x666d
33
-
34
-/* each packet contains frames (which can span several packets */
35
-#define FRAME_HEADER_SIZE 16
36
-#define FLAG_KEY_FRAME 0x01
37
-#define FLAG_DTS 0x02
38
-
39
-enum {
40
- READ_HEADER,
41
- READ_DATA,
42
-};
43
-
44
-typedef struct FFMContext {
45
- /* only reading mode */
46
- int64_t write_index, file_size;
47
- int read_state;
48
- uint8_t header[FRAME_HEADER_SIZE+4];
49
-
50
- /* read and write */
51
- int first_packet; /* true if first packet, needed to set the discontinuity tag */
52
- int packet_size;
53
- int frame_offset;
54
- int64_t dts;
55
- uint8_t *packet_ptr, *packet_end;
56
- uint8_t packet[FFM_PACKET_SIZE];
57
-} FFMContext;
58
-
59
-int64_t ffm_read_write_index(int fd);
60
-int ffm_write_write_index(int fd, int64_t pos);
61
-void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size);
62
-
63
-#endif /* AVFORMAT_FFM_H */
64
makemkv-oss-1.8.5.tar.gz/libffcodec/src/ffmdec.c
Deleted
245
1
2
-/*
3
- * FFM (ffserver live feed) demuxer
4
- * Copyright (c) 2001 Fabrice Bellard
5
- *
6
- * This file is part of FFmpeg.
7
- *
8
- * FFmpeg is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * FFmpeg is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with FFmpeg; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-#include "ffm.h"
24
-#if CONFIG_FFSERVER
25
-#include <unistd.h>
26
-
27
-int64_t ffm_read_write_index(int fd)
28
-{
29
- uint8_t buf[8];
30
-
31
- lseek(fd, 8, SEEK_SET);
32
- if (read(fd, buf, 8) != 8)
33
- return AVERROR(EIO);
34
- return AV_RB64(buf);
35
-}
36
-
37
-int ffm_write_write_index(int fd, int64_t pos)
38
-{
39
- uint8_t buf[8];
40
- int i;
41
-
42
- for(i=0;i<8;i++)
43
- buf[i] = (pos >> (56 - i * 8)) & 0xff;
44
- lseek(fd, 8, SEEK_SET);
45
- if (write(fd, buf, 8) != 8)
46
- return AVERROR(EIO);
47
- return 8;
48
-}
49
-
50
-void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size)
51
-{
52
- FFMContext *ffm = s->priv_data;
53
- ffm->write_index = pos;
54
- ffm->file_size = file_size;
55
-}
56
-#endif // CONFIG_FFSERVER
57
-
58
-static int ffm_is_avail_data(AVFormatContext *s, int size)
59
-{
60
- return 1;
61
-}
62
-
63
-static int ffm_resync(AVFormatContext *s, int state)
64
-{
65
- return -1;
66
-}
67
-
68
-/* first is true if we read the frame header */
69
-static int ffm_read_data(AVFormatContext *s,
70
- uint8_t *buf, int size, int header)
71
-{
72
- FFMContext *ffm = s->priv_data;
73
- AVIOContext *pb = s->pb;
74
- int len, fill_size, size1, frame_offset, id;
75
-
76
- size1 = size;
77
- while (size > 0) {
78
- redo:
79
- len = ffm->packet_end - ffm->packet_ptr;
80
- if (len < 0)
81
- return -1;
82
- if (len > size)
83
- len = size;
84
- if (len == 0) {
85
- /*if (avio_tell(pb) == ffm->file_size)
86
- avio_seek(pb, ffm->packet_size, SEEK_SET);
87
- retry_read:
88
- if (pb->buffer_size != ffm->packet_size) {
89
- int64_t tell = avio_tell(pb);
90
- url_setbufsize(pb, ffm->packet_size);
91
- avio_seek(pb, tell, SEEK_SET);
92
- }*/
93
- id = avio_rb16(pb); /* PACKET_ID */
94
- if (id != PACKET_ID)
95
- if (ffm_resync(s, id) < 0)
96
- return -1;
97
- fill_size = avio_rb16(pb);
98
- ffm->dts = avio_rb64(pb);
99
- frame_offset = avio_rb16(pb);
100
- if (avio_read(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE) < 0)
101
- return -1;
102
- ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size);
103
- if (ffm->packet_end < ffm->packet || frame_offset < 0)
104
- return -1;
105
- /* if first packet or resynchronization packet, we must
106
- handle it specifically */
107
- if (ffm->first_packet || (frame_offset & 0x8000)) {
108
- if (!frame_offset) {
109
- /* This packet has no frame headers in it */
110
- /*if (avio_tell(pb) >= ffm->packet_size * 3) {
111
- avio_seek(pb, -ffm->packet_size * 2, SEEK_CUR);
112
- goto retry_read;
113
- }*/
114
- /* This is bad, we cannot find a valid frame header */
115
- return 0;
116
- }
117
- ffm->first_packet = 0;
118
- if ((frame_offset & 0x7fff) < FFM_HEADER_SIZE)
119
- return -1;
120
- ffm->packet_ptr = ffm->packet + (frame_offset & 0x7fff) - FFM_HEADER_SIZE;
121
- if (!header)
122
- break;
123
- } else {
124
- ffm->packet_ptr = ffm->packet;
125
- }
126
- goto redo;
127
- }
128
- memcpy(buf, ffm->packet_ptr, len);
129
- buf += len;
130
- ffm->packet_ptr += len;
131
- size -= len;
132
- header = 0;
133
- }
134
- return size1 - size;
135
-}
136
-
137
-int ffm_read_header(AVFormatContext *s)
138
-{
139
- FFMContext *ffm = s->priv_data;
140
- AVIOContext *pb = s->pb;
141
- int i, nb_streams;
142
- uint32_t tag;
143
-
144
- /* header */
145
- tag = avio_rl32(pb);
146
- if (tag != MKTAG('F', 'F', 'M', '1'))
147
- goto fail;
148
- ffm->packet_size = avio_rb32(pb);
149
- if (ffm->packet_size != FFM_PACKET_SIZE)
150
- goto fail;
151
- ffm->write_index = avio_rb64(pb);
152
- /* get also filesize */
153
- /*if (pb->seekable) {
154
- ffm->file_size = avio_size(pb);
155
- if (ffm->write_index)
156
- adjust_write_index(s);
157
- } else*/ {
158
- ffm->file_size = (UINT64_C(1) << 63) - 1;
159
- }
160
-
161
- nb_streams = avio_rb32(pb);
162
- avio_rb32(pb); /* total bitrate */
163
-
164
- if (nb_streams !=1 )
165
- goto fail;
166
-
167
- if (avio_read(pb, s->stream0_data, FFM_STREAM_HEADER_SIZE) < 0)
168
- return -1;
169
-
170
- /* get until end of block reached */
171
- while ((avio_tell(pb) % ffm->packet_size) != 0)
172
- avio_r8(pb);
173
-
174
- /* init packet demux */
175
- ffm->packet_ptr = ffm->packet;
176
- ffm->packet_end = ffm->packet;
177
- ffm->frame_offset = 0;
178
- ffm->dts = 0;
179
- ffm->read_state = READ_HEADER;
180
- ffm->first_packet = 1;
181
- return 0;
182
- fail:
183
- //ffm_close(s);
184
- return -1;
185
-}
186
-
187
-/* return < 0 if eof */
188
-int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
189
-{
190
- int size;
191
- FFMContext *ffm = s->priv_data;
192
- int duration, ret;
193
-
194
- switch(ffm->read_state) {
195
- case READ_HEADER:
196
- if ((ret = ffm_is_avail_data(s, FRAME_HEADER_SIZE+4)) < 0)
197
- return ret;
198
-
199
- /*av_dlog(s, "pos=%08"PRIx64" spos=%"PRIx64", write_index=%"PRIx64" size=%"PRIx64"\n",
200
- avio_tell(s->pb), s->pb->pos, ffm->write_index, ffm->file_size);*/
201
- if (ffm_read_data(s, ffm->header, FRAME_HEADER_SIZE, 1) !=
202
- FRAME_HEADER_SIZE)
203
- return -1;
204
- if (ffm->header[1] & FLAG_DTS)
205
- if (ffm_read_data(s, ffm->header+16, 4, 1) != 4)
206
- return -1;
207
- ffm->read_state = READ_DATA;
208
- return 0;
209
- case READ_DATA:
210
- size = AV_RB24(ffm->header + 2);
211
- if ((ret = ffm_is_avail_data(s, size)) < 0)
212
- return ret;
213
-
214
- duration = AV_RB24(ffm->header + 5);
215
-
216
- //av_new_packet(pkt, size);
217
- pkt->stream_index = ffm->header[0];
218
- if ((unsigned)pkt->stream_index != 0) {
219
- //av_log(s, AV_LOG_ERROR, "invalid stream index %d\n", pkt->stream_index);
220
- //av_free_packet(pkt);
221
- ffm->read_state = READ_HEADER;
222
- return -1;
223
- }
224
- pkt->pos = avio_tell(s->pb);
225
- if (ffm->header[1] & FLAG_KEY_FRAME)
226
- pkt->flags |= AV_PKT_FLAG_KEY;
227
-
228
- ffm->read_state = READ_HEADER;
229
- if (ffm_read_data(s, pkt->data, size, 0) != size) {
230
- /* bad case: desynchronized packet. we cancel all the packet loading */
231
- //av_free_packet(pkt);
232
- return -1;
233
- }
234
- pkt->pts = AV_RB64(ffm->header+8);
235
- if (ffm->header[1] & FLAG_DTS)
236
- pkt->dts = pkt->pts - AV_RB32(ffm->header+16);
237
- else
238
- pkt->dts = pkt->pts;
239
- pkt->duration = duration;
240
- break;
241
- }
242
- return 0;
243
-}
244
-
245
makemkv-oss-1.8.5.tar.gz/libffcodec/src/ffmenc.c
Deleted
171
1
2
-/*
3
- * FFM (ffserver live feed) muxer
4
- * Copyright (c) 2001 Fabrice Bellard
5
- *
6
- * This file is part of FFmpeg.
7
- *
8
- * FFmpeg is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * FFmpeg is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with FFmpeg; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-#include "ffm.h"
24
-
25
-static void flush_packet(AVFormatContext *s)
26
-{
27
- FFMContext *ffm = s->priv_data;
28
- int fill_size, h;
29
- AVIOContext *pb = s->pb;
30
-
31
- fill_size = ffm->packet_end - ffm->packet_ptr;
32
- memset(ffm->packet_ptr, 0, fill_size);
33
-
34
- /*if (avio_tell(pb) % ffm->packet_size)
35
- av_abort();*/
36
-
37
- /* put header */
38
- avio_wb16(pb, PACKET_ID);
39
- avio_wb16(pb, fill_size);
40
- avio_wb64(pb, ffm->dts);
41
- h = ffm->frame_offset;
42
- if (ffm->first_packet)
43
- h |= 0x8000;
44
- avio_wb16(pb, h);
45
- avio_write(pb, ffm->packet, ffm->packet_end - ffm->packet);
46
- avio_flush(pb);
47
-
48
- /* prepare next packet */
49
- ffm->frame_offset = 0; /* no key frame */
50
- ffm->packet_ptr = ffm->packet;
51
- ffm->first_packet = 0;
52
-}
53
-
54
-/* 'first' is true if first data of a frame */
55
-static void ffm_write_data(AVFormatContext *s,
56
- const uint8_t *buf, int size,
57
- int64_t dts, int header)
58
-{
59
- FFMContext *ffm = s->priv_data;
60
- int len;
61
-
62
- if (header && ffm->frame_offset == 0) {
63
- ffm->frame_offset = ffm->packet_ptr - ffm->packet + FFM_HEADER_SIZE;
64
- ffm->dts = dts;
65
- }
66
-
67
- /* write as many packets as needed */
68
- while (size > 0) {
69
- len = ffm->packet_end - ffm->packet_ptr;
70
- if (len > size)
71
- len = size;
72
- memcpy(ffm->packet_ptr, buf, len);
73
-
74
- ffm->packet_ptr += len;
75
- buf += len;
76
- size -= len;
77
- if (ffm->packet_ptr >= ffm->packet_end)
78
- flush_packet(s);
79
- }
80
-}
81
-
82
-int ffm_write_header(AVFormatContext *s)
83
-{
84
- FFMContext *ffm = s->priv_data;
85
- AVIOContext *pb = s->pb;
86
- int bit_rate, i;
87
-
88
- ffm->packet_size = FFM_PACKET_SIZE;
89
-
90
- /* header */
91
- avio_wl32(pb, MKTAG('F', 'F', 'M', '1'));
92
- avio_wb32(pb, ffm->packet_size);
93
- avio_wb64(pb, 0); /* current write position */
94
-
95
- avio_wb32(pb, 1);
96
- bit_rate = 0;
97
- avio_wb32(pb, bit_rate);
98
-
99
- avio_write(pb, s->stream0_data, FFM_STREAM_HEADER_SIZE);
100
-
101
- /* flush until end of block reached */
102
- while ((avio_tell(pb) % ffm->packet_size) != 0)
103
- avio_w8(pb, 0);
104
-
105
- avio_flush(pb);
106
-
107
- /* init packet mux */
108
- ffm->packet_ptr = ffm->packet;
109
- ffm->packet_end = ffm->packet + ffm->packet_size - FFM_HEADER_SIZE;
110
- //assert(ffm->packet_end >= ffm->packet);
111
- ffm->frame_offset = 0;
112
- ffm->dts = 0;
113
- ffm->first_packet = 1;
114
-
115
- return 0;
116
-}
117
-
118
-int ffm_write_packet(AVFormatContext *s, AVPacket *pkt)
119
-{
120
- int64_t dts;
121
- uint8_t header[FRAME_HEADER_SIZE+4];
122
- int header_size = FRAME_HEADER_SIZE;
123
-
124
- dts = pkt->dts;
125
- /* packet size & key_frame */
126
- header[0] = pkt->stream_index;
127
- header[1] = 0;
128
- if (pkt->flags & AV_PKT_FLAG_KEY)
129
- header[1] |= FLAG_KEY_FRAME;
130
- AV_WB24(header+2, pkt->size);
131
- AV_WB24(header+5, pkt->duration);
132
- AV_WB64(header+8, pkt->pts);
133
- if (pkt->pts != pkt->dts) {
134
- header[1] |= FLAG_DTS;
135
- AV_WB32(header+16, pkt->pts - pkt->dts);
136
- header_size += 4;
137
- }
138
- ffm_write_data(s, header, header_size, dts, 1);
139
- ffm_write_data(s, pkt->data, pkt->size, dts, 0);
140
-
141
- return 0;
142
-}
143
-
144
-/*static*/ int ffm_write_trailer(AVFormatContext *s)
145
-{
146
- AVIOContext *pb = s->pb;
147
- FFMContext *ffm = s->priv_data;
148
-
149
- /* flush packets */
150
- if (ffm->packet_ptr > ffm->packet)
151
- flush_packet(s);
152
-
153
- avio_flush(pb);
154
-
155
- return 0;
156
-}
157
-
158
-#if 0
159
-AVOutputFormat ff_ffm_muxer = {
160
- .name = "ffm",
161
- .long_name = NULL_IF_CONFIG_SMALL("FFM (FFserver live feed) format"),
162
- .extensions = "ffm",
163
- .priv_data_size = sizeof(FFMContext),
164
- .audio_codec = CODEC_ID_MP2,
165
- .video_codec = CODEC_ID_MPEG1VIDEO,
166
- .write_header = ffm_write_header,
167
- .write_packet = ffm_write_packet,
168
- .write_trailer = ffm_write_trailer,
169
-};
170
-#endif
171
makemkv-oss-1.8.5.tar.gz/libffcodec/src/ffmisc.h
Deleted
138
1
2
-/*
3
- * Bytestream functions
4
- * copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier@free.fr>
5
- *
6
- * simple math operations
7
- * Copyright (c) 2001, 2002 Fabrice Bellard
8
- * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> et al
9
- *
10
- * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
11
- *
12
- * copyright (c) 2001 Fabrice Bellard
13
- *
14
- * This file is part of FFmpeg.
15
- *
16
- * FFmpeg is free software; you can redistribute it and/or
17
- * modify it under the terms of the GNU Lesser General Public
18
- * License as published by the Free Software Foundation; either
19
- * version 2.1 of the License, or (at your option) any later version.
20
- *
21
- * FFmpeg is distributed in the hope that it will be useful,
22
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24
- * Lesser General Public License for more details.
25
- *
26
- * You should have received a copy of the GNU Lesser General Public
27
- * License along with FFmpeg; if not, write to the Free Software
28
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29
- */
30
-#ifndef FFCODEC_FFMISC_H
31
-#define FFCODEC_FFMISC_H
32
-
33
-
34
-#ifndef AV_RL16
35
-# define AV_RL16(x) \
36
- ((((const uint8_t*)(x))[1] << 8) | \
37
- ((const uint8_t*)(x))[0])
38
-#endif
39
-#ifndef AV_RB24
40
-# define AV_RB24(x) \
41
- ((((const uint8_t*)(x))[0] << 16) | \
42
- (((const uint8_t*)(x))[1] << 8) | \
43
- ((const uint8_t*)(x))[2])
44
-#endif
45
-#ifndef AV_RB32
46
-# define AV_RB32(x) \
47
- ((((const uint8_t*)(x))[0] << 24) | \
48
- (((const uint8_t*)(x))[1] << 16) | \
49
- (((const uint8_t*)(x))[2] << 8) | \
50
- ((const uint8_t*)(x))[3])
51
-#endif
52
-#ifndef AV_RB64
53
-# define AV_RB64(x) \
54
- (((uint64_t)((const uint8_t*)(x))[0] << 56) | \
55
- ((uint64_t)((const uint8_t*)(x))[1] << 48) | \
56
- ((uint64_t)((const uint8_t*)(x))[2] << 40) | \
57
- ((uint64_t)((const uint8_t*)(x))[3] << 32) | \
58
- ((uint64_t)((const uint8_t*)(x))[4] << 24) | \
59
- ((uint64_t)((const uint8_t*)(x))[5] << 16) | \
60
- ((uint64_t)((const uint8_t*)(x))[6] << 8) | \
61
- (uint64_t)((const uint8_t*)(x))[7])
62
-#endif
63
-
64
-#ifndef AV_WB32
65
-# define AV_WB32(p, d) do { \
66
- ((uint8_t*)(p))[3] = (d); \
67
- ((uint8_t*)(p))[2] = (d)>>8; \
68
- ((uint8_t*)(p))[1] = (d)>>16; \
69
- ((uint8_t*)(p))[0] = (d)>>24; \
70
- } while(0)
71
-#endif
72
-#ifndef AV_WB24
73
-# define AV_WB24(p, d) do { \
74
- ((uint8_t*)(p))[2] = (d); \
75
- ((uint8_t*)(p))[1] = (d)>>8; \
76
- ((uint8_t*)(p))[0] = (d)>>16; \
77
- } while(0)
78
-#endif
79
-#ifndef AV_WB64
80
-# define AV_WB64(p, d) do { \
81
- ((uint8_t*)(p))[7] = (d); \
82
- ((uint8_t*)(p))[6] = (d)>>8; \
83
- ((uint8_t*)(p))[5] = (d)>>16; \
84
- ((uint8_t*)(p))[4] = (d)>>24; \
85
- ((uint8_t*)(p))[3] = (d)>>32; \
86
- ((uint8_t*)(p))[2] = (d)>>40; \
87
- ((uint8_t*)(p))[1] = (d)>>48; \
88
- ((uint8_t*)(p))[0] = (d)>>56; \
89
- } while(0)
90
-#endif
91
-
92
-
93
-#ifndef NEG_USR32
94
-# define NEG_USR32(a,s) (((uint32_t)(a))>>(32-(s)))
95
-#endif
96
-#ifndef NEG_SSR32
97
-# define NEG_SSR32(a,s) ((( int32_t)(a))>>(32-(s)))
98
-#endif
99
-
100
-#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
101
-#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
102
-
103
-#define AVERROR_EOF (-MKTAG( 'E','O','F',' ')) ///< End of file
104
-#define AVERROR_INVALIDDATA (-MKTAG( 'I','N','D','A')) ///< Invalid data found when processing input
105
-
106
-int64_t avio_tell(AVIOContext *s);
107
-int avio_read(AVIOContext *s, unsigned char *buf, int size);
108
-void avio_flush(AVIOContext *s);
109
-
110
-int avio_r8 (AVIOContext *s);
111
-unsigned int avio_rl16(AVIOContext *s);
112
-unsigned int avio_rl24(AVIOContext *s);
113
-unsigned int avio_rl32(AVIOContext *s);
114
-uint64_t avio_rl64(AVIOContext *s);
115
-unsigned int avio_rb16(AVIOContext *s);
116
-unsigned int avio_rb24(AVIOContext *s);
117
-unsigned int avio_rb32(AVIOContext *s);
118
-uint64_t avio_rb64(AVIOContext *s);
119
-
120
-void avio_w8(AVIOContext *s, int b);
121
-void avio_write(AVIOContext *s, const unsigned char *buf, int size);
122
-void avio_wl64(AVIOContext *s, uint64_t val);
123
-void avio_wb64(AVIOContext *s, uint64_t val);
124
-void avio_wl32(AVIOContext *s, unsigned int val);
125
-void avio_wb32(AVIOContext *s, unsigned int val);
126
-void avio_wl24(AVIOContext *s, unsigned int val);
127
-void avio_wb24(AVIOContext *s, unsigned int val);
128
-void avio_wl16(AVIOContext *s, unsigned int val);
129
-void avio_wb16(AVIOContext *s, unsigned int val);
130
-
131
-#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
132
-#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
133
-
134
-#define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe.
135
-
136
-#endif /* FFCODEC_FFMISC_H */
137
-
138
makemkv-oss-1.8.5.tar.gz/libffcodec/src/get_bits.h
Deleted
567
1
2
-/*
3
- * copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
4
- *
5
- * This file is part of FFmpeg.
6
- *
7
- * FFmpeg is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
11
- *
12
- * FFmpeg is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with FFmpeg; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
- */
21
-
22
-/**
23
- * @file
24
- * bitstream reader API header.
25
- */
26
-
27
-#ifndef AVCODEC_GET_BITS_H
28
-#define AVCODEC_GET_BITS_H
29
-
30
-#include <stdint.h>
31
-#include "misc.h"
32
-/*
33
-#include "libavutil/bswap.h"
34
-#include "libavutil/common.h"
35
-#include "libavutil/intreadwrite.h"
36
-#include "libavutil/log.h"
37
-#include "mathops.h"
38
-*/
39
-
40
-/*
41
- * Safe bitstream reading:
42
- * optionally, the get_bits API can check to ensure that we
43
- * don't read past input buffer boundaries. This is protected
44
- * with CONFIG_SAFE_BITSTREAM_READER at the global level, and
45
- * then below that with UNCHECKED_BITSTREAM_READER at the per-
46
- * decoder level. This means that decoders that check internally
47
- * can "#define UNCHECKED_BITSTREAM_READER 1" to disable
48
- * overread checks.
49
- * Boundary checking causes a minor performance penalty so for
50
- * applications that won't want/need this, it can be disabled
51
- * globally using "#define CONFIG_SAFE_BITSTREAM_READER 0".
52
- */
53
-#ifndef UNCHECKED_BITSTREAM_READER
54
-#define UNCHECKED_BITSTREAM_READER !CONFIG_SAFE_BITSTREAM_READER
55
-#endif
56
-
57
-typedef struct GetBitContext {
58
- const uint8_t *buffer, *buffer_end;
59
- int index;
60
- int size_in_bits;
61
- int size_in_bits_plus8;
62
-} GetBitContext;
63
-
64
-#define VLC_TYPE int16_t
65
-
66
-typedef struct VLC {
67
- int bits;
68
- VLC_TYPE (*table)[2]; ///< code, bits
69
- int table_size, table_allocated;
70
-} VLC;
71
-
72
-typedef struct RL_VLC_ELEM {
73
- int16_t level;
74
- int8_t len;
75
- uint8_t run;
76
-} RL_VLC_ELEM;
77
-
78
-/* Bitstream reader API docs:
79
-name
80
- arbitrary name which is used as prefix for the internal variables
81
-
82
-gb
83
- getbitcontext
84
-
85
-OPEN_READER(name, gb)
86
- load gb into local variables
87
-
88
-CLOSE_READER(name, gb)
89
- store local vars in gb
90
-
91
-UPDATE_CACHE(name, gb)
92
- refill the internal cache from the bitstream
93
- after this call at least MIN_CACHE_BITS will be available,
94
-
95
-GET_CACHE(name, gb)
96
- will output the contents of the internal cache, next bit is MSB of 32 or 64 bit (FIXME 64bit)
97
-
98
-SHOW_UBITS(name, gb, num)
99
- will return the next num bits
100
-
101
-SHOW_SBITS(name, gb, num)
102
- will return the next num bits and do sign extension
103
-
104
-SKIP_BITS(name, gb, num)
105
- will skip over the next num bits
106
- note, this is equivalent to SKIP_CACHE; SKIP_COUNTER
107
-
108
-SKIP_CACHE(name, gb, num)
109
- will remove the next num bits from the cache (note SKIP_COUNTER MUST be called before UPDATE_CACHE / CLOSE_READER)
110
-
111
-SKIP_COUNTER(name, gb, num)
112
- will increment the internal bit counter (see SKIP_CACHE & SKIP_BITS)
113
-
114
-LAST_SKIP_BITS(name, gb, num)
115
- like SKIP_BITS, to be used if next call is UPDATE_CACHE or CLOSE_READER
116
-
117
-for examples see get_bits, show_bits, skip_bits, get_vlc
118
-*/
119
-
120
-#ifdef LONG_BITSTREAM_READER
121
-# define MIN_CACHE_BITS 32
122
-#else
123
-# define MIN_CACHE_BITS 25
124
-#endif
125
-
126
-#define OPEN_READER(name, gb) \
127
- unsigned int name##_index = (gb)->index; \
128
- av_unused unsigned int name##_cache
129
-
130
-#define CLOSE_READER(name, gb) (gb)->index = name##_index
131
-
132
-#ifdef BITSTREAM_READER_LE
133
-
134
-# ifdef LONG_BITSTREAM_READER
135
-# define UPDATE_CACHE(name, gb) name##_cache = \
136
- AV_RL64((gb)->buffer + (name##_index >> 3)) >> (name##_index & 7)
137
-# else
138
-# define UPDATE_CACHE(name, gb) name##_cache = \
139
- AV_RL32((gb)->buffer + (name##_index >> 3)) >> (name##_index & 7)
140
-# endif
141
-
142
-# define SKIP_CACHE(name, gb, num) name##_cache >>= (num)
143
-
144
-#else
145
-
146
-# ifdef LONG_BITSTREAM_READER
147
-# define UPDATE_CACHE(name, gb) name##_cache = \
148
- AV_RB64((gb)->buffer + (name##_index >> 3)) >> (32 - (name##_index & 7))
149
-# else
150
-# define UPDATE_CACHE(name, gb) name##_cache = \
151
- AV_RB32((gb)->buffer + (name##_index >> 3)) << (name##_index & 7)
152
-# endif
153
-
154
-# define SKIP_CACHE(name, gb, num) name##_cache <<= (num)
155
-
156
-#endif
157
-
158
-#if UNCHECKED_BITSTREAM_READER
159
-# define SKIP_COUNTER(name, gb, num) name##_index += (num)
160
-#else
161
-# define SKIP_COUNTER(name, gb, num) \
162
- name##_index = FFMIN((gb)->size_in_bits_plus8, name##_index + (num))
163
-#endif
164
-
165
-#define SKIP_BITS(name, gb, num) do { \
166
- SKIP_CACHE(name, gb, num); \
167
- SKIP_COUNTER(name, gb, num); \
168
- } while (0)
169
-
170
-#define LAST_SKIP_BITS(name, gb, num) SKIP_COUNTER(name, gb, num)
171
-
172
-#ifdef BITSTREAM_READER_LE
173
-# define SHOW_UBITS(name, gb, num) zero_extend(name##_cache, num)
174
-# define SHOW_SBITS(name, gb, num) sign_extend(name##_cache, num)
175
-#else
176
-# define SHOW_UBITS(name, gb, num) NEG_USR32(name##_cache, num)
177
-# define SHOW_SBITS(name, gb, num) NEG_SSR32(name##_cache, num)
178
-#endif
179
-
180
-#define GET_CACHE(name, gb) ((uint32_t)name##_cache)
181
-
182
-static inline int get_bits_count(const GetBitContext *s)
183
-{
184
- return s->index;
185
-}
186
-
187
-static inline void skip_bits_long(GetBitContext *s, int n){
188
-#if UNCHECKED_BITSTREAM_READER
189
- s->index += n;
190
-#else
191
- s->index += av_clip(n, -s->index, s->size_in_bits_plus8 - s->index);
192
-#endif
193
-}
194
-
195
-/**
196
- * read mpeg1 dc style vlc (sign bit + mantisse with no MSB).
197
- * if MSB not set it is negative
198
- * @param n length in bits
199
- */
200
-static inline int get_xbits(GetBitContext *s, int n)
201
-{
202
- register int sign;
203
- register int32_t cache;
204
- OPEN_READER(re, s);
205
- UPDATE_CACHE(re, s);
206
- cache = GET_CACHE(re, s);
207
- sign = ~cache >> 31;
208
- LAST_SKIP_BITS(re, s, n);
209
- CLOSE_READER(re, s);
210
- return (NEG_USR32(sign ^ cache, n) ^ sign) - sign;
211
-}
212
-
213
-static inline int get_sbits(GetBitContext *s, int n)
214
-{
215
- register int tmp;
216
- OPEN_READER(re, s);
217
- UPDATE_CACHE(re, s);
218
- tmp = SHOW_SBITS(re, s, n);
219
- LAST_SKIP_BITS(re, s, n);
220
- CLOSE_READER(re, s);
221
- return tmp;
222
-}
223
-
224
-/**
225
- * Read 1-25 bits.
226
- */
227
-static inline unsigned int get_bits(GetBitContext *s, int n)
228
-{
229
- register int tmp;
230
- OPEN_READER(re, s);
231
- UPDATE_CACHE(re, s);
232
- tmp = SHOW_UBITS(re, s, n);
233
- LAST_SKIP_BITS(re, s, n);
234
- CLOSE_READER(re, s);
235
- return tmp;
236
-}
237
-
238
-/**
239
- * Show 1-25 bits.
240
- */
241
-static inline unsigned int show_bits(GetBitContext *s, int n)
242
-{
243
- register int tmp;
244
- OPEN_READER(re, s);
245
- UPDATE_CACHE(re, s);
246
- tmp = SHOW_UBITS(re, s, n);
247
- return tmp;
248
-}
249
-
250
-static inline void skip_bits(GetBitContext *s, int n)
251
-{
252
- OPEN_READER(re, s);
253
- UPDATE_CACHE(re, s);
254
- LAST_SKIP_BITS(re, s, n);
255
- CLOSE_READER(re, s);
256
-}
257
-
258
-static inline unsigned int get_bits1(GetBitContext *s)
259
-{
260
- unsigned int index = s->index;
261
- uint8_t result = s->buffer[index>>3];
262
-#ifdef BITSTREAM_READER_LE
263
- result >>= index & 7;
264
- result &= 1;
265
-#else
266
- result <<= index & 7;
267
- result >>= 8 - 1;
268
-#endif
269
-#if !UNCHECKED_BITSTREAM_READER
270
- if (s->index < s->size_in_bits_plus8)
271
-#endif
272
- index++;
273
- s->index = index;
274
-
275
- return result;
276
-}
277
-
278
-static inline unsigned int show_bits1(GetBitContext *s)
279
-{
280
- return show_bits(s, 1);
281
-}
282
-
283
-static inline void skip_bits1(GetBitContext *s)
284
-{
285
- skip_bits(s, 1);
286
-}
287
-
288
-/**
289
- * Read 0-32 bits.
290
- */
291
-static inline unsigned int get_bits_long(GetBitContext *s, int n)
292
-{
293
- if (n <= MIN_CACHE_BITS)
294
- return get_bits(s, n);
295
- else {
296
-#ifdef BITSTREAM_READER_LE
297
- int ret = get_bits(s, 16);
298
- return ret | (get_bits(s, n-16) << 16);
299
-#else
300
- int ret = get_bits(s, 16) << (n-16);
301
- return ret | get_bits(s, n-16);
302
-#endif
303
- }
304
-}
305
-
306
-/**
307
- * Read 0-32 bits as a signed integer.
308
- */
309
-/*
310
-static inline int get_sbits_long(GetBitContext *s, int n)
311
-{
312
- return sign_extend(get_bits_long(s, n), n);
313
-}
314
-*/
315
-
316
-/**
317
- * Show 0-32 bits.
318
- */
319
-static inline unsigned int show_bits_long(GetBitContext *s, int n)
320
-{
321
- if (n <= MIN_CACHE_BITS)
322
- return show_bits(s, n);
323
- else {
324
- GetBitContext gb = *s;
325
- return get_bits_long(&gb, n);
326
- }
327
-}
328
-
329
-/*
330
-static inline int check_marker(GetBitContext *s, const char *msg)
331
-{
332
- int bit = get_bits1(s);
333
- if (!bit)
334
- av_log(NULL, AV_LOG_INFO, "Marker bit missing %s\n", msg);
335
-
336
- return bit;
337
-}
338
-*/
339
-
340
-/**
341
- * Inititalize GetBitContext.
342
- * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes larger than the actual read bits
343
- * because some optimized bitstream readers read 32 or 64 bit at once and could read over the end
344
- * @param bit_size the size of the buffer in bits
345
- */
346
-static inline void init_get_bits(GetBitContext *s, const uint8_t *buffer,
347
- int bit_size)
348
-{
349
- int buffer_size = (bit_size+7)>>3;
350
- if (buffer_size < 0 || bit_size < 0) {
351
- buffer_size = bit_size = 0;
352
- buffer = NULL;
353
- }
354
-
355
- s->buffer = buffer;
356
- s->size_in_bits = bit_size;
357
- s->size_in_bits_plus8 = bit_size + 8;
358
- s->buffer_end = buffer + buffer_size;
359
- s->index = 0;
360
-}
361
-
362
-static inline void align_get_bits(GetBitContext *s)
363
-{
364
- int n = -get_bits_count(s) & 7;
365
- if (n) skip_bits(s, n);
366
-}
367
-
368
-#define init_vlc(vlc, nb_bits, nb_codes, \
369
- bits, bits_wrap, bits_size, \
370
- codes, codes_wrap, codes_size, \
371
- flags) \
372
- init_vlc_sparse(vlc, nb_bits, nb_codes, \
373
- bits, bits_wrap, bits_size, \
374
- codes, codes_wrap, codes_size, \
375
- NULL, 0, 0, flags)
376
-
377
-int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
378
- const void *bits, int bits_wrap, int bits_size,
379
- const void *codes, int codes_wrap, int codes_size,
380
- const void *symbols, int symbols_wrap, int symbols_size,
381
- int flags);
382
-#define INIT_VLC_LE 2
383
-#define INIT_VLC_USE_NEW_STATIC 4
384
-void free_vlc(VLC *vlc);
385
-
386
-#define INIT_VLC_STATIC(vlc, bits, a,b,c,d,e,f,g, static_size) do { \
387
- static VLC_TYPE table[static_size][2]; \
388
- (vlc)->table = table; \
389
- (vlc)->table_allocated = static_size; \
390
- init_vlc(vlc, bits, a,b,c,d,e,f,g, INIT_VLC_USE_NEW_STATIC); \
391
- } while (0)
392
-
393
-
394
-/**
395
- * If the vlc code is invalid and max_depth=1, then no bits will be removed.
396
- * If the vlc code is invalid and max_depth>1, then the number of bits removed
397
- * is undefined.
398
- */
399
-#define GET_VLC(code, name, gb, table, bits, max_depth) \
400
- do { \
401
- int n, nb_bits; \
402
- unsigned int index; \
403
- \
404
- index = SHOW_UBITS(name, gb, bits); \
405
- code = table[index][0]; \
406
- n = table[index][1]; \
407
- \
408
- if (max_depth > 1 && n < 0) { \
409
- LAST_SKIP_BITS(name, gb, bits); \
410
- UPDATE_CACHE(name, gb); \
411
- \
412
- nb_bits = -n; \
413
- \
414
- index = SHOW_UBITS(name, gb, nb_bits) + code; \
415
- code = table[index][0]; \
416
- n = table[index][1]; \
417
- if (max_depth > 2 && n < 0) { \
418
- LAST_SKIP_BITS(name, gb, nb_bits); \
419
- UPDATE_CACHE(name, gb); \
420
- \
421
- nb_bits = -n; \
422
- \
423
- index = SHOW_UBITS(name, gb, nb_bits) + code; \
424
- code = table[index][0]; \
425
- n = table[index][1]; \
426
- } \
427
- } \
428
- SKIP_BITS(name, gb, n); \
429
- } while (0)
430
-
431
-#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update) \
432
- do { \
433
- int n, nb_bits; \
434
- unsigned int index; \
435
- \
436
- index = SHOW_UBITS(name, gb, bits); \
437
- level = table[index].level; \
438
- n = table[index].len; \
439
- \
440
- if (max_depth > 1 && n < 0) { \
441
- SKIP_BITS(name, gb, bits); \
442
- if (need_update) { \
443
- UPDATE_CACHE(name, gb); \
444
- } \
445
- \
446
- nb_bits = -n; \
447
- \
448
- index = SHOW_UBITS(name, gb, nb_bits) + level; \
449
- level = table[index].level; \
450
- n = table[index].len; \
451
- } \
452
- run = table[index].run; \
453
- SKIP_BITS(name, gb, n); \
454
- } while (0)
455
-
456
-
457
-/**
458
- * Parse a vlc code.
459
- * @param bits is the number of bits which will be read at once, must be
460
- * identical to nb_bits in init_vlc()
461
- * @param max_depth is the number of times bits bits must be read to completely
462
- * read the longest vlc code
463
- * = (max_vlc_length + bits - 1) / bits
464
- */
465
-static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2],
466
- int bits, int max_depth)
467
-{
468
- int code;
469
-
470
- OPEN_READER(re, s);
471
- UPDATE_CACHE(re, s);
472
-
473
- GET_VLC(code, re, s, table, bits, max_depth);
474
-
475
- CLOSE_READER(re, s);
476
- return code;
477
-}
478
-
479
-static inline int decode012(GetBitContext *gb)
480
-{
481
- int n;
482
- n = get_bits1(gb);
483
- if (n == 0)
484
- return 0;
485
- else
486
- return get_bits1(gb) + 1;
487
-}
488
-
489
-static inline int decode210(GetBitContext *gb)
490
-{
491
- if (get_bits1(gb))
492
- return 0;
493
- else
494
- return 2 - get_bits1(gb);
495
-}
496
-
497
-static inline int get_bits_left(GetBitContext *gb)
498
-{
499
- return gb->size_in_bits - get_bits_count(gb);
500
-}
501
-
502
-//#define TRACE
503
-
504
-#ifdef TRACE
505
-static inline void print_bin(int bits, int n)
506
-{
507
- int i;
508
-
509
- for (i = n-1; i >= 0; i--) {
510
- av_log(NULL, AV_LOG_DEBUG, "%d", (bits>>i)&1);
511
- }
512
- for (i = n; i < 24; i++)
513
- av_log(NULL, AV_LOG_DEBUG, " ");
514
-}
515
-
516
-static inline int get_bits_trace(GetBitContext *s, int n, char *file,
517
- const char *func, int line)
518
-{
519
- int r = get_bits(s, n);
520
-
521
- print_bin(r, n);
522
- av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d bit @%5d in %s %s:%d\n",
523
- r, n, r, get_bits_count(s)-n, file, func, line);
524
- return r;
525
-}
526
-static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2],
527
- int bits, int max_depth, char *file,
528
- const char *func, int line)
529
-{
530
- int show = show_bits(s, 24);
531
- int pos = get_bits_count(s);
532
- int r = get_vlc2(s, table, bits, max_depth);
533
- int len = get_bits_count(s) - pos;
534
- int bits2 = show >> (24-len);
535
-
536
- print_bin(bits2, len);
537
-
538
- av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d vlc @%5d in %s %s:%d\n",
539
- bits2, len, r, pos, file, func, line);
540
- return r;
541
-}
542
-static inline int get_xbits_trace(GetBitContext *s, int n, char *file,
543
- const char *func, int line)
544
-{
545
- int show = show_bits(s, n);
546
- int r = get_xbits(s, n);
547
-
548
- print_bin(show, n);
549
- av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d xbt @%5d in %s %s:%d\n",
550
- show, n, r, get_bits_count(s)-n, file, func, line);
551
- return r;
552
-}
553
-
554
-#define get_bits(s, n) get_bits_trace(s, n, __FILE__, __PRETTY_FUNCTION__, __LINE__)
555
-#define get_bits1(s) get_bits_trace(s, 1, __FILE__, __PRETTY_FUNCTION__, __LINE__)
556
-#define get_xbits(s, n) get_xbits_trace(s, n, __FILE__, __PRETTY_FUNCTION__, __LINE__)
557
-#define get_vlc(s, vlc) get_vlc_trace(s, (vlc)->table, (vlc)->bits, 3, __FILE__, __PRETTY_FUNCTION__, __LINE__)
558
-#define get_vlc2(s, tab, bits, max) get_vlc_trace(s, tab, bits, max, __FILE__, __PRETTY_FUNCTION__, __LINE__)
559
-
560
-#define tprintf(p, ...) av_log(p, AV_LOG_DEBUG, __VA_ARGS__)
561
-
562
-#else //TRACE
563
-#define tprintf(p, ...) {}
564
-#endif
565
-
566
-#endif /* AVCODEC_GET_BITS_H */
567
makemkv-oss-1.8.5.tar.gz/libffcodec/src/misc.h
Deleted
107
1
2
-/*
3
- libMakeMKV - MKV multiplexer library
4
-
5
- Copyright (C) 2007-2013 GuinpinSoft inc <libmkv@makemkv.com>
6
-
7
- This library is free software; you can redistribute it and/or
8
- modify it under the terms of the GNU Lesser General Public
9
- License as published by the Free Software Foundation; either
10
- version 2.1 of the License, or (at your option) any later version.
11
-
12
- This library is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- Lesser General Public License for more details.
16
-
17
- You should have received a copy of the GNU Lesser General Public
18
- License along with this library; if not, write to the Free Software
19
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
-
21
-*/
22
-#ifndef FFCODEC_MISC_H
23
-#define FFCODEC_MISC_H
24
-
25
-#include <stdint.h>
26
-#include <stdio.h>
27
-#include <string.h>
28
-#include <unistd.h>
29
-
30
-#define CONFIG_HARDCODED_TABLES 1
31
-#define CONFIG_SMALL 1
32
-#define CONFIG_FFSERVER 0
33
-#define ALT_BITSTREAM_READER 1
34
-
35
-#define av_pure
36
-#define av_cold
37
-#define av_unused
38
-
39
-#ifdef _MSC_VER
40
-#define inline __inline
41
-#define av_always_inline __inline
42
-#define ffcdecl __cdecl
43
-#else
44
-#define inline __inline__
45
-#define av_always_inline __inline__
46
-#define ffcdecl
47
-#endif
48
-
49
-static uint32_t av_bswap32(uint32_t i)
50
-{
51
- uint32_t j;
52
- j = (i << 24);
53
- j |= (i << 8) & 0x00FF0000;
54
- j |= (i >> 8) & 0x0000FF00;
55
- j |= (i >> 24);
56
- return j;
57
-}
58
-
59
-#define AVERROR(x) -4
60
-
61
-typedef int (ffcdecl *AVIOReadProc)(uintptr_t fd, unsigned char *buf, unsigned int size);
62
-typedef int (ffcdecl *AVIOWriteProc)(uintptr_t fd, const unsigned char *buf, unsigned int size);
63
-
64
-typedef struct AVIOContext
65
-{
66
- uintptr_t fd;
67
- uint64_t pos;
68
- AVIOReadProc read;
69
- AVIOWriteProc write;
70
- uint8_t* buffer;
71
- int buffer_size;
72
- int buffer_max_size;
73
-} AVIOContext;
74
-
75
-#define FFM_STREAM_HEADER_SIZE 0x0100 ///< Stream header size
76
-
77
-typedef struct AVFormatContext
78
-{
79
- void* priv_data;
80
- AVIOContext* pb;
81
- uint8_t stream0_data[FFM_STREAM_HEADER_SIZE];
82
-} AVFormatContext;
83
-
84
-typedef struct AVPacket
85
-{
86
- uint8_t* data;
87
- uint32_t size;
88
- uint64_t pos;
89
- uint32_t flags;
90
- uint8_t stream_index;
91
- uint64_t pts;
92
- uint64_t dts;
93
- uint32_t duration;
94
-} AVPacket;
95
-
96
-typedef struct AVAudioInfo
97
-{
98
- int channels;
99
- uint64_t channel_layout;
100
-} AVAudioInfo;
101
-
102
-#include "ffmisc.h"
103
-
104
-
105
-#endif /* FFCODEC_MISC_H */
106
-
107
makemkv-oss-1.8.5.tar.gz/libffcodec/src/mlp.c
Deleted
117
1
2
-/*
3
- * MLP codec common code
4
- * Copyright (c) 2007-2008 Ian Caulfield
5
- *
6
- * This file is part of FFmpeg.
7
- *
8
- * FFmpeg is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * FFmpeg is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with FFmpeg; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-#include <stdint.h>
24
-
25
-#include "crc.h"
26
-#include "mlp.h"
27
-#include "misc.h"
28
-
29
-const uint8_t ff_mlp_huffman_tables[3][18][2] = {
30
- { /* Huffman table 0, -7 - +10 */
31
- {0x01, 9}, {0x01, 8}, {0x01, 7}, {0x01, 6}, {0x01, 5}, {0x01, 4}, {0x01, 3},
32
- {0x04, 3}, {0x05, 3}, {0x06, 3}, {0x07, 3},
33
- {0x03, 3}, {0x05, 4}, {0x09, 5}, {0x11, 6}, {0x21, 7}, {0x41, 8}, {0x81, 9},
34
- }, { /* Huffman table 1, -7 - +8 */
35
- {0x01, 9}, {0x01, 8}, {0x01, 7}, {0x01, 6}, {0x01, 5}, {0x01, 4}, {0x01, 3},
36
- {0x02, 2}, {0x03, 2},
37
- {0x03, 3}, {0x05, 4}, {0x09, 5}, {0x11, 6}, {0x21, 7}, {0x41, 8}, {0x81, 9},
38
- }, { /* Huffman table 2, -7 - +7 */
39
- {0x01, 9}, {0x01, 8}, {0x01, 7}, {0x01, 6}, {0x01, 5}, {0x01, 4}, {0x01, 3},
40
- {0x01, 1},
41
- {0x03, 3}, {0x05, 4}, {0x09, 5}, {0x11, 6}, {0x21, 7}, {0x41, 8}, {0x81, 9},
42
- }
43
-};
44
-
45
-static int crc_init = 0;
46
-#if CONFIG_SMALL
47
-#define CRC_TABLE_SIZE 257
48
-#else
49
-#define CRC_TABLE_SIZE 1024
50
-#endif
51
-static AVCRC crc_63[CRC_TABLE_SIZE];
52
-static AVCRC crc_1D[CRC_TABLE_SIZE];
53
-static AVCRC crc_2D[CRC_TABLE_SIZE];
54
-
55
-av_cold void ff_mlp_init_crc(void)
56
-{
57
- if (!crc_init) {
58
- av_crc_init(crc_63, 0, 8, 0x63, sizeof(crc_63));
59
- av_crc_init(crc_1D, 0, 8, 0x1D, sizeof(crc_1D));
60
- av_crc_init(crc_2D, 0, 16, 0x002D, sizeof(crc_2D));
61
- crc_init = 1;
62
- }
63
-}
64
-
65
-uint16_t ff_mlp_checksum16(const uint8_t *buf, unsigned int buf_size)
66
-{
67
- uint16_t crc;
68
-
69
- crc = av_crc(crc_2D, 0, buf, buf_size - 2);
70
- crc ^= AV_RL16(buf + buf_size - 2);
71
- return crc;
72
-}
73
-
74
-uint8_t ff_mlp_checksum8(const uint8_t *buf, unsigned int buf_size)
75
-{
76
- uint8_t checksum = av_crc(crc_63, 0x3c, buf, buf_size - 1); // crc_63[0xa2] == 0x3c
77
- checksum ^= buf[buf_size-1];
78
- return checksum;
79
-}
80
-
81
-uint8_t ff_mlp_restart_checksum(const uint8_t *buf, unsigned int bit_size)
82
-{
83
- int i;
84
- int num_bytes = (bit_size + 2) / 8;
85
-
86
- int crc = crc_1D[buf[0] & 0x3f];
87
- crc = av_crc(crc_1D, crc, buf + 1, num_bytes - 2);
88
- crc ^= buf[num_bytes - 1];
89
-
90
- for (i = 0; i < ((bit_size + 2) & 7); i++) {
91
- crc <<= 1;
92
- if (crc & 0x100)
93
- crc ^= 0x11D;
94
- crc ^= (buf[num_bytes] >> (7 - i)) & 1;
95
- }
96
-
97
- return crc;
98
-}
99
-
100
-uint8_t ff_mlp_calculate_parity(const uint8_t *buf, unsigned int buf_size)
101
-{
102
- uint32_t scratch = 0;
103
- const uint8_t *buf_end = buf + buf_size;
104
-
105
- for (; ((intptr_t) buf & 3) && buf < buf_end; buf++)
106
- scratch ^= *buf;
107
- for (; buf < buf_end - 3; buf += 4)
108
- scratch ^= *((const uint32_t*)buf);
109
-
110
- scratch = xor_32_to_8(scratch);
111
-
112
- for (; buf < buf_end; buf++)
113
- scratch ^= *buf;
114
-
115
- return scratch;
116
-}
117
makemkv-oss-1.8.5.tar.gz/libffcodec/src/mlp.h
Deleted
127
1
2
-/*
3
- * MLP codec common header file
4
- * Copyright (c) 2007-2008 Ian Caulfield
5
- *
6
- * This file is part of FFmpeg.
7
- *
8
- * FFmpeg is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * FFmpeg is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with FFmpeg; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-#ifndef AVCODEC_MLP_H
24
-#define AVCODEC_MLP_H
25
-
26
-#include <stdint.h>
27
-
28
-/** Last possible matrix channel for each codec */
29
-#define MAX_MATRIX_CHANNEL_MLP 5
30
-#define MAX_MATRIX_CHANNEL_TRUEHD 7
31
-/** Maximum number of channels in a valid stream.
32
- * MLP : 5.1 + 2 noise channels -> 8 channels
33
- * TrueHD: 7.1 -> 8 channels
34
- */
35
-#define MAX_CHANNELS 8
36
-
37
-/** Maximum number of matrices used in decoding; most streams have one matrix
38
- * per output channel, but some rematrix a channel (usually 0) more than once.
39
- */
40
-#define MAX_MATRICES_MLP 6
41
-#define MAX_MATRICES_TRUEHD 8
42
-#define MAX_MATRICES 8
43
-
44
-/** Maximum number of substreams that can be decoded.
45
- * MLP's limit is 2. TrueHD supports at least up to 3.
46
- */
47
-#define MAX_SUBSTREAMS 3
48
-
49
-/** which multiple of 48000 the maximum sample rate is */
50
-#define MAX_RATEFACTOR 4
51
-/** maximum sample frequency seen in files */
52
-#define MAX_SAMPLERATE (MAX_RATEFACTOR * 48000)
53
-
54
-/** maximum number of audio samples within one access unit */
55
-#define MAX_BLOCKSIZE (40 * MAX_RATEFACTOR)
56
-/** next power of two greater than MAX_BLOCKSIZE */
57
-#define MAX_BLOCKSIZE_POW2 (64 * MAX_RATEFACTOR)
58
-
59
-/** number of allowed filters */
60
-#define NUM_FILTERS 2
61
-
62
-/** The maximum number of taps in IIR and FIR filters. */
63
-#define MAX_FIR_ORDER 8
64
-#define MAX_IIR_ORDER 4
65
-
66
-/** Code that signals end of a stream. */
67
-#define END_OF_STREAM 0xd234d234
68
-
69
-#define FIR 0
70
-#define IIR 1
71
-
72
-/** filter data */
73
-typedef struct {
74
- uint8_t order; ///< number of taps in filter
75
- uint8_t shift; ///< Right shift to apply to output of filter.
76
-
77
- int32_t state[MAX_FIR_ORDER];
78
-} FilterParams;
79
-
80
-/** sample data coding information */
81
-typedef struct {
82
- FilterParams filter_params[NUM_FILTERS];
83
- int32_t coeff[NUM_FILTERS][MAX_FIR_ORDER];
84
-
85
- int16_t huff_offset; ///< Offset to apply to residual values.
86
- int32_t sign_huff_offset; ///< sign/rounding-corrected version of huff_offset
87
- uint8_t codebook; ///< Which VLC codebook to use to read residuals.
88
- uint8_t huff_lsbs; ///< Size of residual suffix not encoded using VLC.
89
-} ChannelParams;
90
-
91
-/** Tables defining the Huffman codes.
92
- * There are three entropy coding methods used in MLP (four if you count
93
- * "none" as a method). These use the same sequences for codes starting with
94
- * 00 or 01, but have different codes starting with 1.
95
- */
96
-extern const uint8_t ff_mlp_huffman_tables[3][18][2];
97
-
98
-/** MLP uses checksums that seem to be based on the standard CRC algorithm, but
99
- * are not (in implementation terms, the table lookup and XOR are reversed).
100
- * We can implement this behavior using a standard av_crc on all but the
101
- * last element, then XOR that with the last element.
102
- */
103
-uint8_t ff_mlp_checksum8 (const uint8_t *buf, unsigned int buf_size);
104
-uint16_t ff_mlp_checksum16(const uint8_t *buf, unsigned int buf_size);
105
-
106
-/** Calculate an 8-bit checksum over a restart header -- a non-multiple-of-8
107
- * number of bits, starting two bits into the first byte of buf.
108
- */
109
-uint8_t ff_mlp_restart_checksum(const uint8_t *buf, unsigned int bit_size);
110
-
111
-/** XOR together all the bytes of a buffer.
112
- * Does this belong in dspcontext?
113
- */
114
-uint8_t ff_mlp_calculate_parity(const uint8_t *buf, unsigned int buf_size);
115
-
116
-void ff_mlp_init_crc(void);
117
-
118
-/** XOR four bytes into one. */
119
-static inline uint8_t xor_32_to_8(uint32_t value)
120
-{
121
- value ^= value >> 16;
122
- value ^= value >> 8;
123
- return value;
124
-}
125
-
126
-#endif /* AVCODEC_MLP_H */
127
makemkv-oss-1.8.5.tar.gz/libffcodec/src/mlp_parser.c
Deleted
212
1
2
-/*
3
- * MLP parser
4
- * Copyright (c) 2007 Ian Caulfield
5
- *
6
- * This file is part of FFmpeg.
7
- *
8
- * FFmpeg is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * FFmpeg is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with FFmpeg; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-/**
24
- * @file
25
- * MLP parser
26
- */
27
-
28
-#include <stdint.h>
29
-
30
-#include "misc.h"
31
-#include "crc.h"
32
-#include "get_bits.h"
33
-#include "mlp_parser.h"
34
-#include "mlp.h"
35
-#include "audioconvert.h"
36
-
37
-static const uint8_t mlp_quants[16] = {
38
- 16, 20, 24, 0, 0, 0, 0, 0,
39
- 0, 0, 0, 0, 0, 0, 0, 0,
40
-};
41
-
42
-static const uint8_t mlp_channels[32] = {
43
- 1, 2, 3, 4, 3, 4, 5, 3, 4, 5, 4, 5, 6, 4, 5, 4,
44
- 5, 6, 5, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
45
-};
46
-
47
-const uint64_t ff_mlp_layout[32] = {
48
- AV_CH_LAYOUT_MONO,
49
- AV_CH_LAYOUT_STEREO,
50
- AV_CH_LAYOUT_2_1,
51
- AV_CH_LAYOUT_QUAD,
52
- AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY,
53
- AV_CH_LAYOUT_2_1|AV_CH_LOW_FREQUENCY,
54
- AV_CH_LAYOUT_QUAD|AV_CH_LOW_FREQUENCY,
55
- AV_CH_LAYOUT_SURROUND,
56
- AV_CH_LAYOUT_4POINT0,
57
- AV_CH_LAYOUT_5POINT0_BACK,
58
- AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY,
59
- AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY,
60
- AV_CH_LAYOUT_5POINT1_BACK,
61
- AV_CH_LAYOUT_4POINT0,
62
- AV_CH_LAYOUT_5POINT0_BACK,
63
- AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY,
64
- AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY,
65
- AV_CH_LAYOUT_5POINT1_BACK,
66
- AV_CH_LAYOUT_QUAD|AV_CH_LOW_FREQUENCY,
67
- AV_CH_LAYOUT_5POINT0_BACK,
68
- AV_CH_LAYOUT_5POINT1_BACK,
69
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
70
-};
71
-
72
-static const uint8_t thd_chancount[13] = {
73
-// LR C LFE LRs LRvh LRc LRrs Cs Ts LRsd LRw Cvh LFE2
74
- 2, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1
75
-};
76
-
77
-static const uint64_t thd_layout[13] = {
78
- AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT, // LR
79
- AV_CH_FRONT_CENTER, // C
80
- AV_CH_LOW_FREQUENCY, // LFE
81
- AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, // LRs
82
- AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT, // LRvh
83
- AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER, // LRc
84
- AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT, // LRrs
85
- AV_CH_BACK_CENTER, // Cs
86
- AV_CH_TOP_CENTER, // Ts
87
- AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, // LRsd - TODO: Surround Direct
88
- AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER, // LRw - TODO: Wide
89
- AV_CH_TOP_FRONT_CENTER, // Cvh
90
- AV_CH_LOW_FREQUENCY // LFE2
91
-};
92
-
93
-static int mlp_samplerate(int in)
94
-{
95
- if (in == 0xF)
96
- return 0;
97
-
98
- return (in & 8 ? 44100 : 48000) << (in & 7) ;
99
-}
100
-
101
-static int truehd_channels(int chanmap)
102
-{
103
- int channels = 0, i;
104
-
105
- for (i = 0; i < 13; i++)
106
- channels += thd_chancount[i] * ((chanmap >> i) & 1);
107
-
108
- return channels;
109
-}
110
-
111
-uint64_t ff_truehd_layout(int chanmap)
112
-{
113
- int layout = 0, i;
114
-
115
- for (i = 0; i < 13; i++)
116
- layout |= thd_layout[i] * ((chanmap >> i) & 1);
117
-
118
- return layout;
119
-}
120
-
121
-/** Read a major sync info header - contains high level information about
122
- * the stream - sample rate, channel arrangement etc. Most of this
123
- * information is not actually necessary for decoding, only for playback.
124
- * gb must be a freshly initialized GetBitContext with no bits read.
125
- */
126
-
127
-int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
128
-{
129
- int ratebits;
130
- uint16_t checksum;
131
-
132
- //assert(get_bits_count(gb) == 0);
133
-
134
- if (gb->size_in_bits < 28 << 3) {
135
- return -1;
136
- }
137
-
138
- checksum = ff_mlp_checksum16(gb->buffer, 26);
139
- if (checksum != AV_RL16(gb->buffer+26)) {
140
- return AVERROR_INVALIDDATA;
141
- }
142
-
143
- if (get_bits_long(gb, 24) != 0xf8726f) /* Sync words */
144
- return AVERROR_INVALIDDATA;
145
-
146
- mh->stream_type = get_bits(gb, 8);
147
-
148
- if (mh->stream_type == 0xbb) {
149
- mh->group1_bits = mlp_quants[get_bits(gb, 4)];
150
- mh->group2_bits = mlp_quants[get_bits(gb, 4)];
151
-
152
- ratebits = get_bits(gb, 4);
153
- mh->group1_samplerate = mlp_samplerate(ratebits);
154
- mh->group2_samplerate = mlp_samplerate(get_bits(gb, 4));
155
-
156
- skip_bits(gb, 11);
157
-
158
- mh->channels_mlp = get_bits(gb, 5);
159
- } else if (mh->stream_type == 0xba) {
160
- mh->group1_bits = 24; // TODO: Is this information actually conveyed anywhere?
161
- mh->group2_bits = 0;
162
-
163
- ratebits = get_bits(gb, 4);
164
- mh->group1_samplerate = mlp_samplerate(ratebits);
165
- mh->group2_samplerate = 0;
166
-
167
- skip_bits(gb, 8);
168
-
169
- mh->channels_thd_stream1 = get_bits(gb, 5);
170
-
171
- skip_bits(gb, 2);
172
-
173
- mh->channels_thd_stream2 = get_bits(gb, 13);
174
- } else
175
- return AVERROR_INVALIDDATA;
176
-
177
- mh->access_unit_size = 40 << (ratebits & 7);
178
- mh->access_unit_size_pow2 = 64 << (ratebits & 7);
179
-
180
- skip_bits_long(gb, 48);
181
-
182
- mh->is_vbr = get_bits1(gb);
183
-
184
- mh->peak_bitrate = (get_bits(gb, 15) * mh->group1_samplerate + 8) >> 4;
185
-
186
- mh->num_substreams = get_bits(gb, 4);
187
-
188
- skip_bits_long(gb, 4 + 11 * 8);
189
-
190
- return 0;
191
-}
192
-
193
-int ffcdecl ffcodec_ff_mlp_get_audio_info(const MLPHeaderInfo *mh,AVAudioInfo* avctx)
194
-{
195
- if (mh->stream_type == 0xbb) {
196
- /* MLP stream */
197
- avctx->channels = mlp_channels[mh->channels_mlp];
198
- avctx->channel_layout = ff_mlp_layout[mh->channels_mlp];
199
- } else { /* mh.stream_type == 0xba */
200
- /* TrueHD stream */
201
- if (mh->channels_thd_stream2) {
202
- avctx->channels = truehd_channels(mh->channels_thd_stream2);
203
- avctx->channel_layout = ff_truehd_layout(mh->channels_thd_stream2);
204
- } else {
205
- avctx->channels = truehd_channels(mh->channels_thd_stream1);
206
- avctx->channel_layout = ff_truehd_layout(mh->channels_thd_stream1);
207
- }
208
- }
209
- return 0;
210
-}
211
-
212
makemkv-oss-1.8.5.tar.gz/libffcodec/src/mlp_parser.h
Deleted
64
1
2
-/*
3
- * MLP parser prototypes
4
- * Copyright (c) 2007 Ian Caulfield
5
- *
6
- * This file is part of FFmpeg.
7
- *
8
- * FFmpeg is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * FFmpeg is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with FFmpeg; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-/**
24
- * @file
25
- * MLP parser prototypes
26
- */
27
-
28
-#ifndef AVCODEC_MLP_PARSER_H
29
-#define AVCODEC_MLP_PARSER_H
30
-
31
-#include "get_bits.h"
32
-
33
-typedef struct MLPHeaderInfo
34
-{
35
- int stream_type; ///< 0xBB for MLP, 0xBA for TrueHD
36
-
37
- int group1_bits; ///< The bit depth of the first substream
38
- int group2_bits; ///< Bit depth of the second substream (MLP only)
39
-
40
- int group1_samplerate; ///< Sample rate of first substream
41
- int group2_samplerate; ///< Sample rate of second substream (MLP only)
42
-
43
- int channels_mlp; ///< Channel arrangement for MLP streams
44
- int channels_thd_stream1; ///< Channel arrangement for substream 1 of TrueHD streams (5.1)
45
- int channels_thd_stream2; ///< Channel arrangement for substream 2 of TrueHD streams (7.1)
46
-
47
- int access_unit_size; ///< Number of samples per coded frame
48
- int access_unit_size_pow2; ///< Next power of two above number of samples per frame
49
-
50
- int is_vbr; ///< Stream is VBR instead of CBR
51
- int peak_bitrate; ///< Peak bitrate for VBR, actual bitrate (==peak) for CBR
52
-
53
- int num_substreams; ///< Number of substreams within stream
54
-} MLPHeaderInfo;
55
-
56
-
57
-int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb);
58
-uint64_t ff_truehd_layout(int chanmap);
59
-
60
-extern const uint64_t ff_mlp_layout[32];
61
-
62
-#endif /* AVCODEC_MLP_PARSER_H */
63
-
64
makemkv-oss-1.8.5.tar.gz/libffcodec/src/mpegaudio.h
Deleted
77
1
2
-/*
3
- * copyright (c) 2001 Fabrice Bellard
4
- *
5
- * This file is part of FFmpeg.
6
- *
7
- * FFmpeg is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
11
- *
12
- * FFmpeg is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with FFmpeg; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
- */
21
-
22
-/**
23
- * @file
24
- * mpeg audio declarations for both encoder and decoder.
25
- */
26
-
27
-#ifndef AVCODEC_MPEGAUDIO_H
28
-#define AVCODEC_MPEGAUDIO_H
29
-
30
-#ifndef CONFIG_FLOAT
31
-# define CONFIG_FLOAT 0
32
-#endif
33
-
34
-#include <stdint.h>
35
-
36
-/* max frame size, in samples */
37
-#define MPA_FRAME_SIZE 1152
38
-
39
-/* max compressed frame size */
40
-#define MPA_MAX_CODED_FRAME_SIZE 1792
41
-
42
-#define MPA_MAX_CHANNELS 2
43
-
44
-#define SBLIMIT 32 /* number of subbands */
45
-
46
-#define MPA_STEREO 0
47
-#define MPA_JSTEREO 1
48
-#define MPA_DUAL 2
49
-#define MPA_MONO 3
50
-
51
-#ifndef FRAC_BITS
52
-#define FRAC_BITS 23 /* fractional bits for sb_samples and dct */
53
-#define WFRAC_BITS 16 /* fractional bits for window */
54
-#endif
55
-
56
-#define FRAC_ONE (1 << FRAC_BITS)
57
-
58
-#define FIX(a) ((int)((a) * FRAC_ONE))
59
-
60
-#if CONFIG_FLOAT
61
-# define INTFLOAT float
62
-typedef float MPA_INT;
63
-typedef float OUT_INT;
64
-#elif FRAC_BITS <= 15
65
-# define INTFLOAT int
66
-typedef int16_t MPA_INT;
67
-typedef int16_t OUT_INT;
68
-#else
69
-# define INTFLOAT int
70
-typedef int32_t MPA_INT;
71
-typedef int16_t OUT_INT;
72
-#endif
73
-
74
-int ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf);
75
-
76
-#endif /* AVCODEC_MPEGAUDIO_H */
77
makemkv-oss-1.8.5.tar.gz/libffcodec/src/mpegaudiodata.c
Deleted
190
1
2
-/*
3
- * MPEG Audio common tables
4
- * copyright (c) 2002 Fabrice Bellard
5
- *
6
- * This file is part of FFmpeg.
7
- *
8
- * FFmpeg is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * FFmpeg is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with FFmpeg; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-/**
24
- * @file
25
- * mpeg audio layer common tables.
26
- */
27
-
28
-#include "mpegaudiodata.h"
29
-
30
-
31
-const uint16_t avpriv_mpa_bitrate_tab[2][3][15] = {
32
- { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },
33
- {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 },
34
- {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } },
35
- { {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256},
36
- {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160},
37
- {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160}
38
- }
39
-};
40
-
41
-const uint16_t avpriv_mpa_freq_tab[3] = { 44100, 48000, 32000 };
42
-
43
-#if 0
44
-
45
-/*******************************************************/
46
-/* half mpeg encoding window (full precision) */
47
-const int32_t ff_mpa_enwindow[257] = {
48
- 0, -1, -1, -1, -1, -1, -1, -2,
49
- -2, -2, -2, -3, -3, -4, -4, -5,
50
- -5, -6, -7, -7, -8, -9, -10, -11,
51
- -13, -14, -16, -17, -19, -21, -24, -26,
52
- -29, -31, -35, -38, -41, -45, -49, -53,
53
- -58, -63, -68, -73, -79, -85, -91, -97,
54
- -104, -111, -117, -125, -132, -139, -147, -154,
55
- -161, -169, -176, -183, -190, -196, -202, -208,
56
- 213, 218, 222, 225, 227, 228, 228, 227,
57
- 224, 221, 215, 208, 200, 189, 177, 163,
58
- 146, 127, 106, 83, 57, 29, -2, -36,
59
- -72, -111, -153, -197, -244, -294, -347, -401,
60
- -459, -519, -581, -645, -711, -779, -848, -919,
61
- -991, -1064, -1137, -1210, -1283, -1356, -1428, -1498,
62
- -1567, -1634, -1698, -1759, -1817, -1870, -1919, -1962,
63
- -2001, -2032, -2057, -2075, -2085, -2087, -2080, -2063,
64
- 2037, 2000, 1952, 1893, 1822, 1739, 1644, 1535,
65
- 1414, 1280, 1131, 970, 794, 605, 402, 185,
66
- -45, -288, -545, -814, -1095, -1388, -1692, -2006,
67
- -2330, -2663, -3004, -3351, -3705, -4063, -4425, -4788,
68
- -5153, -5517, -5879, -6237, -6589, -6935, -7271, -7597,
69
- -7910, -8209, -8491, -8755, -8998, -9219, -9416, -9585,
70
- -9727, -9838, -9916, -9959, -9966, -9935, -9863, -9750,
71
- -9592, -9389, -9139, -8840, -8492, -8092, -7640, -7134,
72
- 6574, 5959, 5288, 4561, 3776, 2935, 2037, 1082,
73
- 70, -998, -2122, -3300, -4533, -5818, -7154, -8540,
74
- -9975,-11455,-12980,-14548,-16155,-17799,-19478,-21189,
75
--22929,-24694,-26482,-28289,-30112,-31947,-33791,-35640,
76
--37489,-39336,-41176,-43006,-44821,-46617,-48390,-50137,
77
--51853,-53534,-55178,-56778,-58333,-59838,-61289,-62684,
78
--64019,-65290,-66494,-67629,-68692,-69679,-70590,-71420,
79
--72169,-72835,-73415,-73908,-74313,-74630,-74856,-74992,
80
- 75038,
81
-};
82
-
83
-/*******************************************************/
84
-/* layer 2 tables */
85
-
86
-const int ff_mpa_sblimit_table[5] = { 27 , 30 , 8, 12 , 30 };
87
-
88
-const int ff_mpa_quant_steps[17] = {
89
- 3, 5, 7, 9, 15,
90
- 31, 63, 127, 255, 511,
91
- 1023, 2047, 4095, 8191, 16383,
92
- 32767, 65535
93
-};
94
-
95
-/* we use a negative value if grouped */
96
-const int ff_mpa_quant_bits[17] = {
97
- -5, -7, 3, -10, 4,
98
- 5, 6, 7, 8, 9,
99
- 10, 11, 12, 13, 14,
100
- 15, 16
101
-};
102
-
103
-/* encoding tables which give the quantization index. Note how it is
104
- possible to store them efficiently ! */
105
-static const unsigned char alloc_table_1[] = {
106
- 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
107
- 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
108
- 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
109
- 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
110
- 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
111
- 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
112
- 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
113
- 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
114
- 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
115
- 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
116
- 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16,
117
- 3, 0, 1, 2, 3, 4, 5, 16,
118
- 3, 0, 1, 2, 3, 4, 5, 16,
119
- 3, 0, 1, 2, 3, 4, 5, 16,
120
- 3, 0, 1, 2, 3, 4, 5, 16,
121
- 3, 0, 1, 2, 3, 4, 5, 16,
122
- 3, 0, 1, 2, 3, 4, 5, 16,
123
- 3, 0, 1, 2, 3, 4, 5, 16,
124
- 3, 0, 1, 2, 3, 4, 5, 16,
125
- 3, 0, 1, 2, 3, 4, 5, 16,
126
- 3, 0, 1, 2, 3, 4, 5, 16,
127
- 3, 0, 1, 2, 3, 4, 5, 16,
128
- 3, 0, 1, 2, 3, 4, 5, 16,
129
- 2, 0, 1, 16,
130
- 2, 0, 1, 16,
131
- 2, 0, 1, 16,
132
- 2, 0, 1, 16,
133
- 2, 0, 1, 16,
134
- 2, 0, 1, 16,
135
- 2, 0, 1, 16,
136
-};
137
-
138
-static const unsigned char alloc_table_3[] = {
139
- 4, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
140
- 4, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
141
- 3, 0, 1, 3, 4, 5, 6, 7,
142
- 3, 0, 1, 3, 4, 5, 6, 7,
143
- 3, 0, 1, 3, 4, 5, 6, 7,
144
- 3, 0, 1, 3, 4, 5, 6, 7,
145
- 3, 0, 1, 3, 4, 5, 6, 7,
146
- 3, 0, 1, 3, 4, 5, 6, 7,
147
- 3, 0, 1, 3, 4, 5, 6, 7,
148
- 3, 0, 1, 3, 4, 5, 6, 7,
149
- 3, 0, 1, 3, 4, 5, 6, 7,
150
- 3, 0, 1, 3, 4, 5, 6, 7,
151
-};
152
-
153
-static const unsigned char alloc_table_4[] = {
154
- 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
155
- 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
156
- 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
157
- 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
158
- 3, 0, 1, 3, 4, 5, 6, 7,
159
- 3, 0, 1, 3, 4, 5, 6, 7,
160
- 3, 0, 1, 3, 4, 5, 6, 7,
161
- 3, 0, 1, 3, 4, 5, 6, 7,
162
- 3, 0, 1, 3, 4, 5, 6, 7,
163
- 3, 0, 1, 3, 4, 5, 6, 7,
164
- 3, 0, 1, 3, 4, 5, 6, 7,
165
- 2, 0, 1, 3,
166
- 2, 0, 1, 3,
167
- 2, 0, 1, 3,
168
- 2, 0, 1, 3,
169
- 2, 0, 1, 3,
170
- 2, 0, 1, 3,
171
- 2, 0, 1, 3,
172
- 2, 0, 1, 3,
173
- 2, 0, 1, 3,
174
- 2, 0, 1, 3,
175
- 2, 0, 1, 3,
176
- 2, 0, 1, 3,
177
- 2, 0, 1, 3,
178
- 2, 0, 1, 3,
179
- 2, 0, 1, 3,
180
- 2, 0, 1, 3,
181
- 2, 0, 1, 3,
182
- 2, 0, 1, 3,
183
- 2, 0, 1, 3,
184
-};
185
-
186
-const unsigned char * const ff_mpa_alloc_tables[5] =
187
-{ alloc_table_1, alloc_table_1, alloc_table_3, alloc_table_3, alloc_table_4, };
188
-
189
-#endif
190
makemkv-oss-1.8.5.tar.gz/libffcodec/src/mpegaudiodata.h
Deleted
45
1
2
-/*
3
- * MPEG Audio common tables
4
- * copyright (c) 2002 Fabrice Bellard
5
- *
6
- * This file is part of FFmpeg.
7
- *
8
- * FFmpeg is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * FFmpeg is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with FFmpeg; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-/**
24
- * @file
25
- * mpeg audio layer common tables.
26
- */
27
-
28
-#ifndef AVCODEC_MPEGAUDIODATA_H
29
-#define AVCODEC_MPEGAUDIODATA_H
30
-
31
-#include <stdint.h>
32
-
33
-#define MODE_EXT_MS_STEREO 2
34
-#define MODE_EXT_I_STEREO 1
35
-
36
-extern const uint16_t avpriv_mpa_bitrate_tab[2][3][15];
37
-extern const uint16_t avpriv_mpa_freq_tab[3];
38
-extern const int32_t ff_mpa_enwindow[257];
39
-extern const int ff_mpa_sblimit_table[5];
40
-extern const int ff_mpa_quant_steps[17];
41
-extern const int ff_mpa_quant_bits[17];
42
-extern const unsigned char * const ff_mpa_alloc_tables[5];
43
-
44
-#endif /* AVCODEC_MPEGAUDIODATA_H */
45
makemkv-oss-1.8.5.tar.gz/libffcodec/src/mpegaudiodecheader.c
Deleted
151
1
2
-/*
3
- * MPEG Audio header decoder
4
- * Copyright (c) 2001, 2002 Fabrice Bellard
5
- *
6
- * This file is part of FFmpeg.
7
- *
8
- * FFmpeg is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * FFmpeg is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with FFmpeg; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-/**
24
- * @file
25
- * MPEG Audio header decoder.
26
- */
27
-
28
-//#define DEBUG
29
-#include "misc.h"
30
-#include "mpegaudio.h"
31
-#include "mpegaudiodata.h"
32
-#include "mpegaudiodecheader.h"
33
-
34
-
35
-int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
36
-{
37
- int sample_rate, frame_size, mpeg25, padding;
38
- int sample_rate_index, bitrate_index;
39
- if (header & (1<<20)) {
40
- s->lsf = (header & (1<<19)) ? 0 : 1;
41
- mpeg25 = 0;
42
- } else {
43
- s->lsf = 1;
44
- mpeg25 = 1;
45
- }
46
-
47
- s->layer = 4 - ((header >> 17) & 3);
48
- /* extract frequency */
49
- sample_rate_index = (header >> 10) & 3;
50
- sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25);
51
- sample_rate_index += 3 * (s->lsf + mpeg25);
52
- s->sample_rate_index = sample_rate_index;
53
- s->error_protection = ((header >> 16) & 1) ^ 1;
54
- s->sample_rate = sample_rate;
55
-
56
- bitrate_index = (header >> 12) & 0xf;
57
- padding = (header >> 9) & 1;
58
- //extension = (header >> 8) & 1;
59
- s->mode = (header >> 6) & 3;
60
- s->mode_ext = (header >> 4) & 3;
61
- //copyright = (header >> 3) & 1;
62
- //original = (header >> 2) & 1;
63
- //emphasis = header & 3;
64
-
65
- if (s->mode == MPA_MONO)
66
- s->nb_channels = 1;
67
- else
68
- s->nb_channels = 2;
69
-
70
- if (bitrate_index != 0) {
71
- frame_size = avpriv_mpa_bitrate_tab[s->lsf][s->layer - 1][bitrate_index];
72
- s->bit_rate = frame_size * 1000;
73
- switch(s->layer) {
74
- case 1:
75
- frame_size = (frame_size * 12000) / sample_rate;
76
- frame_size = (frame_size + padding) * 4;
77
- break;
78
- case 2:
79
- frame_size = (frame_size * 144000) / sample_rate;
80
- frame_size += padding;
81
- break;
82
- default:
83
- case 3:
84
- frame_size = (frame_size * 144000) / (sample_rate << s->lsf);
85
- frame_size += padding;
86
- break;
87
- }
88
- s->frame_size = frame_size;
89
- } else {
90
- /* if no frame size computed, signal it */
91
- return 1;
92
- }
93
-
94
-#if defined(DEBUG)
95
- av_dlog(NULL, "layer%d, %d Hz, %d kbits/s, ",
96
- s->layer, s->sample_rate, s->bit_rate);
97
- if (s->nb_channels == 2) {
98
- if (s->layer == 3) {
99
- if (s->mode_ext & MODE_EXT_MS_STEREO)
100
- av_dlog(NULL, "ms-");
101
- if (s->mode_ext & MODE_EXT_I_STEREO)
102
- av_dlog(NULL, "i-");
103
- }
104
- av_dlog(NULL, "stereo");
105
- } else {
106
- av_dlog(NULL, "mono");
107
- }
108
- av_dlog(NULL, "\n");
109
-#endif
110
- return 0;
111
-}
112
-
113
-#if 0
114
-int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bit_rate)
115
-{
116
- MPADecodeHeader s1, *s = &s1;
117
-
118
- if (ff_mpa_check_header(head) != 0)
119
- return -1;
120
-
121
- if (avpriv_mpegaudio_decode_header(s, head) != 0) {
122
- return -1;
123
- }
124
-
125
- switch(s->layer) {
126
- case 1:
127
- avctx->codec_id = CODEC_ID_MP1;
128
- *frame_size = 384;
129
- break;
130
- case 2:
131
- avctx->codec_id = CODEC_ID_MP2;
132
- *frame_size = 1152;
133
- break;
134
- default:
135
- case 3:
136
- avctx->codec_id = CODEC_ID_MP3;
137
- if (s->lsf)
138
- *frame_size = 576;
139
- else
140
- *frame_size = 1152;
141
- break;
142
- }
143
-
144
- *sample_rate = s->sample_rate;
145
- *channels = s->nb_channels;
146
- *bit_rate = s->bit_rate;
147
- avctx->sub_id = s->layer;
148
- return s->frame_size;
149
-}
150
-#endif
151
makemkv-oss-1.8.5.tar.gz/libffcodec/src/mpegaudiodecheader.h
Deleted
78
1
2
-/*
3
- * MPEG Audio header decoder
4
- * Copyright (c) 2001, 2002 Fabrice Bellard
5
- *
6
- * This file is part of FFmpeg.
7
- *
8
- * FFmpeg is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * FFmpeg is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with FFmpeg; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-/**
24
- * @file
25
- * MPEG Audio header decoder.
26
- */
27
-
28
-#ifndef AVCODEC_MPEGAUDIODECHEADER_H
29
-#define AVCODEC_MPEGAUDIODECHEADER_H
30
-
31
-#include "misc.h"
32
-
33
-#define MP3_MASK 0xFFFE0CCF
34
-
35
-#define MPA_DECODE_HEADER \
36
- int frame_size; \
37
- int error_protection; \
38
- int layer; \
39
- int sample_rate; \
40
- int sample_rate_index; /* between 0 and 8 */ \
41
- int bit_rate; \
42
- int nb_channels; \
43
- int mode; \
44
- int mode_ext; \
45
- int lsf;
46
-
47
-typedef struct MPADecodeHeader {
48
- MPA_DECODE_HEADER
49
-} MPADecodeHeader;
50
-
51
-/* header decoding. MUST check the header before because no
52
- consistency check is done there. Return 1 if free format found and
53
- that the frame size must be computed externally */
54
-int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header);
55
-
56
-/* useful helper to get mpeg audio stream infos. Return -1 if error in
57
- header, otherwise the coded frame size in bytes */
58
-//int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate);
59
-
60
-/* fast header check for resync */
61
-static inline int ff_mpa_check_header(uint32_t header){
62
- /* header */
63
- if ((header & 0xffe00000) != 0xffe00000)
64
- return -1;
65
- /* layer check */
66
- if ((header & (3<<17)) == 0)
67
- return -1;
68
- /* bit rate */
69
- if ((header & (0xf<<12)) == 0xf<<12)
70
- return -1;
71
- /* frequency */
72
- if ((header & (3<<10)) == 3<<10)
73
- return -1;
74
- return 0;
75
-}
76
-
77
-#endif /* AVCODEC_MPEGAUDIODECHEADER_H */
78
makemkv-oss-1.8.5.tar.gz/libffcodec/src/mpegaudiomisc.h
Deleted
37
1
2
-/*
3
- * MPEG Audio parser
4
- * Copyright (c) 2003 Fabrice Bellard
5
- * Copyright (c) 2003 Michael Niedermayer
6
- *
7
- * This file is part of FFmpeg.
8
- *
9
- * FFmpeg is free software; you can redistribute it and/or
10
- * modify it under the terms of the GNU Lesser General Public
11
- * License as published by the Free Software Foundation; either
12
- * version 2.1 of the License, or (at your option) any later version.
13
- *
14
- * FFmpeg 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 GNU
17
- * Lesser General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU Lesser General Public
20
- * License along with FFmpeg; if not, write to the Free Software
21
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
- */
23
-#ifndef FFCODEC_MPEGAUDIOMISC_H
24
-#define FFCODEC_MPEGAUDIOMISC_H
25
-
26
-#include <stdint.h>
27
-
28
-#define MPA_HEADER_SIZE 4
29
-
30
-/* header + layer + bitrate + freq + lsf/mpeg25 */
31
-#define SAME_HEADER_MASK \
32
- (0xffe00000 | (3 << 17) | (3 << 10) | (3 << 19))
33
-
34
-
35
-#endif /* FFCODEC_MPEGAUDIOMISC_H */
36
-
37
makemkv-oss-1.8.6.tar.gz/libffabi
Added
2
1
+(directory)
2
makemkv-oss-1.8.6.tar.gz/libffabi/inc
Added
2
1
+(directory)
2
makemkv-oss-1.8.6.tar.gz/libffabi/inc/lgpl
Added
2
1
+(directory)
2
makemkv-oss-1.8.6.tar.gz/libffabi/inc/lgpl/ffabi.h
Added
132
1
2
+/*
3
+ libMakeMKV - MKV multiplexer library
4
+
5
+ Copyright (C) 2007-2013 GuinpinSoft inc <libmkv@makemkv.com>
6
+
7
+ This library is free software; you can redistribute it and/or
8
+ modify it under the terms of the GNU Lesser General Public
9
+ License as published by the Free Software Foundation; either
10
+ version 2.1 of the License, or (at your option) any later version.
11
+
12
+ This library is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ Lesser General Public License for more details.
16
+
17
+ You should have received a copy of the GNU Lesser General Public
18
+ License along with this library; if not, write to the Free Software
19
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
+
21
+*/
22
+#ifndef LGPL_FFABI_H_INCLUDED
23
+#define LGPL_FFABI_H_INCLUDED
24
+
25
+#include <stddef.h>
26
+#include <stdint.h>
27
+
28
+#if !defined(_MSC_VER) && !defined(__cdecl)
29
+#define __cdecl
30
+#endif
31
+
32
+typedef enum _FFM_CodecID {
33
+ FFM_CODEC_ID_AC3 = 0x15003,
34
+ FFM_CODEC_ID_DTS = 0x15004,
35
+ FFM_CODEC_ID_FLAC = 0x1500e,
36
+ FFM_CODEC_ID_MLP = 0x1501f,
37
+ FFM_CODEC_ID_EAC3 = 0x1502b,
38
+ FFM_CODEC_ID_TRUEHD = 0x1502f,
39
+ FFM_CODEC_ID_MAX_VALUE
40
+} FFM_CodecID;
41
+
42
+#define FFM_INPUT_BUFFER_PADDING_SIZE 16
43
+
44
+typedef enum _FFM_AudioFormat {
45
+ FFM_AUDIO_FMT_UNKNOWN,
46
+ FFM_AUDIO_FMT_PCM_U8,
47
+ FFM_AUDIO_FMT_PCM_S16,
48
+ FFM_AUDIO_FMT_PCM_S32,
49
+ FFM_AUDIO_FMT_PCM_FLT,
50
+ FFM_AUDIO_FMT_PCM_DBL,
51
+ FFM_AUDIO_FMT_PCM_U8P,
52
+ FFM_AUDIO_FMT_PCM_S16P,
53
+ FFM_AUDIO_FMT_PCM_S32P,
54
+ FFM_AUDIO_FMT_PCM_FLTP,
55
+ FFM_AUDIO_FMT_PCM_DBLP,
56
+ FFM_AUDIO_FMT_PCM_S24,
57
+ FFM_AUDIO_FMT_MAX_VALUE
58
+} FFM_AudioFormat;
59
+
60
+#ifdef _MSC_VER
61
+#define ALIGN_PACKED
62
+#pragma pack(1)
63
+#endif
64
+
65
+#ifdef __GNUC__
66
+#define ALIGN_PACKED __attribute((packed))
67
+#endif
68
+
69
+typedef struct _FFM_AudioInfo {
70
+ uint32_t sample_rate;
71
+ uint32_t channels;
72
+ uint32_t bits_per_sample;
73
+ uint32_t frame_size;
74
+ uint64_t channel_layout;
75
+} ALIGN_PACKED FFM_AudioInfo;
76
+
77
+
78
+#ifdef _MSC_VER
79
+#pragma pack()
80
+#endif
81
+
82
+struct _FFM_AudioDecodeContext;
83
+typedef struct _FFM_AudioDecodeContext FFM_AudioDecodeContext;
84
+
85
+struct _FFM_AudioEncodeContext;
86
+typedef struct _FFM_AudioEncodeContext FFM_AudioEncodeContext;
87
+
88
+struct _FFM_AudioConvert;
89
+typedef struct _FFM_AudioConvert FFM_AudioConvert;
90
+
91
+typedef void (__cdecl *ffm_log_callback_t)(void* ctx,void* ctx2,int level,char* text);
92
+typedef void* (__cdecl *ffm_memalign_t)(uintptr_t align, uintptr_t size);
93
+typedef void* (__cdecl *ffm_realloc_t)(void *ptr, uintptr_t size);
94
+typedef void (__cdecl *ffm_free_t)(void *ptr);
95
+
96
+#ifdef __cplusplus
97
+extern "C" {
98
+#endif
99
+
100
+int __cdecl ffm_init(ffm_log_callback_t log_proc,void* log_context,ffm_memalign_t memalign_proc,ffm_realloc_t realloc_proc,ffm_free_t free_proc);
101
+uint32_t __cdecl ffm_avcodec_version(void);
102
+
103
+FFM_AudioDecodeContext* __cdecl ffm_audio_decode_init(void* logctx,FFM_CodecID id,FFM_AudioFormat fmt,const char* argp[],const uint8_t* CodecData,unsigned int CodecDataSize,unsigned int time_base);
104
+int __cdecl ffm_audio_decode_close(FFM_AudioDecodeContext* ctx);
105
+int __cdecl ffm_audio_decode_put_data(FFM_AudioDecodeContext* ctx,const uint8_t* data,unsigned int size,int64_t pts);
106
+unsigned int __cdecl ffm_audio_decode_get_frame(FFM_AudioDecodeContext* ctx,int64_t* pts,const uint8_t* data[]);
107
+int __cdecl ffm_audio_decode_get_info(FFM_AudioDecodeContext* ctx,FFM_AudioInfo* info);
108
+
109
+FFM_AudioEncodeContext* __cdecl ffm_audio_encode_init(void* logctx,FFM_CodecID id,FFM_AudioFormat fmt,FFM_AudioInfo* info,const char* argp[],unsigned int time_base);
110
+int __cdecl ffm_audio_encode_close(FFM_AudioEncodeContext* ctx);
111
+int __cdecl ffm_audio_encode_put_frame(FFM_AudioEncodeContext* ctx,const uint8_t* frame_data[],unsigned int frame_size,unsigned int nb_samples,uint64_t pts);
112
+const uint8_t* __cdecl ffm_audio_encode_get_data(FFM_AudioEncodeContext* ctx,unsigned int *size,int64_t *pts);
113
+const uint8_t* __cdecl ffm_audio_encode_get_info(FFM_AudioEncodeContext* ctx,unsigned int *size);
114
+
115
+int __cdecl ffm_audio_check_codec_format(FFM_CodecID id,FFM_AudioFormat fmt,int encode);
116
+
117
+FFM_AudioConvert* __cdecl ffm_audio_convert_alloc(FFM_AudioFormat out_fmt,FFM_AudioFormat in_fmt,int channels);
118
+void __cdecl ffm_audio_convert_free(FFM_AudioConvert **ac);
119
+void __cdecl ffm_audio_convert(FFM_AudioConvert *ac, uint8_t *data_out[], const uint8_t* data_in[], int nb_samples);
120
+
121
+int __cdecl ffm_mlp_read_syncframe(const uint8_t* data,unsigned int size,FFM_AudioInfo* info,uint32_t* bitrate);
122
+uint16_t __cdecl ffm_mlp_checksum16(const uint8_t *buf, unsigned int buf_size);
123
+
124
+int __cdecl ffm_mpa_decode_header(uint32_t hdr,FFM_AudioInfo* info,uint32_t* layer,uint32_t* frame_size,uint32_t* bitrate);
125
+
126
+#ifdef __cplusplus
127
+};
128
+#endif
129
+
130
+#endif // LGPL_FFABI_H_INCLUDED
131
+
132
makemkv-oss-1.8.6.tar.gz/libffabi/src
Added
2
1
+(directory)
2
makemkv-oss-1.8.6.tar.gz/libffabi/src/audio_convert.c
Added
537
1
2
+/*
3
+ * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
4
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
5
+ *
6
+ * This file is part of Libav.
7
+ *
8
+ * Libav is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * Libav is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with Libav; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
+ */
22
+
23
+#include <stdint.h>
24
+#include <lgpl/ffabi.h>
25
+
26
+//#include "config.h"
27
+#include <libavutil/common.h>
28
+//#include "libavutil/libm.h"
29
+//#include "libavutil/log.h"
30
+//#include "libavutil/mem.h"
31
+//#include <libavutil/samplefmt.h>
32
+//#include "audio_convert.h"
33
+//#include "audio_data.h"
34
+//#include "dither.h"
35
+#include "internal.h"
36
+
37
+
38
+enum ConvFuncType {
39
+ CONV_FUNC_TYPE_FLAT,
40
+ CONV_FUNC_TYPE_INTERLEAVE,
41
+ CONV_FUNC_TYPE_DEINTERLEAVE,
42
+};
43
+
44
+typedef void (conv_func_flat)(uint8_t *out, const uint8_t *in, int len);
45
+
46
+typedef void (conv_func_interleave)(uint8_t *out, const uint8_t *const *in,
47
+ int len, int channels);
48
+
49
+typedef void (conv_func_deinterleave)(uint8_t **out, const uint8_t *in, int len,
50
+ int channels);
51
+
52
+struct _FFM_AudioConvert {
53
+ //AVAudioResampleContext *avr;
54
+ //DitherContext *dc;
55
+ enum AVSampleFormat in_fmt;
56
+ enum AVSampleFormat out_fmt;
57
+ //int apply_map;
58
+ int channels;
59
+ int planes;
60
+ int in_planar;
61
+ //int ptr_align;
62
+ //int samples_align;
63
+ //int has_optimized_func;
64
+ //const char *func_descr;
65
+ //const char *func_descr_generic;
66
+ enum ConvFuncType func_type;
67
+ conv_func_flat *conv_flat;
68
+ //conv_func_flat *conv_flat_generic;
69
+ conv_func_interleave *conv_interleave;
70
+ //conv_func_interleave *conv_interleave_generic;
71
+ conv_func_deinterleave *conv_deinterleave;
72
+ //conv_func_deinterleave *conv_deinterleave_generic;
73
+};
74
+
75
+static inline enum AVSampleFormat ac_get_packed_sample_fmt(enum AVSampleFormat fmt)
76
+{
77
+ if (fmt == AV_SAMPLE_FMT_S24) return AV_SAMPLE_FMT_S24;
78
+
79
+#if (LIBAVCODEC_VERSION_MAJOR == 53)
80
+ if ( (fmt>=AV_SAMPLE_FMT_U8P) && (fmt<=AV_SAMPLE_FMT_DBLP) ) {
81
+ return (fmt-5);
82
+ }
83
+ return fmt;
84
+#else
85
+ return av_get_packed_sample_fmt(fmt);
86
+#endif
87
+}
88
+
89
+static void ff_audio_convert_set_func(FFM_AudioConvert *ac, enum AVSampleFormat out_fmt,
90
+ enum AVSampleFormat in_fmt, int channels,
91
+ int ptr_align, int samples_align,
92
+ const char *descr, void *conv)
93
+{
94
+ //int found = 0;
95
+
96
+ switch (ac->func_type) {
97
+ case CONV_FUNC_TYPE_FLAT:
98
+ if (ac_get_packed_sample_fmt(ac->in_fmt) == in_fmt &&
99
+ ac_get_packed_sample_fmt(ac->out_fmt) == out_fmt) {
100
+ ac->conv_flat = conv;
101
+ /*ac->func_descr = descr;
102
+ ac->ptr_align = ptr_align;
103
+ ac->samples_align = samples_align;
104
+ if (ptr_align == 1 && samples_align == 1) {
105
+ ac->conv_flat_generic = conv;
106
+ ac->func_descr_generic = descr;
107
+ } else {
108
+ ac->has_optimized_func = 1;
109
+ }
110
+ found = 1;*/
111
+ }
112
+ break;
113
+ case CONV_FUNC_TYPE_INTERLEAVE:
114
+ if (ac->in_fmt == in_fmt && ac->out_fmt == out_fmt &&
115
+ (!channels || ac->channels == channels)) {
116
+ ac->conv_interleave = conv;
117
+ /*ac->func_descr = descr;
118
+ ac->ptr_align = ptr_align;
119
+ ac->samples_align = samples_align;
120
+ if (ptr_align == 1 && samples_align == 1) {
121
+ ac->conv_interleave_generic = conv;
122
+ ac->func_descr_generic = descr;
123
+ } else {
124
+ ac->has_optimized_func = 1;
125
+ }
126
+ found = 1;*/
127
+ }
128
+ break;
129
+ case CONV_FUNC_TYPE_DEINTERLEAVE:
130
+ if (ac->in_fmt == in_fmt && ac->out_fmt == out_fmt &&
131
+ (!channels || ac->channels == channels)) {
132
+ ac->conv_deinterleave = conv;
133
+ /*ac->func_descr = descr;
134
+ ac->ptr_align = ptr_align;
135
+ ac->samples_align = samples_align;
136
+ if (ptr_align == 1 && samples_align == 1) {
137
+ ac->conv_deinterleave_generic = conv;
138
+ ac->func_descr_generic = descr;
139
+ } else {
140
+ ac->has_optimized_func = 1;
141
+ }
142
+ found = 1;*/
143
+ }
144
+ break;
145
+ }
146
+ /*if (found) {
147
+ av_log(ac->avr, AV_LOG_DEBUG, "audio_convert: found function: %-4s "
148
+ "to %-4s (%s)\n", av_get_sample_fmt_name(ac->in_fmt),
149
+ av_get_sample_fmt_name(ac->out_fmt), descr);
150
+ }*/
151
+}
152
+
153
+// *(otype *)po = expr;
154
+
155
+
156
+#define ac_sizeof(type) AC_SIZE_OF_##type
157
+
158
+#define AC_SIZE_OF_uint8_t 1
159
+#define AC_SIZE_OF_int16_t 2
160
+#define AC_SIZE_OF_act24_t 3
161
+#define AC_SIZE_OF_int32_t 4
162
+#define AC_SIZE_OF_float sizeof(float)
163
+#define AC_SIZE_OF_double sizeof(double)
164
+
165
+static av_always_inline void ac_put_uint8_t(uint8_t* dst,uint8_t value)
166
+{
167
+ *dst = value;
168
+}
169
+
170
+static av_always_inline void ac_put_int16_t(uint8_t* dst,int16_t value)
171
+{
172
+ *(int16_t*)dst = value;
173
+}
174
+
175
+static av_always_inline void ac_put_int32_t(uint8_t* dst,int32_t value)
176
+{
177
+ *(int32_t*)dst = value;
178
+}
179
+
180
+static av_always_inline void ac_put_float(uint8_t* dst,float value)
181
+{
182
+ *(float*)dst = value;
183
+}
184
+
185
+static av_always_inline void ac_put_double(uint8_t* dst,double value)
186
+{
187
+ *(double*)dst = value;
188
+}
189
+
190
+static av_always_inline void ac_put_act24_t(uint8_t* dst,int32_t value)
191
+{
192
+ dst[0] = (uint32_t)(value>>8);
193
+ dst[1] = (uint32_t)(value>>16);
194
+ dst[2] = (uint32_t)(value>>24);
195
+}
196
+
197
+static av_always_inline int32_t ac_get_act24(const uint8_t* src)
198
+{
199
+ int32_t value;
200
+
201
+ value = ((int32_t)(src[0])) << 8;
202
+ value |= ((int32_t)(src[1])) << 16;
203
+ value |= ((int32_t)(src[2])) << 24;
204
+
205
+ return value;
206
+}
207
+
208
+#define CONV_FUNC_NAME(dst_fmt, src_fmt) conv_ ## src_fmt ## _to_ ## dst_fmt
209
+
210
+#define CONV_LOOP(otype, expr) \
211
+ do { \
212
+ ac_put_##otype (po,(expr)); \
213
+ pi += is; \
214
+ po += os; \
215
+ } while (po < end); \
216
+
217
+#define CONV_FUNC_FLAT(ofmt, otype, ifmt, itype, expr) \
218
+static void CONV_FUNC_NAME(ofmt, ifmt)(uint8_t *out, const uint8_t *in, \
219
+ int len) \
220
+{ \
221
+ int is = ac_sizeof(itype); \
222
+ int os = ac_sizeof(otype); \
223
+ const uint8_t *pi = in; \
224
+ uint8_t *po = out; \
225
+ uint8_t *end = out + os * len; \
226
+ CONV_LOOP(otype, expr) \
227
+}
228
+
229
+#define CONV_FUNC_INTERLEAVE(ofmt, otype, ifmt, itype, expr) \
230
+static void CONV_FUNC_NAME(ofmt, ifmt)(uint8_t *out, const uint8_t **in, \
231
+ int len, int channels) \
232
+{ \
233
+ int ch; \
234
+ int out_bps = ac_sizeof(otype); \
235
+ int is = ac_sizeof(itype); \
236
+ int os = channels * out_bps; \
237
+ for (ch = 0; ch < channels; ch++) { \
238
+ const uint8_t *pi = in[ch]; \
239
+ uint8_t *po = out + ch * out_bps; \
240
+ uint8_t *end = po + os * len; \
241
+ CONV_LOOP(otype, expr) \
242
+ } \
243
+}
244
+
245
+#define CONV_FUNC_DEINTERLEAVE(ofmt, otype, ifmt, itype, expr) \
246
+static void CONV_FUNC_NAME(ofmt, ifmt)(uint8_t **out, const uint8_t *in, \
247
+ int len, int channels) \
248
+{ \
249
+ int ch; \
250
+ int in_bps = ac_sizeof(itype); \
251
+ int is = channels * in_bps; \
252
+ int os = ac_sizeof(otype); \
253
+ for (ch = 0; ch < channels; ch++) { \
254
+ const uint8_t *pi = in + ch * in_bps; \
255
+ uint8_t *po = out[ch]; \
256
+ uint8_t *end = po + os * len; \
257
+ CONV_LOOP(otype, expr) \
258
+ } \
259
+}
260
+
261
+#define CONV_FUNC_GROUP_ALL(ofmt, otype, ifmt, itype, expr) \
262
+CONV_FUNC_FLAT( ofmt, otype, ifmt, itype, expr) \
263
+CONV_FUNC_INTERLEAVE( ofmt, otype, ifmt ## P, itype, expr) \
264
+CONV_FUNC_DEINTERLEAVE(ofmt ## P, otype, ifmt, itype, expr)
265
+
266
+#define CONV_FUNC_GROUP_ID(ofmt, otype, ifmt, itype, expr) \
267
+CONV_FUNC_INTERLEAVE( ofmt, otype, ifmt ## P, itype, expr) \
268
+CONV_FUNC_DEINTERLEAVE(ofmt ## P, otype, ifmt, itype, expr)
269
+
270
+#define CONV_FUNC_GROUP_FI(ofmt, otype, ifmt, itype, expr) \
271
+CONV_FUNC_FLAT( ofmt, otype, ifmt, itype, expr) \
272
+CONV_FUNC_INTERLEAVE( ofmt, otype, ifmt ## P, itype, expr) \
273
+
274
+#define CONV_FUNC_GROUP_FD(ofmt, otype, ifmt, itype, expr) \
275
+CONV_FUNC_FLAT( ofmt, otype, ifmt, itype, expr) \
276
+CONV_FUNC_DEINTERLEAVE(ofmt ## P, otype, ifmt, itype, expr)
277
+
278
+CONV_FUNC_GROUP_ID (AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_U8, uint8_t, *(const uint8_t *)pi)
279
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_U8, uint8_t, (*(const uint8_t *)pi - 0x80) << 8)
280
+CONV_FUNC_GROUP_FI (AV_SAMPLE_FMT_S24, act24_t, AV_SAMPLE_FMT_U8, uint8_t, (*(const uint8_t *)pi - 0x80) << 24)
281
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_U8, uint8_t, (*(const uint8_t *)pi - 0x80) << 24)
282
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t, (*(const uint8_t *)pi - 0x80) * (1.0f / (1 << 7)))
283
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t, (*(const uint8_t *)pi - 0x80) * (1.0 / (1 << 7)))
284
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t, (*(const int16_t *)pi >> 8) + 0x80)
285
+CONV_FUNC_GROUP_ID (AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *)pi)
286
+CONV_FUNC_GROUP_FI (AV_SAMPLE_FMT_S24, act24_t, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *)pi << 16)
287
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *)pi << 16)
288
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *)pi * (1.0f / (1 << 15)))
289
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *)pi * (1.0 / (1 << 15)))
290
+CONV_FUNC_GROUP_FD (AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S24, act24_t, (ac_get_act24(pi) >> 24) + 0x80)
291
+CONV_FUNC_GROUP_FD (AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_S24, act24_t, ac_get_act24(pi) >> 16)
292
+CONV_FUNC_GROUP_FD (AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S24, act24_t, ac_get_act24(pi))
293
+CONV_FUNC_GROUP_FD (AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S24, act24_t, ac_get_act24(pi) * (1.0f / (1U << 31)))
294
+CONV_FUNC_GROUP_FD (AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S24, act24_t, ac_get_act24(pi) * (1.0 / (1U << 31)))
295
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t, (*(const int32_t *)pi >> 24) + 0x80)
296
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *)pi >> 16)
297
+CONV_FUNC_GROUP_FI (AV_SAMPLE_FMT_S24, act24_t, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *)pi)
298
+CONV_FUNC_GROUP_ID (AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *)pi)
299
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *)pi * (1.0f / (1U << 31)))
300
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *)pi * (1.0 / (1U << 31)))
301
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8( lrintf(*(const float *)pi * (1 << 7)) + 0x80))
302
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16( lrintf(*(const float *)pi * (1 << 15))))
303
+CONV_FUNC_GROUP_FI (AV_SAMPLE_FMT_S24, act24_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *)pi * (1U << 31))))
304
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *)pi * (1U << 31))))
305
+CONV_FUNC_GROUP_ID (AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_FLT, float, *(const float *)pi)
306
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_FLT, float, *(const float *)pi)
307
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8( lrint(*(const double *)pi * (1 << 7)) + 0x80))
308
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16( lrint(*(const double *)pi * (1 << 15))))
309
+CONV_FUNC_GROUP_FI (AV_SAMPLE_FMT_S24, act24_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *)pi * (1U << 31))))
310
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *)pi * (1U << 31))))
311
+CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_DBL, double, *(const double *)pi)
312
+CONV_FUNC_GROUP_ID (AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_DBL, double, *(const double *)pi)
313
+
314
+#define SET_CONV_FUNC_GROUP_ALL(ofmt, ifmt) \
315
+ff_audio_convert_set_func(ac, ofmt, ifmt, 0, 1, 1, "C", CONV_FUNC_NAME(ofmt, ifmt)); \
316
+ff_audio_convert_set_func(ac, ofmt ## P, ifmt, 0, 1, 1, "C", CONV_FUNC_NAME(ofmt ## P, ifmt)); \
317
+ff_audio_convert_set_func(ac, ofmt, ifmt ## P, 0, 1, 1, "C", CONV_FUNC_NAME(ofmt, ifmt ## P));
318
+
319
+#define SET_CONV_FUNC_GROUP_ID(ofmt, ifmt) \
320
+ff_audio_convert_set_func(ac, ofmt ## P, ifmt, 0, 1, 1, "C", CONV_FUNC_NAME(ofmt ## P, ifmt)); \
321
+ff_audio_convert_set_func(ac, ofmt, ifmt ## P, 0, 1, 1, "C", CONV_FUNC_NAME(ofmt, ifmt ## P));
322
+
323
+#define SET_CONV_FUNC_GROUP_FI(ofmt, ifmt) \
324
+ff_audio_convert_set_func(ac, ofmt, ifmt, 0, 1, 1, "C", CONV_FUNC_NAME(ofmt, ifmt)); \
325
+ff_audio_convert_set_func(ac, ofmt, ifmt ## P, 0, 1, 1, "C", CONV_FUNC_NAME(ofmt, ifmt ## P));
326
+
327
+#define SET_CONV_FUNC_GROUP_FD(ofmt, ifmt) \
328
+ff_audio_convert_set_func(ac, ofmt, ifmt, 0, 1, 1, "C", CONV_FUNC_NAME(ofmt, ifmt)); \
329
+ff_audio_convert_set_func(ac, ofmt ## P, ifmt, 0, 1, 1, "C", CONV_FUNC_NAME(ofmt ## P, ifmt));
330
+
331
+static void set_generic_function(FFM_AudioConvert *ac)
332
+{
333
+ SET_CONV_FUNC_GROUP_ID (AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8)
334
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8)
335
+ SET_CONV_FUNC_GROUP_FI (AV_SAMPLE_FMT_S24, AV_SAMPLE_FMT_U8)
336
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8)
337
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8)
338
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8)
339
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16)
340
+ SET_CONV_FUNC_GROUP_ID (AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16)
341
+ SET_CONV_FUNC_GROUP_FI (AV_SAMPLE_FMT_S24, AV_SAMPLE_FMT_S16)
342
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16)
343
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16)
344
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16)
345
+ SET_CONV_FUNC_GROUP_FD (AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S24)
346
+ SET_CONV_FUNC_GROUP_FD (AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S24)
347
+ SET_CONV_FUNC_GROUP_FD (AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S24)
348
+ SET_CONV_FUNC_GROUP_FD (AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S24)
349
+ SET_CONV_FUNC_GROUP_FD (AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S24)
350
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32)
351
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32)
352
+ SET_CONV_FUNC_GROUP_FI (AV_SAMPLE_FMT_S24, AV_SAMPLE_FMT_S32)
353
+ SET_CONV_FUNC_GROUP_ID (AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32)
354
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32)
355
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32)
356
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT)
357
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT)
358
+ SET_CONV_FUNC_GROUP_FI (AV_SAMPLE_FMT_S24, AV_SAMPLE_FMT_FLT)
359
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT)
360
+ SET_CONV_FUNC_GROUP_ID (AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT)
361
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT)
362
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL)
363
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL)
364
+ SET_CONV_FUNC_GROUP_FI (AV_SAMPLE_FMT_S24, AV_SAMPLE_FMT_DBL)
365
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL)
366
+ SET_CONV_FUNC_GROUP_ALL(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL)
367
+ SET_CONV_FUNC_GROUP_ID (AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL)
368
+}
369
+
370
+void ffm_audio_convert_free(FFM_AudioConvert **ac)
371
+{
372
+ if (!*ac)
373
+ return;
374
+ //ff_dither_free(&(*ac)->dc);
375
+ av_freep(ac);
376
+}
377
+
378
+FFM_AudioConvert *ff_ffm_audio_convert_alloc(//AVAudioResampleContext *avr,
379
+ enum AVSampleFormat out_fmt,
380
+ enum AVSampleFormat in_fmt,
381
+ int channels)//, int sample_rate,
382
+ //int apply_map)
383
+{
384
+ FFM_AudioConvert *ac;
385
+ int in_planar, out_planar;
386
+
387
+ ac = av_mallocz(sizeof(*ac));
388
+ if (!ac)
389
+ return NULL;
390
+
391
+ //ac->avr = avr;
392
+ ac->out_fmt = out_fmt;
393
+ ac->in_fmt = in_fmt;
394
+ ac->channels = channels;
395
+ //ac->apply_map = apply_map;
396
+
397
+ /*if (avr->dither_method != AV_RESAMPLE_DITHER_NONE &&
398
+ av_get_packed_sample_fmt(out_fmt) == AV_SAMPLE_FMT_S16 &&
399
+ av_get_bytes_per_sample(in_fmt) > 2) {
400
+ ac->dc = ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate,
401
+ apply_map);
402
+ if (!ac->dc) {
403
+ av_free(ac);
404
+ return NULL;
405
+ }
406
+ return ac;
407
+ }*/
408
+
409
+ in_planar = av_sample_fmt_is_planar(in_fmt);
410
+ ac->in_planar = in_planar;
411
+ out_planar = av_sample_fmt_is_planar(out_fmt);
412
+
413
+ if (in_planar == out_planar) {
414
+ ac->func_type = CONV_FUNC_TYPE_FLAT;
415
+ ac->planes = in_planar ? ac->channels : 1;
416
+ } else if (in_planar)
417
+ ac->func_type = CONV_FUNC_TYPE_INTERLEAVE;
418
+ else
419
+ ac->func_type = CONV_FUNC_TYPE_DEINTERLEAVE;
420
+
421
+ set_generic_function(ac);
422
+
423
+ /*if (ARCH_ARM)
424
+ ff_audio_convert_init_arm(ac);
425
+ if (ARCH_X86)
426
+ ff_audio_convert_init_x86(ac);*/
427
+
428
+ return ac;
429
+}
430
+
431
+void ffm_audio_convert(FFM_AudioConvert *ac, uint8_t *out_data[], const uint8_t* in_data[], int nb_samples)
432
+{
433
+ //int use_generic = 1;
434
+ int len = nb_samples;
435
+ int p;
436
+
437
+#if 0
438
+ if (ac->dc) {
439
+ /* dithered conversion */
440
+ av_dlog(ac->avr, "%d samples - audio_convert: %s to %s (dithered)\n",
441
+ len, av_get_sample_fmt_name(ac->in_fmt),
442
+ av_get_sample_fmt_name(ac->out_fmt));
443
+
444
+ return ff_convert_dither(ac->dc, out, in);
445
+ }
446
+
447
+ /* determine whether to use the optimized function based on pointer and
448
+ samples alignment in both the input and output */
449
+ if (ac->has_optimized_func) {
450
+ int ptr_align = FFMIN(in->ptr_align, out->ptr_align);
451
+ int samples_align = FFMIN(in->samples_align, out->samples_align);
452
+ int aligned_len = FFALIGN(len, ac->samples_align);
453
+ if (!(ptr_align % ac->ptr_align) && samples_align >= aligned_len) {
454
+ len = aligned_len;
455
+ use_generic = 0;
456
+ }
457
+ }
458
+ av_dlog(ac->avr, "%d samples - audio_convert: %s to %s (%s)\n", len,
459
+ av_get_sample_fmt_name(ac->in_fmt),
460
+ av_get_sample_fmt_name(ac->out_fmt),
461
+ use_generic ? ac->func_descr_generic : ac->func_descr);
462
+
463
+ if (ac->apply_map) {
464
+ ChannelMapInfo *map = &ac->avr->ch_map_info;
465
+
466
+ if (!av_sample_fmt_is_planar(ac->out_fmt)) {
467
+ av_log(ac->avr, AV_LOG_ERROR, "cannot remap packed format during conversion\n");
468
+ return AVERROR(EINVAL);
469
+ }
470
+
471
+ if (map->do_remap) {
472
+ if (av_sample_fmt_is_planar(ac->in_fmt)) {
473
+ conv_func_flat *convert = use_generic ? ac->conv_flat_generic :
474
+ ac->conv_flat;
475
+
476
+ for (p = 0; p < ac->planes; p++)
477
+ if (map->channel_map[p] >= 0)
478
+ convert(out->data[p], in->data[map->channel_map[p]], len);
479
+ } else {
480
+ uint8_t *data[AVRESAMPLE_MAX_CHANNELS];
481
+ conv_func_deinterleave *convert = use_generic ?
482
+ ac->conv_deinterleave_generic :
483
+ ac->conv_deinterleave;
484
+
485
+ for (p = 0; p < ac->channels; p++)
486
+ data[map->input_map[p]] = out->data[p];
487
+
488
+ convert(data, in->data[0], len, ac->channels);
489
+ }
490
+ }
491
+ if (map->do_copy || map->do_zero) {
492
+ for (p = 0; p < ac->planes; p++) {
493
+ if (map->channel_copy[p])
494
+ memcpy(out->data[p], out->data[map->channel_copy[p]],
495
+ len * out->stride);
496
+ else if (map->channel_zero[p])
497
+ av_samples_set_silence(&out->data[p], 0, len, 1, ac->out_fmt);
498
+ }
499
+ }
500
+ } else {
501
+#endif
502
+ {
503
+ switch (ac->func_type) {
504
+ case CONV_FUNC_TYPE_FLAT: {
505
+ if (!ac->in_planar)
506
+ len *= ac->channels;
507
+ /*if (use_generic) {
508
+ for (p = 0; p < ac->planes; p++)
509
+ ac->conv_flat_generic(out->data[p], in->data[p], len);
510
+ } else*/ {
511
+ for (p = 0; p < ac->planes; p++)
512
+ ac->conv_flat(out_data[p], in_data[p], len);
513
+ }
514
+ break;
515
+ }
516
+ case CONV_FUNC_TYPE_INTERLEAVE:
517
+ /*if (use_generic)
518
+ ac->conv_interleave_generic(out->data[0], in->data, len,
519
+ ac->channels);
520
+ else*/
521
+ ac->conv_interleave(out_data[0], in_data, len, ac->channels);
522
+ break;
523
+ case CONV_FUNC_TYPE_DEINTERLEAVE:
524
+ /*if (use_generic)
525
+ ac->conv_deinterleave_generic(out->data, in->data[0], len,
526
+ ac->channels);
527
+ else*/
528
+ ac->conv_deinterleave(out_data, in_data[0], len,
529
+ ac->channels);
530
+ break;
531
+ }
532
+ }
533
+
534
+ //out->nb_samples = in->nb_samples;
535
+ //return 0;
536
+}
537
makemkv-oss-1.8.6.tar.gz/libffabi/src/ffabi.c
Added
567
1
2
+/*
3
+ libMakeMKV - MKV multiplexer library
4
+
5
+ Copyright (C) 2007-2013 GuinpinSoft inc <libmkv@makemkv.com>
6
+
7
+ This library is free software; you can redistribute it and/or
8
+ modify it under the terms of the GNU Lesser General Public
9
+ License as published by the Free Software Foundation; either
10
+ version 2.1 of the License, or (at your option) any later version.
11
+
12
+ This library is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ Lesser General Public License for more details.
16
+
17
+ You should have received a copy of the GNU Lesser General Public
18
+ License along with this library; if not, write to the Free Software
19
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
+
21
+*/
22
+#include <lgpl/ffabi.h>
23
+#include <libavcodec/avcodec.h>
24
+#include "mpegaudiodecheader.h"
25
+#include <libavutil/samplefmt.h>
26
+#include <libavutil/opt.h>
27
+#include <string.h>
28
+#include "internal.h"
29
+
30
+static int log_print_prefix = 1;
31
+static void* log_context = NULL;
32
+static ffm_log_callback_t log_callback = NULL;
33
+static ffm_memalign_t proc_memalign = NULL;
34
+static ffm_realloc_t proc_realloc = NULL;
35
+static ffm_free_t proc_free = NULL;
36
+
37
+void *ffabi_memalign(size_t align, size_t size)
38
+{
39
+ return (*proc_memalign)(align,size);
40
+}
41
+
42
+void *ffabi_realloc(void *ptr, size_t size)
43
+{
44
+ return (*proc_realloc)(ptr,size);
45
+}
46
+
47
+void ffabi_free(void *ptr)
48
+{
49
+ (*proc_free)(ptr);
50
+}
51
+
52
+static void static_log_callback(void* ptr, int level, const char* fmt, va_list vl)
53
+{
54
+ char line[1024];
55
+ void* ctx2 = NULL;
56
+
57
+ av_log_format_line(ptr, level, fmt, vl, line, sizeof(line), &log_print_prefix);
58
+
59
+ line[sizeof(line)-1]=0;
60
+
61
+ if (ptr) {
62
+ struct AVClass* pclass = *((struct AVClass**)ptr);
63
+ if (pclass) {
64
+ if (!strcmp(pclass->class_name,"AVCodecContext")) {
65
+ ctx2 = ((AVCodecContext*)ptr)->opaque;
66
+ }
67
+ }
68
+ }
69
+
70
+ if (log_callback) {
71
+ (*log_callback)(log_context,ctx2,level,line);
72
+ }
73
+}
74
+
75
+int __cdecl ffm_init(ffm_log_callback_t log_proc,void* log_ctx,ffm_memalign_t memalign_proc,ffm_realloc_t realloc_proc,ffm_free_t free_proc)
76
+{
77
+ log_context = log_ctx;
78
+ log_callback = log_proc;
79
+ proc_memalign = memalign_proc;
80
+ proc_realloc = realloc_proc;
81
+ proc_free = free_proc;
82
+
83
+ av_log_set_callback(static_log_callback);
84
+ avcodec_register_all();
85
+
86
+ ffabi_ff_mlp_init_crc();
87
+
88
+ return 0;
89
+}
90
+
91
+uint32_t __cdecl ffm_avcodec_version(void)
92
+{
93
+ return avcodec_version();
94
+}
95
+
96
+static enum AVCodecID translate_codec_id(FFM_CodecID id)
97
+{
98
+ enum AVCodecID r;
99
+
100
+ switch(id) {
101
+ case FFM_CODEC_ID_AC3 : r = AV_CODEC_ID_AC3; break;
102
+ case FFM_CODEC_ID_DTS : r = AV_CODEC_ID_DTS; break;
103
+ case FFM_CODEC_ID_FLAC : r = AV_CODEC_ID_FLAC; break;
104
+ case FFM_CODEC_ID_MLP : r = AV_CODEC_ID_MLP; break;
105
+ case FFM_CODEC_ID_TRUEHD : r = AV_CODEC_ID_TRUEHD; break;
106
+ default : r=AV_CODEC_ID_NONE; break;
107
+ }
108
+ return r;
109
+}
110
+
111
+static enum AVSampleFormat translate_sample_fmt(FFM_AudioFormat fmt)
112
+{
113
+ enum AVSampleFormat r;
114
+
115
+ switch(fmt) {
116
+ case FFM_AUDIO_FMT_PCM_U8 : r = AV_SAMPLE_FMT_U8; break;
117
+ case FFM_AUDIO_FMT_PCM_S16: r = AV_SAMPLE_FMT_S16; break;
118
+ case FFM_AUDIO_FMT_PCM_S24: r = AV_SAMPLE_FMT_S24; break;
119
+ case FFM_AUDIO_FMT_PCM_S32: r = AV_SAMPLE_FMT_S32; break;
120
+ case FFM_AUDIO_FMT_PCM_FLT: r = AV_SAMPLE_FMT_FLT; break;
121
+ case FFM_AUDIO_FMT_PCM_DBL: r = AV_SAMPLE_FMT_DBL; break;
122
+ case FFM_AUDIO_FMT_PCM_U8P : r = AV_SAMPLE_FMT_U8P; break;
123
+ case FFM_AUDIO_FMT_PCM_S16P: r = AV_SAMPLE_FMT_S16P; break;
124
+ case FFM_AUDIO_FMT_PCM_S32P: r = AV_SAMPLE_FMT_S32P; break;
125
+ case FFM_AUDIO_FMT_PCM_FLTP: r = AV_SAMPLE_FMT_FLTP; break;
126
+ case FFM_AUDIO_FMT_PCM_DBLP: r = AV_SAMPLE_FMT_DBLP; break;
127
+ default : r = AV_SAMPLE_FMT_NONE; break;
128
+ }
129
+ return r;
130
+}
131
+
132
+struct _FFM_AudioDecodeContext
133
+{
134
+ AVCodec* codec;
135
+ AVCodecContext* avctx;
136
+ AVFrame* frame;
137
+ unsigned int nb_samples;
138
+ int have_frame;
139
+};
140
+
141
+FFM_AudioDecodeContext* __cdecl ffm_audio_decode_init(void* logctx,FFM_CodecID id,FFM_AudioFormat fmt,const char* argp[],const uint8_t* CodecData,unsigned int CodecDataSize,unsigned int time_base)
142
+{
143
+ AVDictionary *opts = NULL;
144
+ FFM_AudioDecodeContext* ctx;
145
+ int i;
146
+
147
+ ctx = av_mallocz(sizeof(FFM_AudioDecodeContext));
148
+ if (!ctx) {
149
+ return NULL;
150
+ }
151
+
152
+ ctx->codec = avcodec_find_decoder(translate_codec_id(id));
153
+ if (!ctx->codec) {
154
+ ffm_audio_decode_close(ctx);
155
+ return NULL;
156
+ }
157
+
158
+ ctx->avctx = avcodec_alloc_context3(ctx->codec);
159
+ if (!ctx->avctx) {
160
+ ffm_audio_decode_close(ctx);
161
+ return NULL;
162
+ }
163
+ ctx->avctx->opaque = logctx;
164
+ ctx->avctx->time_base.num = 1;
165
+ ctx->avctx->time_base.den = time_base;
166
+#if (LIBAVCODEC_VERSION_MAJOR >= 54)
167
+ ctx->avctx->refcounted_frames = 1;
168
+#endif
169
+
170
+ if (CodecData) {
171
+ ctx->avctx->extradata = (uint8_t*) CodecData;
172
+ ctx->avctx->extradata_size = CodecDataSize;
173
+ }
174
+
175
+ ctx->avctx->request_sample_fmt = translate_sample_fmt(fmt);
176
+
177
+ if (argp) {
178
+ for (i=0;argp[i];i+=2) {
179
+ av_dict_set(&opts, argp[i], argp[i+1], 0);
180
+ }
181
+ }
182
+
183
+ if (avcodec_open2(ctx->avctx,ctx->codec,&opts)) {
184
+ av_dict_free(&opts);
185
+ ffm_audio_decode_close(ctx);
186
+ return NULL;
187
+ }
188
+ av_dict_free(&opts);
189
+
190
+ ctx->frame = avcodec_alloc_frame();
191
+ if (!ctx->frame) {
192
+ ffm_audio_decode_close(ctx);
193
+ return NULL;
194
+ }
195
+
196
+ return ctx;
197
+}
198
+
199
+int __cdecl ffm_audio_decode_close(FFM_AudioDecodeContext* ctx)
200
+{
201
+ if (ctx->frame) {
202
+ av_frame_unref(ctx->frame);
203
+ avcodec_free_frame(&ctx->frame);
204
+ }
205
+
206
+ if (ctx->avctx) {
207
+ avcodec_close(ctx->avctx);
208
+ av_free(ctx->avctx);
209
+ }
210
+
211
+ av_free(ctx);
212
+
213
+ return 0;
214
+}
215
+
216
+static void av_cold cold(void)
217
+{
218
+}
219
+
220
+int __cdecl ffm_audio_decode_put_data(FFM_AudioDecodeContext* ctx,const uint8_t* data,unsigned int size,int64_t pts)
221
+{
222
+ int r=-1;
223
+ struct AVPacket avpkt;
224
+
225
+ av_init_packet(&avpkt);
226
+ avpkt.pts = pts;
227
+ avpkt.dts = pts;
228
+ avpkt.data = (uint8_t*)data;
229
+ avpkt.size = size;
230
+
231
+ av_frame_unref(ctx->frame);
232
+ ctx->have_frame = 0;
233
+
234
+ r = avcodec_decode_audio4(ctx->avctx,ctx->frame,&ctx->have_frame,&avpkt);
235
+
236
+ if (ctx->have_frame) {
237
+#if (LIBAVCODEC_VERSION_MAJOR >= 54)
238
+ if (av_frame_get_channels(ctx->frame) != ctx->avctx->channels) { cold(); return -1; }
239
+ if (av_frame_get_sample_rate(ctx->frame) != ctx->avctx->sample_rate) { cold(); return -1; }
240
+#endif
241
+ if (ctx->frame->format != ctx->avctx->sample_fmt) { cold(); return -1; }
242
+ if (ctx->frame->format != ctx->avctx->request_sample_fmt) { cold(); return -1; }
243
+ if (ctx->nb_samples) {
244
+ if (ctx->nb_samples != ctx->frame->nb_samples) { cold(); return -1; }
245
+ } else {
246
+ cold();
247
+ ctx->nb_samples = ctx->frame->nb_samples;
248
+ }
249
+ } else {
250
+ cold();
251
+ }
252
+
253
+ return r;
254
+}
255
+
256
+unsigned int __cdecl ffm_audio_decode_get_frame(FFM_AudioDecodeContext* ctx,int64_t* pts,const uint8_t* data[])
257
+{
258
+ int i;
259
+
260
+ if (!ctx->have_frame) { cold(); return 0; }
261
+
262
+ *pts = ctx->frame->pts;
263
+
264
+ data[0]=ctx->frame->data[0];
265
+
266
+ if (av_sample_fmt_is_planar(ctx->avctx->sample_fmt)) {
267
+ for (i=1;i<ctx->avctx->channels;i++) {
268
+ data[i] = ctx->frame->data[i];
269
+ }
270
+ }
271
+
272
+ return ctx->frame->linesize[0];
273
+}
274
+
275
+int __cdecl ffm_audio_decode_get_info(FFM_AudioDecodeContext* ctx,FFM_AudioInfo* info)
276
+{
277
+ info->sample_rate = ctx->avctx->sample_rate;
278
+ info->channels = ctx->avctx->channels;
279
+ info->channel_layout = ctx->avctx->channel_layout;
280
+ info->frame_size = ctx->nb_samples;
281
+ info->bits_per_sample = ctx->avctx->bits_per_raw_sample;
282
+ return 0;
283
+}
284
+
285
+struct _FFM_AudioEncodeContext
286
+{
287
+ AVCodec* codec;
288
+ AVCodecContext* avctx;
289
+ AVFrame* frame;
290
+ AVPacket pck;
291
+ int have_packet;
292
+};
293
+
294
+
295
+FFM_AudioEncodeContext* __cdecl ffm_audio_encode_init(void* logctx,FFM_CodecID id,FFM_AudioFormat fmt,FFM_AudioInfo* info,const char* argp[],unsigned int time_base)
296
+{
297
+ AVDictionary *opts = NULL;
298
+ FFM_AudioEncodeContext* ctx;
299
+ int i;
300
+
301
+ ctx = av_mallocz(sizeof(FFM_AudioEncodeContext));
302
+ if (!ctx) {
303
+ return NULL;
304
+ }
305
+
306
+ av_init_packet(&ctx->pck);
307
+ ctx->pck.data=NULL;
308
+ ctx->pck.size=0;
309
+
310
+ ctx->codec = avcodec_find_encoder(translate_codec_id(id));
311
+ if (!ctx->codec) {
312
+ ffm_audio_encode_close(ctx);
313
+ return NULL;
314
+ }
315
+
316
+ ctx->avctx = avcodec_alloc_context3(ctx->codec);
317
+ if (!ctx->avctx) {
318
+ ffm_audio_encode_close(ctx);
319
+ return NULL;
320
+ }
321
+#if (LIBAVCODEC_VERSION_MAJOR >= 54)
322
+ ctx->avctx->refcounted_frames = 1;
323
+#endif
324
+ ctx->avctx->opaque = logctx;
325
+ ctx->avctx->time_base.num = 1;
326
+ ctx->avctx->time_base.den = time_base;
327
+
328
+ ctx->avctx->sample_fmt = translate_sample_fmt(fmt);
329
+ ctx->avctx->sample_rate = info->sample_rate;
330
+ ctx->avctx->channels = info->channels;
331
+ ctx->avctx->bits_per_raw_sample = info->bits_per_sample;
332
+ ctx->avctx->channel_layout = info->channel_layout;
333
+
334
+ if (argp) {
335
+ for (i=0;argp[i];i+=2) {
336
+ av_dict_set(&opts, argp[i], argp[i+1], 0);
337
+ }
338
+ }
339
+
340
+ if (avcodec_open2(ctx->avctx,ctx->codec,&opts)) {
341
+ av_dict_free(&opts);
342
+ ffm_audio_encode_close(ctx);
343
+ return NULL;
344
+ }
345
+ av_dict_free(&opts);
346
+
347
+ ctx->avctx->delay = 0;
348
+ info->frame_size = ctx->avctx->frame_size;
349
+
350
+ ctx->frame = avcodec_alloc_frame();
351
+ if (!ctx->frame) {
352
+ ffm_audio_encode_close(ctx);
353
+ return NULL;
354
+ }
355
+
356
+ return ctx;
357
+}
358
+
359
+int __cdecl ffm_audio_encode_close(FFM_AudioEncodeContext* ctx)
360
+{
361
+ av_free_packet(&ctx->pck);
362
+
363
+ if (ctx->frame) {
364
+ av_frame_unref(ctx->frame);
365
+ avcodec_free_frame(&ctx->frame);
366
+ }
367
+
368
+ if (ctx->avctx) {
369
+ avcodec_close(ctx->avctx);
370
+ av_free(ctx->avctx);
371
+ }
372
+
373
+ av_free(ctx);
374
+
375
+ return 0;
376
+}
377
+
378
+int __cdecl ffm_audio_encode_put_frame(FFM_AudioEncodeContext* ctx,const uint8_t* frame_data[],unsigned int frame_size,unsigned int nb_samples,uint64_t pts)
379
+{
380
+ AVFrame* frame;
381
+
382
+ av_free_packet(&ctx->pck);
383
+ av_init_packet(&ctx->pck);
384
+ ctx->pck.data=NULL;
385
+ ctx->pck.size=0;
386
+ ctx->have_packet = 0;
387
+
388
+ av_frame_unref(ctx->frame);
389
+
390
+ if (frame_data) {
391
+ frame = ctx->frame;
392
+ frame->format = ctx->avctx->sample_fmt;
393
+#if (LIBAVCODEC_VERSION_MAJOR >= 54)
394
+ av_frame_set_channels(frame,ctx->avctx->channels);
395
+ av_frame_set_channel_layout(frame,ctx->avctx->channel_layout);
396
+#endif
397
+
398
+ frame->data[0] = (uint8_t*)frame_data[0];
399
+ frame->linesize[0] = frame_size;
400
+
401
+ if (av_sample_fmt_is_planar(ctx->avctx->sample_fmt)) {
402
+ int i;
403
+ for (i=1;i<ctx->avctx->channels;i++) {
404
+ frame->data[i] = (uint8_t*)frame_data[i];
405
+ }
406
+ }
407
+
408
+ frame->nb_samples = nb_samples;
409
+ frame->pts = pts;
410
+ } else { cold();
411
+ frame = NULL;
412
+ if ((ctx->avctx->codec->capabilities&CODEC_CAP_DELAY)==0) {
413
+ return 0;
414
+ }
415
+ }
416
+
417
+ return avcodec_encode_audio2(ctx->avctx,&ctx->pck,frame,&ctx->have_packet);
418
+}
419
+
420
+const uint8_t* __cdecl ffm_audio_encode_get_data(FFM_AudioEncodeContext* ctx,unsigned int *size,int64_t *pts)
421
+{
422
+ if (!ctx->have_packet) { return NULL; };
423
+
424
+ *size = ctx->pck.size;
425
+ *pts = ctx->pck.pts;
426
+
427
+ return ctx->pck.data;
428
+}
429
+
430
+const uint8_t* __cdecl ffm_audio_encode_get_info(FFM_AudioEncodeContext* ctx,unsigned int *size)
431
+{
432
+ *size = ctx->avctx->extradata_size;
433
+ return ctx->avctx->extradata;
434
+}
435
+
436
+int __cdecl ffm_audio_check_codec_format(FFM_CodecID id,FFM_AudioFormat fmt,int encode)
437
+{
438
+ AVCodec* codec;
439
+ enum AVSampleFormat sfmt = translate_sample_fmt(fmt);
440
+ int i = 0;
441
+
442
+ if (encode) {
443
+ codec = avcodec_find_encoder(translate_codec_id(id));
444
+ } else {
445
+ codec = avcodec_find_decoder(translate_codec_id(id));
446
+ }
447
+
448
+ if (!codec) {
449
+ return -1;
450
+ }
451
+
452
+ if (!codec->sample_fmts) {
453
+ return -2;
454
+ }
455
+
456
+ while(codec->sample_fmts[i]>0) {
457
+ if (codec->sample_fmts[i++] == sfmt) return 0;
458
+ }
459
+
460
+ return -3;
461
+}
462
+
463
+FFM_AudioConvert *ffm_audio_convert_alloc(FFM_AudioFormat out_fmt,FFM_AudioFormat in_fmt,int channels)
464
+{
465
+ return ff_ffm_audio_convert_alloc(
466
+ translate_sample_fmt(out_fmt),
467
+ translate_sample_fmt(in_fmt),
468
+ channels);
469
+}
470
+
471
+int __cdecl ffm_mlp_read_syncframe(const uint8_t* data,unsigned int size,FFM_AudioInfo* info,uint32_t* bitrate)
472
+{
473
+ AVCodec* codec;
474
+ AVCodecParserContext* pctx=NULL;
475
+ AVCodecContext* avctx=NULL;
476
+ int err,outbuf_size,rest;
477
+ uint8_t *outbuf;
478
+
479
+ codec = avcodec_find_decoder(AV_CODEC_ID_MLP);
480
+ if (!codec) {
481
+ err=-1; goto ret;
482
+ }
483
+
484
+ avctx = avcodec_alloc_context3(codec);
485
+ if (!avctx) {
486
+ err=-2; goto ret;
487
+ }
488
+
489
+ pctx = av_parser_init(AV_CODEC_ID_MLP);
490
+ if (!pctx) {
491
+ err=-3; goto ret;
492
+ }
493
+
494
+ rest = size;
495
+ while(rest) {
496
+ err = av_parser_parse2(pctx,avctx,&outbuf,&outbuf_size,
497
+ data,rest,0,0,0);
498
+ if ( (err<0) || (err>rest) ) {
499
+ err=-4; goto ret;
500
+ }
501
+ rest -= err;
502
+ data += err;
503
+ }
504
+
505
+ if (outbuf_size!=size) {
506
+ err=-5; goto ret;
507
+ }
508
+
509
+ info->sample_rate = avctx->sample_rate;
510
+ info->channels = avctx->channels;
511
+ info->bits_per_sample = avctx->bits_per_raw_sample;
512
+ info->channel_layout = avctx->channel_layout;
513
+ *bitrate = avctx->bit_rate;
514
+
515
+#if (LIBAVCODEC_VERSION_MAJOR < 54)
516
+ info->frame_size = avctx->frame_size;
517
+#else
518
+ info->frame_size = pctx->duration;
519
+#endif
520
+
521
+ err = 0;
522
+
523
+ret:
524
+ if (pctx) {
525
+ av_parser_close(pctx);
526
+ }
527
+
528
+ if (avctx) {
529
+ avcodec_close(avctx);
530
+ av_free(avctx);
531
+ }
532
+ return err;
533
+}
534
+
535
+int __cdecl ffm_mpa_decode_header(uint32_t hdr,FFM_AudioInfo* info,uint32_t* layer,uint32_t* frame_size,uint32_t* bitrate)
536
+{
537
+ MPADecodeHeader s;
538
+ AVCodecContext a;
539
+ int tmp,fsize;
540
+
541
+ if (ff_mpa_check_header(hdr)) {
542
+ return -1;
543
+ }
544
+
545
+ if (avpriv_mpegaudio_decode_header(&s, hdr) != 0) {
546
+ cold();
547
+ return -1;
548
+ }
549
+
550
+ info->bits_per_sample = 0;
551
+ info->channel_layout = 0;
552
+
553
+ info->sample_rate = s.sample_rate;
554
+ info->channels = s.nb_channels;
555
+ *bitrate = s.bit_rate;
556
+ *frame_size = s.frame_size;
557
+ *layer = s.layer;
558
+
559
+ avpriv_mpa_decode_header(&a,hdr,&tmp,&tmp,&fsize,&tmp);
560
+
561
+ info->frame_size = fsize;
562
+
563
+ return 0;
564
+}
565
+
566
+
567
makemkv-oss-1.8.6.tar.gz/libffabi/src/internal.h
Added
53
1
2
+#ifndef FFABI_INTERNAL_H
3
+#define FFABI_INTERNAL_H
4
+
5
+#include <libavutil/samplefmt.h>
6
+#include <libavcodec/avcodec.h>
7
+#include <libavcodec/version.h>
8
+
9
+static const enum AVSampleFormat AV_SAMPLE_FMT_S24 = AV_SAMPLE_FMT_NB + 1;
10
+
11
+FFM_AudioConvert *ff_ffm_audio_convert_alloc(
12
+ enum AVSampleFormat out_fmt,
13
+ enum AVSampleFormat in_fmt,
14
+ int channels);
15
+
16
+void ffabi_ff_mlp_init_crc(void);
17
+
18
+void *ffabi_memalign(size_t align, size_t size);
19
+void *ffabi_realloc(void *ptr, size_t size);
20
+void ffabi_free(void *ptr);
21
+
22
+#if (LIBAVCODEC_VERSION_MAJOR < 53)
23
+#error "Can't use an ancient ffmpeg or libav"
24
+#endif
25
+
26
+#if (LIBAVCODEC_VERSION_MAJOR == 53)
27
+
28
+#define AVCodecID CodecID
29
+#define AV_CODEC_ID_NONE CODEC_ID_NONE
30
+#define AV_CODEC_ID_AC3 CODEC_ID_AC3
31
+#define AV_CODEC_ID_DTS CODEC_ID_DTS
32
+#define AV_CODEC_ID_FLAC CODEC_ID_FLAC
33
+#define AV_CODEC_ID_MLP CODEC_ID_MLP
34
+#define AV_CODEC_ID_TRUEHD CODEC_ID_TRUEHD
35
+
36
+static inline void avcodec_free_frame(AVFrame **frame)
37
+{
38
+ av_freep(frame);
39
+}
40
+
41
+static inline void av_frame_unref(AVFrame *frame)
42
+{
43
+}
44
+
45
+#if (LIBAVCODEC_VERSION_MINOR < 40)
46
+void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
47
+ char *line, int line_size, int *print_prefix);
48
+#endif
49
+
50
+#endif
51
+
52
+#endif /* FFABI_INTERNAL_H */
53
makemkv-oss-1.8.6.tar.gz/libffabi/src/log.c
Added
60
1
2
+/*
3
+ * log functions
4
+ * Copyright (c) 2003 Michel Bardiaux
5
+ *
6
+ * This file is part of FFmpeg.
7
+ *
8
+ * FFmpeg is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * FFmpeg is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with FFmpeg; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
+ */
22
+
23
+/**
24
+ * @file
25
+ * logging functions
26
+ */
27
+
28
+#include <unistd.h>
29
+#include <stdlib.h>
30
+#include <libavutil/log.h>
31
+#include <libavcodec/version.h>
32
+
33
+#if (LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR < 40)
34
+
35
+void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
36
+ char *line, int line_size, int *print_prefix)
37
+{
38
+ AVClass* avc = ptr ? *(AVClass **) ptr : NULL;
39
+ line[0] = 0;
40
+ if (*print_prefix && avc) {
41
+ if (avc->parent_log_context_offset) {
42
+ AVClass** parent = *(AVClass ***) (((uint8_t *) ptr) +
43
+ avc->parent_log_context_offset);
44
+ if (parent && *parent) {
45
+ snprintf(line, line_size, "[%s @ %p] ",
46
+ (*parent)->item_name(parent), parent);
47
+ }
48
+ }
49
+ snprintf(line + strlen(line), line_size - strlen(line), "[%s @ %p] ",
50
+ avc->item_name(ptr), ptr);
51
+ }
52
+
53
+ vsnprintf(line + strlen(line), line_size - strlen(line), fmt, vl);
54
+
55
+ *print_prefix = strlen(line) && line[strlen(line) - 1] == '\n';
56
+}
57
+
58
+#endif
59
+
60
makemkv-oss-1.8.6.tar.gz/libffabi/src/mlp.c
Added
48
1
2
+/*
3
+ * MLP codec common code
4
+ * Copyright (c) 2007-2008 Ian Caulfield
5
+ *
6
+ * This file is part of FFmpeg.
7
+ *
8
+ * FFmpeg is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * FFmpeg is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with FFmpeg; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
+ */
22
+
23
+#include <stdint.h>
24
+
25
+#include <libavutil/crc.h>
26
+#include <libavutil/intreadwrite.h>
27
+#include <lgpl/ffabi.h>
28
+#include "internal.h"
29
+
30
+#define CRC_TABLE_SIZE 1024
31
+
32
+static AVCRC crc_2D[CRC_TABLE_SIZE];
33
+
34
+av_cold void ffabi_ff_mlp_init_crc(void)
35
+{
36
+ av_crc_init(crc_2D, 0, 16, 0x002D, sizeof(crc_2D));
37
+}
38
+
39
+uint16_t ffm_mlp_checksum16(const uint8_t *buf, unsigned int buf_size)
40
+{
41
+ uint16_t crc;
42
+
43
+ crc = av_crc(crc_2D, 0, buf, buf_size - 2);
44
+ crc ^= AV_RL16(buf + buf_size - 2);
45
+ return crc;
46
+}
47
+
48
makemkv-oss-1.8.6.tar.gz/libffabi/src/mpegaudiodecheader.h
Added
78
1
2
+/*
3
+ * MPEG Audio header decoder
4
+ * Copyright (c) 2001, 2002 Fabrice Bellard
5
+ *
6
+ * This file is part of FFmpeg.
7
+ *
8
+ * FFmpeg is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * FFmpeg is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with FFmpeg; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
+ */
22
+
23
+/**
24
+ * @file
25
+ * MPEG Audio header decoder.
26
+ */
27
+
28
+#ifndef FFABI_AVCODEC_MPEGAUDIODECHEADER_H
29
+#define FFABI_AVCODEC_MPEGAUDIODECHEADER_H
30
+
31
+#include <libavcodec/avcodec.h>
32
+
33
+#define MP3_MASK 0xFFFE0CCF
34
+
35
+#define MPA_DECODE_HEADER \
36
+ int frame_size; \
37
+ int error_protection; \
38
+ int layer; \
39
+ int sample_rate; \
40
+ int sample_rate_index; /* between 0 and 8 */ \
41
+ int bit_rate; \
42
+ int nb_channels; \
43
+ int mode; \
44
+ int mode_ext; \
45
+ int lsf;
46
+
47
+typedef struct MPADecodeHeader {
48
+ MPA_DECODE_HEADER
49
+} MPADecodeHeader;
50
+
51
+/* header decoding. MUST check the header before because no
52
+ consistency check is done there. Return 1 if free format found and
53
+ that the frame size must be computed externally */
54
+int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header);
55
+
56
+/* useful helper to get mpeg audio stream infos. Return -1 if error in
57
+ header, otherwise the coded frame size in bytes */
58
+int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate);
59
+
60
+/* fast header check for resync */
61
+static inline int ff_mpa_check_header(uint32_t header){
62
+ /* header */
63
+ if ((header & 0xffe00000) != 0xffe00000)
64
+ return -1;
65
+ /* layer check */
66
+ if ((header & (3<<17)) == 0)
67
+ return -1;
68
+ /* bit rate */
69
+ if ((header & (0xf<<12)) == 0xf<<12)
70
+ return -1;
71
+ /* frequency */
72
+ if ((header & (3<<10)) == 3<<10)
73
+ return -1;
74
+ return 0;
75
+}
76
+
77
+#endif /* FFABI_AVCODEC_MPEGAUDIODECHEADER_H */
78
makemkv-oss-1.8.5.tar.gz/libmakemkv/src/libmakemkv.def -> makemkv-oss-1.8.6.tar.gz/libmakemkv/src/libmakemkv.def
Changed
30
1
2
EXPORTS
3
set_world=set_world
4
MkvCreateFile=MkvCreateFile
5
- ffcodec_ff_mlp_read_major_sync
6
- ffcodec_ff_mlp_get_audio_info
7
- ffcodec_ff_mpegaudio_decode_header
8
- ffcodec_ff_mpa_check_header
9
- ffcodec_ffm_init_context_r
10
- ffcodec_ffm_init_context_w
11
- ffcodec_ffm_read_header
12
- ffcodec_ffm_read_packet_header
13
- ffcodec_ffm_read_packet_data
14
- ffcodec_ffm_write_header
15
- ffcodec_ffm_write_packet
16
- ffcodec_ffm_write_trailer
17
HTTP_Download
18
- TPDLLIH
19
getopt_long=getopt_long
20
getopt_get_optind=getopt_get_optind
21
getopt_get_optarg=getopt_get_optarg
22
23
-
24
-
25
-
26
-
27
-
28
-
29
\ No newline at end of file
30
makemkv-oss-1.8.5.tar.gz/libmakemkv/src/libmakemkv.vers -> makemkv-oss-1.8.6.tar.gz/libmakemkv/src/libmakemkv.vers
Changed
45
1
2
{ global:
3
set_world;
4
MkvCreateFile;
5
- ffcodec_ff_mlp_read_major_sync;
6
- ffcodec_ff_mlp_get_audio_info;
7
- ffcodec_ff_mpegaudio_decode_header;
8
- ffcodec_ff_mpa_check_header;
9
- ffcodec_ffm_init_context_r;
10
- ffcodec_ffm_init_context_w;
11
- ffcodec_ffm_read_header;
12
- ffcodec_ffm_read_packet_header;
13
- ffcodec_ffm_read_packet_data;
14
- ffcodec_ffm_write_header;
15
- ffcodec_ffm_write_packet;
16
- ffcodec_ffm_write_trailer;
17
HTTP_Download;
18
OSSL_sizeof_AES_KEY;
19
OSSL_AES_set_encrypt_key;
20
21
XPAT_GetCurrentByteIndex;
22
XPAT_ErrorString;
23
XPAT_ExpatVersion;
24
+ ffm_init;
25
+ ffm_avcodec_version;
26
+ ffm_audio_decode_init;
27
+ ffm_audio_decode_close;
28
+ ffm_audio_decode_put_data;
29
+ ffm_audio_decode_get_frame;
30
+ ffm_audio_decode_get_info;
31
+ ffm_audio_encode_init;
32
+ ffm_audio_encode_close;
33
+ ffm_audio_encode_put_frame;
34
+ ffm_audio_encode_get_data;
35
+ ffm_audio_encode_get_info;
36
+ ffm_audio_check_codec_format;
37
+ ffm_audio_convert_alloc;
38
+ ffm_audio_convert_free;
39
+ ffm_audio_convert;
40
+ ffm_mlp_read_syncframe;
41
+ ffm_mlp_checksum16;
42
+ ffm_mpa_decode_header;
43
local: *;
44
};
45
makemkv-oss-1.8.5.tar.gz/libmakemkv/src/libmkv.cpp -> makemkv-oss-1.8.6.tar.gz/libmakemkv/src/libmkv.cpp
Changed
67
1
2
unsigned int frame_count;
3
unsigned int compression_type;
4
unsigned int compression_level;
5
+ EbmlBinary* codec_private;
6
};
7
8
class MyDataBuffer : public DataBuffer
9
10
11
if (0!=ti->codec_private_size)
12
{
13
- GetChild<EbmlBinary,KaxCodecPrivate>(cur_track).CopyBuffer(ti->codec_private,ti->codec_private_size);
14
+ track_info[i].codec_private = & GetChild<EbmlBinary,KaxCodecPrivate>(cur_track);
15
+ track_info[i].codec_private->CopyBuffer(ti->codec_private,ti->codec_private_size);
16
+ } else {
17
+ track_info[i].codec_private = NULL;
18
}
19
20
if (0!=ti->default_duration)
21
22
23
Chapters.Finalize(File,seek_chap,max_duration);
24
25
- // delete empty tracks
26
- for (unsigned int i=0;i<Input->MkvGetStreamCount();i++)
27
+ for (unsigned int i=1;i<Input->MkvGetStreamCount();i++)
28
{
29
- if (track_info[i].frame_count>0) continue;
30
- VoidElement(tracks[i],File);
31
- my_world()->uc_emptytrack(Input,i,&track_info[i].info);
32
+
33
+ if (track_info[i].frame_count==0)
34
+ {
35
+ VoidElement(tracks[i],File);
36
+ my_world()->uc_emptytrack(Input,i,&track_info[i].info);
37
+ continue;
38
+ }
39
+
40
+ if (track_info[i].codec_private)
41
+ {
42
+ MkvTrackInfo ti;
43
+
44
+
45
+ memset(&ti,0,sizeof(ti));
46
+ if (false==Input->MkvGetStream(i)->UpdateTrackInfo(&ti))
47
+ {
48
+ throw mkv_error_exception("UpdateTrackInfo failed");
49
+ }
50
+
51
+ if (track_info[i].codec_private->GetSize()==ti.codec_private_size)
52
+ {
53
+ if (0!=memcmp(track_info[i].codec_private->GetBuffer(),
54
+ ti.codec_private,ti.codec_private_size))
55
+ {
56
+
57
+ memcpy(track_info[i].codec_private->GetBuffer(),
58
+ ti.codec_private,ti.codec_private_size);
59
+
60
+ track_info[i].codec_private->OverwriteData(File,true);
61
+ }
62
+ }
63
+ }
64
}
65
66
// end
67
makemkv-oss-1.8.5.tar.gz/libmakemkv/src/world.cpp -> makemkv-oss-1.8.6.tar.gz/libmakemkv/src/world.cpp
Changed
29
1
2
#include <lgpl/zlibabi.h>
3
#include <lgpl/httpabi.h>
4
#include <lgpl/sysabi.h>
5
-#include <ffcodec/ffcodec.h>
6
+#include <lgpl/ffabi.h>
7
#include <cstdlib>
8
9
#ifdef LGPL_WORLD_HAVE_PRINTFS
10
11
{
12
static int volatile i=0;
13
MkvCreateFile(NULL,NULL,NULL,NULL,NULL);
14
- ffcodec_ff_mlp_read_major_sync(NULL,NULL,1);
15
- i+=ffcodec_ff_mlp_get_audio_info(NULL,NULL);
16
- i+=ffcodec_ffm_read_header(NULL);
17
- i+=ffcodec_ffm_write_header(NULL);
18
i+=HTTP_Download(NULL,NULL,NULL,NULL);
19
#ifdef _linux_
20
OSSL_SHA1_Init(NULL);
21
22
i+=SYS_posix_getmyname(NULL,0);
23
i+=SYS_posix_launch(NULL,0,0,0,NULL);
24
SYS_memcpy(NULL,NULL,i);
25
+ i+=ffm_avcodec_version();
26
#endif
27
}
28
29
makemkv-oss-1.8.5.tar.gz/libmmbd/src/aacs.cpp -> makemkv-oss-1.8.6.tar.gz/libmmbd/src/aacs.cpp
Changed
13
1
2
return NULL;
3
}
4
5
+AACS_PUBLIC const uint8_t * __cdecl aacs_get_device_binding_id(AACS *aacs)
6
+{
7
+ return (const uint8_t*)"mmbdevicebinding";
8
+}
9
+
10
static AACS_RL_ENTRY fake_rl_entry = { 0,{0} };
11
12
AACS_PUBLIC AACS_RL_ENTRY * __cdecl aacs_get_hrl(int *num_entries, int *mkb_version)
13
makemkv-oss-1.8.5.tar.gz/libmmbd/src/aacs.h -> makemkv-oss-1.8.6.tar.gz/libmmbd/src/aacs.h
Changed
9
1
2
AACS_PUBLIC const uint8_t * __cdecl aacs_get_disc_id(AACS *aacs);
3
AACS_PUBLIC const uint8_t * __cdecl aacs_get_vid(AACS *aacs); /* may fail even if disc can be decrypted */
4
AACS_PUBLIC const uint8_t * __cdecl aacs_get_pmsn(AACS *aacs); /* may fail even if disc can be decrypted */
5
+AACS_PUBLIC const uint8_t * __cdecl aacs_get_device_binding_id(AACS *aacs);
6
7
/* revocation lists */
8
typedef struct {
9
makemkv-oss-1.8.5.tar.gz/libmmbd/src/bdplus.cpp -> makemkv-oss-1.8.6.tar.gz/libmmbd/src/bdplus.cpp
Changed
104
1
2
Specifically, assumptions are made on how the functions
3
in this library are called from libbluray.
4
Do not use this API.
5
+ This library emulates both "old" and "new" libbdplus API
6
+ and for this reason BDPLUS_CTX and BDPLUS_ST handles are
7
+ interchangeable.
8
*/
9
10
typedef struct _BDPLUS_CTX
11
12
return ctx;
13
}
14
15
-AACS_PUBLIC void __cdecl bdplus_free(BDPLUS_CTX* ctx)
16
+AACS_PUBLIC int __cdecl bdplus_free(BDPLUS_CTX* ctx)
17
{
18
free(ctx);
19
+ return 0;
20
}
21
22
-AACS_PUBLIC void __cdecl bdplus_set_title(BDPLUS_CTX* ctx,uint32_t clip_id)
23
+AACS_PUBLIC int __cdecl bdplus_set_title(BDPLUS_CTX* ctx,uint32_t clip_id)
24
{
25
ctx->clip_id = clip_id;
26
ctx->offset = 0;
27
+ return 0;
28
}
29
30
-AACS_PUBLIC void __cdecl bdplus_seek(BDPLUS_CTX* ctx,uint64_t offset)
31
+AACS_PUBLIC int __cdecl bdplus_seek(BDPLUS_CTX* ctx,uint64_t offset)
32
{
33
ctx->offset = offset;
34
+ return 0;
35
}
36
37
-AACS_PUBLIC uint32_t __cdecl bdplus_fixup(BDPLUS_CTX* ctx,size_t len,uint8_t* buffer)
38
+AACS_PUBLIC int __cdecl bdplus_fixup(BDPLUS_CTX* ctx,size_t len,uint8_t* buffer)
39
{
40
+ int r,count=0;
41
+
42
if ((ctx->offset%6144)!=0) {
43
ctx->mmbd->error_message(101,"bdplus_fixup: offset is not aligned");
44
- return 0;
45
+ return -1;
46
}
47
if ((len%6144)!=0) {
48
ctx->mmbd->error_message(102,"bdplus_fixup: length is not aligned");
49
- return 0;
50
+ return -2;
51
}
52
53
for (size_t i=0;i<len;i+=6144) {
54
- if (ctx->mmbd->decrypt_unit(ctx->clip_id|MMBD_FILE_M2TS|MMBD_FLAG_BDPLUS_ONLY,ctx->offset,buffer+i)) {
55
+ r = ctx->mmbd->decrypt_unit(ctx->clip_id|MMBD_FILE_M2TS|MMBD_FLAG_BDPLUS_ONLY,ctx->offset,buffer+i);
56
+ if (r<0) {
57
ctx->mmbd->error_message(103,"bdplus_fixup: mmbd_decrypt_unit failed");
58
+ } else {
59
+ count += r;
60
}
61
ctx->offset+=6144;
62
}
63
- return 1;
64
+ if (ctx->mmbd->mmbdipc_version()<2) count=1;
65
+ return count;
66
+}
67
+
68
+AACS_PUBLIC BDPLUS_ST* __cdecl bdplus_m2ts(BDPLUS_CTX* ctx,uint32_t clip_id)
69
+{
70
+ BDPLUS_CTX* st = (BDPLUS_CTX*)malloc(sizeof(BDPLUS_CTX));
71
+ if (!st) return NULL;
72
+
73
+ st->mmbd = ctx->mmbd;
74
+ st->clip_id = clip_id;
75
+ st->offset = 0;
76
+ return st;
77
+}
78
+
79
+AACS_PUBLIC int __cdecl bdplus_m2ts_close(BDPLUS_ST* st)
80
+{
81
+ return bdplus_free(st);
82
+}
83
+
84
+AACS_PUBLIC int __cdecl bdplus_mmap(BDPLUS_CTX* ctx,uint32_t region_id,void *mem)
85
+{
86
+ return 0;
87
+}
88
+
89
+AACS_PUBLIC int __cdecl bdplus_psr(BDPLUS_CTX* ctx,void *regs,void *read,void *write)
90
+{
91
+ return 0;
92
+}
93
+
94
+AACS_PUBLIC int __cdecl bdplus_event(BDPLUS_CTX* ctx,uint32_t event,uint32_t param1,uint32_t param2)
95
+{
96
+ return 0;
97
+}
98
+
99
+AACS_PUBLIC int __cdecl bdplus_start(BDPLUS_CTX* ctx)
100
+{
101
+ return 0;
102
}
103
104
makemkv-oss-1.8.5.tar.gz/libmmbd/src/bdplus.h -> makemkv-oss-1.8.6.tar.gz/libmmbd/src/bdplus.h
Changed
33
1
2
3
struct _BDPLUS_CTX;
4
typedef struct _BDPLUS_CTX BDPLUS_CTX;
5
+typedef struct _BDPLUS_CTX BDPLUS_ST;
6
7
#ifdef __cplusplus
8
extern "C" {
9
#endif
10
11
AACS_PUBLIC BDPLUS_CTX* __cdecl bdplus_init(const char *path, const char *keyfile_path,const uint8_t* aacs_vid);
12
-AACS_PUBLIC void __cdecl bdplus_free(BDPLUS_CTX* ctx);
13
-AACS_PUBLIC void __cdecl bdplus_set_title(BDPLUS_CTX* ctx,uint32_t clip_id);
14
-AACS_PUBLIC void __cdecl bdplus_seek(BDPLUS_CTX* ctx,uint64_t offset);
15
-AACS_PUBLIC uint32_t __cdecl bdplus_fixup(BDPLUS_CTX* ctx,size_t len,uint8_t* buffer);
16
+AACS_PUBLIC int __cdecl bdplus_free(BDPLUS_CTX* ctx);
17
+
18
+// old API
19
+AACS_PUBLIC int __cdecl bdplus_set_title(BDPLUS_CTX* ctx,uint32_t clip_id);
20
+AACS_PUBLIC int __cdecl bdplus_seek(BDPLUS_CTX* ctx,uint64_t offset);
21
+AACS_PUBLIC int __cdecl bdplus_fixup(BDPLUS_CTX* ctx,size_t len,uint8_t* buffer);
22
+
23
+// new API
24
+AACS_PUBLIC int __cdecl bdplus_mmap(BDPLUS_CTX* ctx,uint32_t region_id,void *mem);
25
+AACS_PUBLIC int __cdecl bdplus_psr(BDPLUS_CTX* ctx,void *regs,void *read,void *write);
26
+AACS_PUBLIC int __cdecl bdplus_event(BDPLUS_CTX* ctx,uint32_t event,uint32_t param1,uint32_t param2);
27
+AACS_PUBLIC int __cdecl bdplus_start(BDPLUS_CTX* ctx);
28
+AACS_PUBLIC BDPLUS_ST* __cdecl bdplus_m2ts(BDPLUS_CTX* ctx,uint32_t clip_id);
29
+AACS_PUBLIC int __cdecl bdplus_m2ts_close(BDPLUS_ST* st);
30
31
#ifdef __cplusplus
32
}
33
makemkv-oss-1.8.5.tar.gz/libmmbd/src/libmmbd.def -> makemkv-oss-1.8.6.tar.gz/libmmbd/src/libmmbd.def
Changed
18
1
2
aacs_get_pmsn
3
aacs_get_hrl
4
aacs_get_drl
5
+ aacs_get_device_binding_id
6
bdplus_init
7
bdplus_free
8
bdplus_set_title
9
bdplus_seek
10
bdplus_fixup
11
-
12
+ bdplus_mmap
13
+ bdplus_psr
14
+ bdplus_event
15
+ bdplus_start
16
+ bdplus_m2ts
17
+ bdplus_m2ts_close
18
makemkv-oss-1.8.5.tar.gz/libmmbd/src/libmmbd.vers -> makemkv-oss-1.8.6.tar.gz/libmmbd/src/libmmbd.vers
Changed
19
1
2
aacs_get_pmsn;
3
aacs_get_hrl;
4
aacs_get_drl;
5
+ aacs_get_device_binding_id;
6
bdplus_init;
7
bdplus_free;
8
bdplus_set_title;
9
bdplus_seek;
10
bdplus_fixup;
11
+ bdplus_mmap;
12
+ bdplus_psr;
13
+ bdplus_event;
14
+ bdplus_start;
15
+ bdplus_m2ts;
16
+ bdplus_m2ts_close;
17
local: *;
18
};
19
makemkv-oss-1.8.5.tar.gz/libmmbd/src/mmbd.cpp -> makemkv-oss-1.8.6.tar.gz/libmmbd/src/mmbd.cpp
Changed
13
1
2
*/
3
MMBD_PUBLIC int __cdecl mmbd_decrypt_unit(MMBD *mmbd,uint32_t name_flags,uint64_t file_offset,uint8_t* buf)
4
{
5
+ int r;
6
if (mmbd==NULL) return -1;
7
- return ((CMMBDConn*)mmbd)->decrypt_unit(name_flags,file_offset,buf);
8
+ r=((CMMBDConn*)mmbd)->decrypt_unit(name_flags,file_offset,buf);
9
+ return (r<0)?r:0;
10
}
11
12
/* mmbd_get_mkb_version
13
makemkv-oss-1.8.5.tar.gz/libmmbd/src/mmconn.cpp -> makemkv-oss-1.8.6.tar.gz/libmmbd/src/mmconn.cpp
Changed
40
1
2
uint32_t clip_info = 0;
3
uint32_t *p_clip_info = NULL;
4
const uint8_t* dbuf;
5
- unsigned int size;
6
+ unsigned int size,ret=0;
7
uint32_t clip_name = name_flags&(0xfffff|MMBD_FLAG_AUTO_CPSID|MMBD_FILE_SSIF);
8
9
if ((!m_active) || (!m_disc_flags)) return -2;
10
11
12
13
dbuf = m_apc.DecryptUnitMMBD(name_flags,&clip_info,file_offset,buf,size);
14
- if (!dbuf) return false;
15
+ if (!dbuf) return -4;
16
17
if (p_clip_info) {
18
if (p_clip_info[1]!=clip_info) {
19
20
offset = *p++; offset<<=8; offset |= *p++;
21
memcpy(buf+offset,p,len); p+=len;
22
}
23
+ ret = count;
24
}
25
26
- return 0;
27
+ return ret;
28
}
29
30
unsigned int CMMBDConn::get_mkb_version()
31
32
33
int CMMBDConn::mmbdipc_version()
34
{
35
- return 1;
36
+ return 2;
37
}
38
39
const uint8_t* CMMBDConn::get_encoded_ipc_handle()
40
makemkv-oss-1.8.5.tar.gz/makefile.common -> makemkv-oss-1.8.6.tar.gz/makefile.common
Changed
15
1
2
3
LIBABI_SRC_LINUX=libabi/src/httplinux.cpp makemkvgui/src/api_linux.cpp libabi/src/sys_linux.c makemkvgui/src/spawn_posix.cpp
4
5
-LIBFFCODEC_INC=-Ilibffcodec/inc
6
+LIBFFABI_INC=-Ilibffabi/inc
7
8
-LIBFFCODEC_SRC=libffcodec/src/ffcodec.c libffcodec/src/crc.c libffcodec/src/mlp.c libffcodec/src/mlp_parser.c \
9
- libffcodec/src/mpegaudiodata.c libffcodec/src/mpegaudiodecheader.c libffcodec/src/aviobuf.c \
10
- libffcodec/src/ffmdec.c libffcodec/src/ffmenc.c
11
+LIBFFABI_SRC=libffabi/src/ffabi.c libffabi/src/mlp.c libffabi/src/log.c libffabi/src/audio_convert.c
12
13
LIBMAKEMKV_INC=-Ilibmakemkv/inc
14
15
makemkv-oss-1.8.5.tar.gz/makefile.linux -> makemkv-oss-1.8.6.tar.gz/makefile.linux
Changed
26
1
2
clean:
3
-rm -rf out tmp
4
5
-install: out/libdriveio.so.0 out/libmakemkv.so.1 out/makemkv
6
+install: out/libdriveio.so.0 out/libmakemkv.so.1 out/makemkv out/libmmbd.so.0
7
install -D -m 644 out/libdriveio.so.0 $(DESTDIR)$(LIBDIR)/libdriveio.so.0
8
install -D -m 644 out/libmakemkv.so.1 $(DESTDIR)$(LIBDIR)/libmakemkv.so.1
9
install -D -m 644 out/libmmbd.so.0 $(DESTDIR)$(LIBDIR)/libmmbd.so.0
10
11
out/libmakemkv.so.1.full: tmp/gen_buildinfo.h
12
mkdir -p out
13
$(GCC) $(CXXOPTS) -D_REENTRANT -shared -Wl,-z,defs -o$@ $(LIBEBML_INC) $(LIBEBML_DEF) $(LIBMATROSKA_INC) \
14
- $(LIBMAKEMKV_INC) $(SSTRING_INC) $(MAKEMKVGUI_INC) $(LIBABI_INC) $(LIBFFCODEC_INC) \
15
+ $(LIBMAKEMKV_INC) $(SSTRING_INC) $(MAKEMKVGUI_INC) $(LIBABI_INC) $(LIBFFABI_INC) \
16
$(LIBEBML_SRC) $(LIBMATROSKA_SRC) $(LIBMAKEMKV_SRC) $(GLIBC_SRC) $(SSTRING_SRC) \
17
- $(LIBABI_SRC) $(LIBABI_SRC_LINUX) $(LIBFFCODEC_SRC) \
18
+ $(LIBABI_SRC) $(LIBABI_SRC_LINUX) $(LIBFFABI_SRC) \
19
-DHAVE_BUILDINFO_H -Itmp \
20
-fPIC -Xlinker -dy -Xlinker --version-script=libmakemkv/src/libmakemkv.vers \
21
- -Xlinker -soname=libmakemkv.so.1 -lc -lstdc++ -lcrypto -lz -lexpat
22
+ -Xlinker -soname=libmakemkv.so.1 -lc -lstdc++ -lcrypto -lz -lexpat -lavcodec -lavutil -lm
23
24
out/libmmbd.so.0.full:
25
mkdir -p out
26
makemkv-oss-1.8.5.tar.gz/makemkvgui/inc/lgpl/apdefs.h -> makemkv-oss-1.8.6.tar.gz/makemkvgui/inc/lgpl/apdefs.h
Changed
10
1
2
apset_screen_state ,
3
apset_app_DefaultProfileName ,
4
apset_app_DefaultSelectionString ,
5
- apset_app_ffmpeg ,
6
+ apset_old_app_ffmpeg ,
7
apset_app_dtshddec ,
8
apset_MaxValue
9
} ApSettingId;
10
makemkv-oss-1.8.5.tar.gz/makemkvgui/inc/ver_num.h -> makemkv-oss-1.8.6.tar.gz/makemkvgui/inc/ver_num.h
Changed
12
1
2
#ifndef VERNUM_H_INCLUDED
3
#define VERNUM_H_INCLUDED
4
5
-#define MAKEMKV_VERSION_NUMBER "v1.8.5"
6
-#define LIBMMBD_VERSION_NUMBER "v1.0.0"
7
+#define MAKEMKV_VERSION_NUMBER "v1.8.6"
8
+#define LIBMMBD_VERSION_NUMBER "v1.1.0"
9
10
#endif // VERNUM_H_INCLUDED
11
12
makemkv-oss-1.8.5.tar.gz/makemkvgui/src/image.cpp -> makemkv-oss-1.8.6.tar.gz/makemkvgui/src/image.cpp
Changed
20
1
2
{
3
unsigned int s = size.height();
4
5
- if ( (s>=14) && (s<18) ) s = 16;
6
- if ( (s>=18) && (s<34) ) s = 32;
7
- if ( (s>=34) && (s<66) ) s = 64;
8
- if ( (s>=66) && (s<130) ) s = 128;
9
- if ( (s>=130) && (s<260) ) s = 256;
10
- if (s>=260) s = 512;
11
+ if ( (s>=14) && (s<29) ) s = 16;
12
+ if ( (s>=29) && (s<58) ) s = 32;
13
+ if ( (s>=58) && (s<115) ) s = 64;
14
+ if ( (s>=115) && (s<230) ) s = 128;
15
+ if ( (s>=230) && (s<460) ) s = 256;
16
+ if (s>=460) s = 512;
17
18
if (s<min) s=min;
19
20
makemkv-oss-1.8.5.tar.gz/makemkvgui/src/settingdlg.cpp -> makemkv-oss-1.8.6.tar.gz/makemkvgui/src/settingdlg.cpp
Changed
31
1
2
}
3
advancedTab->lineEditSelection->setText(QStringFromUtf16(defaultSelection));
4
5
- advancedTab->ffmpegDir->setText(QStringFromUtf16( client->GetSettingString(apset_app_ffmpeg)));
6
advancedTab->dtshddecDir->setText(QStringFromUtf16( client->GetSettingString(apset_app_dtshddec)));
7
8
toggleAdvanced(expert_mode!=0);
9
10
} else {
11
client->SetSettingString(apset_app_DefaultSelectionString,Utf16FromQString(advancedTab->lineEditSelection->text()));
12
}
13
- client->SetSettingString(apset_app_ffmpeg,Utf16FromQString(advancedTab->ffmpegDir->text()));
14
client->SetSettingString(apset_app_dtshddec,Utf16FromQString(advancedTab->dtshddecDir->text()));
15
16
restartRequired = (NULL!=client->GetAppString(AP_vastr_RestartRequired));
17
18
b_lay->addWidget(lineEditSelection,1,1);
19
box->setLayout(b_lay);
20
21
- ffmpegDir = new CDirSelectBox(CDirSelectBox::DirBoxFile,UI_QSTRING(APP_IFACE_SETTINGS_ADV_FFMPEG_PATH));
22
dtshddecDir = new CDirSelectBox(CDirSelectBox::DirBoxFile,UI_QSTRING(APP_IFACE_SETTINGS_ADV_DTSHDDEC_PATH));
23
24
QBoxLayout *lay = new QVBoxLayout();
25
26
lay->addWidget(box);
27
- lay->addWidget(ffmpegDir);
28
lay->addWidget(dtshddecDir);
29
30
lay->addStretch(2);
31
makemkv-oss-1.8.5.tar.gz/makemkvgui/src/settingdlg.h -> makemkv-oss-1.8.6.tar.gz/makemkvgui/src/settingdlg.h
Changed
9
1
2
public:
3
QComboBox* comboProfile;
4
QLineEdit* lineEditSelection;
5
- CDirSelectBox* ffmpegDir;
6
CDirSelectBox* dtshddecDir;
7
8
public:
9
makemkv-oss-1.8.5.tar.gz/makemkvgui/src/str/en_utf16.cpp -> makemkv-oss-1.8.6.tar.gz/makemkvgui/src/str/en_utf16.cpp
Changed
81
1
2
3
*/
4
5
-static const unsigned short en_po_str[20187]={
6
+static const unsigned short en_po_str[20202]={
7
'e','n','g',':','E','n','g','l','i','s','h',0,
8
'D','B','G',' ','A','S','S','E','R','T',':',' ','%','1',' ','a','t',' ','%','2',':','%','3',0,
9
'L','I','B','M','K','V','_','T','R','A','C','E',':',' ','%','1',0,
10
11
'L','P','C','M',' ','a','u','d','i','o',' ','i','n',' ','W','A','V',' ','c','o','n','t','a','i','n','e','r',' ','w','i','t','h',' ','c','h','a','n','n','e','l',' ','c','o','n','f','i','g','u','r','a','t','i','o','n',' ','m','e','t','a','d','a','t','a',0,
12
'F','L','A','C',' ','a','u','d','i','o',0,
13
'V','O','B','S','U','B',' ','s','u','b','t','i','t','l','e','s',0,
14
+'A','C','3',' ','a','u','d','i','o',0,
15
'D','e','f','a','u','l','t',0,
16
'F','o','r','c','e','d',0,
17
'M','a','k','e','M','K','V',' ','B','E','T','A',0,
18
19
'D','e','f','a','u','l','t',' ','p','r','o','f','i','l','e',' ',':',0,
20
'D','e','f','a','u','l','t',' ','s','e','l','e','c','t','i','o','n',' ','r','u','l','e',' ',':',0,
21
'F','F','M','P','E','G',' ','l','o','c','a','t','i','o','n',0,
22
-'d','t','s','h','d','d','e','c','.','d','l','l',' ','l','o','c','a','t','i','o','n',0,
23
+'d','t','s','d','e','c','o','d','e','r','d','l','l','.','d','l','l',' ','l','o','c','a','t','i','o','n',0,
24
'P','r','o','f','i','l','e',0,
25
'P','r','o','p','e','r','t','i','e','s',0,
26
'T','i','t','l','e',0,
27
28
'O','S',' ','d','e','v','i','c','e',' ','n','a','m','e',':',' ',0,
29
0};
30
31
-static const unsigned int en_po_off[1019]={
32
+static const unsigned int en_po_off[1021]={
33
1000,0,1001,12,1002,36,1003,53,1004,77,1005,124,1006,135,1007,136,1008,226,1009,275,2001,301,
34
2002,350,2003,436,2004,490,2005,558,2006,668,2007,785,2008,940,2009,1063,2010,1191,2011,1236,2012,1380,
35
2013,1491,2014,1604,2015,1652,2016,1734,2017,1897,2018,2012,2019,2074,2020,2114,2021,2281,2022,2404,2200,2538,
36
37
5085,15681,5086,15745,5087,15753,5088,15774,5089,15798,5201,15809,5202,15814,5203,15819,5204,15828,5207,15837,5208,15843,
38
5209,15858,5210,15867,5214,15872,5215,15881,5216,15887,5217,15904,5218,15916,5219,15932,5220,15943,5221,15956,5222,15967,
39
5223,15973,5224,15983,5225,15999,5226,16013,5227,16025,5228,16035,5233,16053,5234,16066,5235,16080,5238,16099,5239,16109,
40
-5301,16119,5302,16130,5303,16184,5304,16248,5305,16259,5380,16276,5381,16284,6000,16291,6001,16304,6002,16323,6003,16342,
41
-6005,16376,6006,16397,6007,16411,6008,16493,6010,16507,6011,16519,6012,16526,6013,16570,6014,16577,6015,16602,6016,16620,
42
-6017,16667,6018,16688,6019,16709,6020,16715,6021,16722,6022,16739,6023,16746,6030,16779,6031,16785,6032,16791,6034,16797,
43
-6035,16805,6036,16815,6037,16823,6038,16848,6039,16860,6040,16872,6041,16901,6042,16956,6043,16969,6044,16997,6045,17010,
44
-6046,17023,6047,17045,6048,17055,6050,17079,6051,17124,6052,17217,6053,17229,6054,17245,6055,17261,6056,17276,6057,17289,
45
-6058,17310,6059,17316,6060,17323,6061,17330,6062,17343,6063,17357,6064,17374,6065,17392,6066,17408,6067,17421,6068,17433,
46
-6069,17447,6070,17452,6071,17461,6072,17468,6073,17475,6074,17483,6075,17496,6076,17501,6077,17525,6078,17556,6079,17611,
47
-6080,17681,6081,17689,6082,17694,6083,17713,6085,17737,6086,17742,6087,17775,6088,17817,6089,17837,6090,17842,6091,17847,
48
-6092,17856,6093,17863,6094,17883,6095,17897,6096,17918,6097,17926,6098,17950,6099,18012,6100,18033,6101,18044,6102,18056,
49
-6103,18064,6104,18069,6105,18094,6106,18101,6107,18126,6108,18147,6109,18188,6110,18205,6111,18216,6112,18233,6119,18247,
50
-6120,18277,6121,18306,6122,18335,6123,18369,6124,18400,6125,18432,6126,18452,6127,18482,6128,18510,6129,18532,6130,18546,
51
-6131,18572,6132,18580,6133,18603,6134,18614,6135,18626,6136,18646,6137,18666,6138,18678,6139,18943,6142,18975,6143,18998,
52
-6144,19009,6145,19026,6146,19036,6147,19061,6148,19069,6149,19089,6150,19131,6151,19155,6152,19195,6153,19204,6154,19225,
53
-6156,19246,6157,19251,6158,19256,6161,19282,6162,19296,6163,19322,6164,19340,6165,19343,6166,19353,6167,19364,6169,19387,
54
-6170,19401,6171,19436,6172,19469,6173,19478,6174,19496,6175,19521,6176,19537,6180,19559,6181,19567,6200,19578,6201,19584,
55
-6202,19590,6203,19596,6204,19606,6205,19611,6206,19623,6207,19632,6209,19646,6210,19659,6211,19670,6212,19685,6213,19697,
56
-6214,19706,6215,19717,6216,19726,6300,19734,6301,19763,6302,19781,6303,19796,6304,19806,6305,19817,6306,19833,6307,19852,
57
-6308,19868,6309,19891,6320,19914,6321,19946,6322,19978,6323,20003,6324,20019,6325,20031,6326,20043,6327,20063,6329,20082,
58
-6330,20103,6331,20136,6332,20169,0};
59
+5301,16119,5302,16130,5303,16184,5304,16248,5305,16259,5306,16276,5380,16286,5381,16294,6000,16301,6001,16314,6002,16333,
60
+6003,16352,6005,16386,6006,16407,6007,16421,6008,16503,6010,16517,6011,16529,6012,16536,6013,16580,6014,16587,6015,16612,
61
+6016,16630,6017,16677,6018,16698,6019,16719,6020,16725,6021,16732,6022,16749,6023,16756,6030,16789,6031,16795,6032,16801,
62
+6034,16807,6035,16815,6036,16825,6037,16833,6038,16858,6039,16870,6040,16882,6041,16911,6042,16966,6043,16979,6044,17007,
63
+6045,17020,6046,17033,6047,17055,6048,17065,6050,17089,6051,17134,6052,17227,6053,17239,6054,17255,6055,17271,6056,17286,
64
+6057,17299,6058,17320,6059,17326,6060,17333,6061,17340,6062,17353,6063,17367,6064,17384,6065,17402,6066,17418,6067,17431,
65
+6068,17443,6069,17457,6070,17462,6071,17471,6072,17478,6073,17485,6074,17493,6075,17506,6076,17511,6077,17535,6078,17566,
66
+6079,17621,6080,17691,6081,17699,6082,17704,6083,17723,6085,17747,6086,17752,6087,17785,6088,17827,6089,17847,6090,17852,
67
+6091,17857,6092,17866,6093,17873,6094,17893,6095,17907,6096,17928,6097,17936,6098,17960,6099,18022,6100,18043,6101,18054,
68
+6102,18066,6103,18074,6104,18079,6105,18104,6106,18111,6107,18136,6108,18157,6109,18198,6110,18215,6111,18226,6112,18243,
69
+6119,18257,6120,18287,6121,18316,6122,18345,6123,18379,6124,18410,6125,18442,6126,18462,6127,18492,6128,18520,6129,18542,
70
+6130,18556,6131,18582,6132,18590,6133,18613,6134,18624,6135,18636,6136,18656,6137,18676,6138,18688,6139,18953,6142,18985,
71
+6143,19008,6144,19019,6145,19036,6146,19046,6147,19071,6148,19079,6149,19099,6150,19141,6151,19165,6152,19205,6153,19214,
72
+6154,19235,6156,19256,6157,19261,6158,19266,6161,19292,6162,19306,6163,19332,6164,19350,6165,19353,6166,19363,6167,19374,
73
+6169,19397,6170,19411,6171,19446,6172,19479,6173,19488,6174,19506,6175,19531,6176,19547,6180,19574,6181,19582,6200,19593,
74
+6201,19599,6202,19605,6203,19611,6204,19621,6205,19626,6206,19638,6207,19647,6209,19661,6210,19674,6211,19685,6212,19700,
75
+6213,19712,6214,19721,6215,19732,6216,19741,6300,19749,6301,19778,6302,19796,6303,19811,6304,19821,6305,19832,6306,19848,
76
+6307,19867,6308,19883,6309,19906,6320,19929,6321,19961,6322,19993,6323,20018,6324,20034,6325,20046,6326,20058,6327,20078,
77
+6329,20097,6330,20118,6331,20151,6332,20184,0};
78
79
extern "C" const unsigned short * en_po_getstr_utf16(unsigned int code)
80
{
81