Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
9e6b1f98
Commit
9e6b1f98
authored
Jun 11, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fourcc: preprocess the tables and sort them at build time
parent
91bea97e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
178 additions
and
5 deletions
+178
-5
include/vlc_es.h
include/vlc_es.h
+1
-0
include/vlc_fourcc.h
include/vlc_fourcc.h
+0
-2
src/.gitignore
src/.gitignore
+2
-0
src/Makefile.am
src/Makefile.am
+14
-0
src/misc/fourcc_gen.c
src/misc/fourcc_gen.c
+156
-0
src/misc/fourcc_list.h
src/misc/fourcc_list.h
+5
-3
No files found.
include/vlc_es.h
View file @
9e6b1f98
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#ifndef VLC_ES_H
#ifndef VLC_ES_H
#define VLC_ES_H 1
#define VLC_ES_H 1
#include <vlc_common.h>
#include <vlc_fourcc.h>
#include <vlc_fourcc.h>
#include <vlc_text_style.h>
#include <vlc_text_style.h>
...
...
include/vlc_fourcc.h
View file @
9e6b1f98
...
@@ -24,8 +24,6 @@
...
@@ -24,8 +24,6 @@
#ifndef VLC_FOURCC_H
#ifndef VLC_FOURCC_H
#define VLC_FOURCC_H 1
#define VLC_FOURCC_H 1
#include <vlc_common.h>
/* Video codec */
/* Video codec */
#define VLC_CODEC_MPGV VLC_FOURCC('m','p','g','v')
#define VLC_CODEC_MPGV VLC_FOURCC('m','p','g','v')
#define VLC_CODEC_MP4V VLC_FOURCC('m','p','4','v')
#define VLC_CODEC_MP4V VLC_FOURCC('m','p','4','v')
...
...
src/.gitignore
View file @
9e6b1f98
test_*
test_*
fourcc_gen
fourcc_tables.h
libvlc_win32_rc.rc
libvlc_win32_rc.rc
revision.c
revision.c
revision.txt
revision.txt
src/Makefile.am
View file @
9e6b1f98
...
@@ -515,6 +515,20 @@ SOURCES_libvlc = \
...
@@ -515,6 +515,20 @@ SOURCES_libvlc = \
$(SOURCES_libvlc_common)
\
$(SOURCES_libvlc_common)
\
$(NULL)
$(NULL)
# FourCC tables
BUILT_SOURCES
+=
fourcc_tables.h
EXTRA_DIST
+=
misc/fourcc_gen.c
MOSTLYCLEANFILES
=
fourcc_gen
fourcc_gen
:
misc/fourcc_gen.c misc/fourcc_list.h ../include/vlc_fourcc.h
$(AM_V_at)
rm
-f
--
$@
$(AM_V_CC)$(BUILDCC)
-I
$(srcdir)
-o
$@
$<
fourcc_tables.h
:
fourcc_gen
$(AM_V_at)
rm
-f
--
$@
.tmp
$(AM_V_GEN)$(builddir)
/fourcc_gen
>
$@
.tmp
$(AM_V_at)
mv
-f
--
$@
.tmp
$@
# Unit/regression tests
# Unit/regression tests
#
#
check_PROGRAMS
=
\
check_PROGRAMS
=
\
...
...
src/misc/fourcc_gen.c
0 → 100644
View file @
9e6b1f98
/*****************************************************************************
* fourcc_gen.c: FourCC preprocessor
*****************************************************************************
* Copyright © 2015 Rémi Denis-Courmont
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/* DO NOT include "config.h" here */
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#define VLC_API
#define VLC_USED
typedef
uint32_t
vlc_fourcc_t
;
#include "../include/vlc_fourcc.h"
#define VLC_FOURCC(a,b,c,d) { a, b, c, d }
#define A(sfcc) E(sfcc, NULL)
#define B(fcc,dsc) { true, fcc, dsc }
#define E(sfcc,dsc) { false, sfcc, dsc }
typedef
struct
{
bool
klass
;
char
fourcc
[
4
];
const
char
*
description
;
}
staticentry_t
;
#include "misc/fourcc_list.h"
struct
entry
{
char
fourcc
[
4
];
char
alias
[
4
];
const
char
*
desc
;
};
static
int
cmp_entry
(
const
void
*
a
,
const
void
*
b
)
{
const
struct
entry
*
ea
=
a
,
*
eb
=
b
;
return
memcmp
(
ea
->
alias
,
eb
->
alias
,
4
);
}
static
void
process_list
(
const
char
*
name
,
const
staticentry_t
*
list
,
size_t
n
)
{
assert
(
n
>
0
);
n
--
;
/* discard final nul entry */
struct
entry
*
entries
=
malloc
(
sizeof
(
*
entries
)
*
n
);
if
(
entries
==
NULL
)
abort
();
const
staticentry_t
*
klass
=
NULL
;
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
{
if
(
list
[
i
].
klass
)
klass
=
&
list
[
i
];
if
(
klass
==
NULL
)
{
fprintf
(
stderr
,
"Error: FourCC
\"
%.4s
\"
not mapped!
\n
"
,
list
[
i
].
fourcc
);
exit
(
1
);
}
memcpy
(
entries
[
i
].
fourcc
,
klass
->
fourcc
,
4
);
memcpy
(
entries
[
i
].
alias
,
list
[
i
].
fourcc
,
4
);
entries
[
i
].
desc
=
list
[
i
].
description
;
}
qsort
(
entries
,
n
,
sizeof
(
*
entries
),
cmp_entry
);
size_t
dups
=
0
;
for
(
size_t
i
=
1
;
i
<
n
;
i
++
)
{
if
(
!
memcmp
(
entries
[
i
].
fourcc
,
entries
[
i
].
alias
,
4
))
continue
;
if
(
!
memcmp
(
entries
[
i
-
1
].
alias
,
entries
[
i
].
alias
,
4
))
{
fprintf
(
stderr
,
"Error: FourCC
\"
%.4s
\"
(alias of
\"
%.4s
\"
) "
"duplicated!
\n
"
,
entries
[
i
].
alias
,
entries
[
i
].
fourcc
);
dups
++
;
}
}
if
(
dups
>
0
)
exit
(
1
);
printf
(
"static const struct fourcc_mapping mapping_%s[] = {
\n
"
,
name
);
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
{
if
(
!
memcmp
(
entries
[
i
].
fourcc
,
entries
[
i
].
alias
,
4
))
continue
;
printf
(
" { { { 0x%02hhx, 0x%02hhx, 0x%02hhx, 0x%02hhx } }, "
"{ { 0x%02hhx, 0x%02hhx, 0x%02hhx, 0x%02hhx } } },
\n
"
,
entries
[
i
].
alias
[
0
],
entries
[
i
].
alias
[
1
],
entries
[
i
].
alias
[
2
],
entries
[
i
].
alias
[
3
],
entries
[
i
].
fourcc
[
0
],
entries
[
i
].
fourcc
[
1
],
entries
[
i
].
fourcc
[
2
],
entries
[
i
].
fourcc
[
3
]);
}
puts
(
"};"
);
printf
(
"static const struct fourcc_desc desc_%s[] = {
\n
"
,
name
);
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
{
if
(
entries
[
i
].
desc
==
NULL
)
continue
;
printf
(
" { { { 0x%02hhx, 0x%02hhx, 0x%02hhx, 0x%02hhx } }, "
"
\"
%s
\"
},
\n
"
,
entries
[
i
].
alias
[
0
],
entries
[
i
].
alias
[
1
],
entries
[
i
].
alias
[
2
],
entries
[
i
].
alias
[
3
],
entries
[
i
].
desc
);
}
puts
(
"};"
);
free
(
entries
);
fprintf
(
stderr
,
"%s: %zu entries
\n
"
,
name
,
n
);
}
int
main
(
void
)
{
puts
(
"/* This file is generated automatically. DO NOT EDIT! */"
);
puts
(
"struct fourcc_mapping {"
);
puts
(
" union { unsigned char alias_str[4]; vlc_fourcc_t alias; };"
);
puts
(
" union { unsigned char fourcc_str[4]; vlc_fourcc_t fourcc; };"
);
puts
(
"};"
);
puts
(
"struct fourcc_desc {"
);
puts
(
" union { unsigned char alias_str[4]; vlc_fourcc_t alias; };"
);
puts
(
" const char desc[52];"
);
puts
(
"};"
);
#define p(t) \
process_list(#t, p_list_##t, \
sizeof (p_list_##t) / sizeof ((p_list_##t)[0]))
p
(
video
);
p
(
audio
);
p
(
spu
);
return
0
;
}
src/misc/fourcc_list.h
View file @
9e6b1f98
...
@@ -1076,8 +1076,9 @@ static const staticentry_t p_list_video[] = {
...
@@ -1076,8 +1076,9 @@ static const staticentry_t p_list_video[] = {
B
(
VLC_CODEC_HNM4_VIDEO
,
"Cryo Interactive Entertainment HNM4"
),
B
(
VLC_CODEC_HNM4_VIDEO
,
"Cryo Interactive Entertainment HNM4"
),
B
(
0
,
""
)
B
(
VLC_FOURCC
(
0
,
0
,
0
,
0
)
,
""
)
};
};
static
const
staticentry_t
p_list_audio
[]
=
{
static
const
staticentry_t
p_list_audio
[]
=
{
/* Windows Media Audio 1 */
/* Windows Media Audio 1 */
...
@@ -1482,8 +1483,9 @@ static const staticentry_t p_list_audio[] = {
...
@@ -1482,8 +1483,9 @@ static const staticentry_t p_list_audio[] = {
B
(
VLC_CODEC_ADPCM_IMA_APC
,
"ADPCM APC"
),
B
(
VLC_CODEC_ADPCM_IMA_APC
,
"ADPCM APC"
),
B
(
0
,
""
)
B
(
VLC_FOURCC
(
0
,
0
,
0
,
0
)
,
""
)
};
};
static
const
staticentry_t
p_list_spu
[]
=
{
static
const
staticentry_t
p_list_spu
[]
=
{
B
(
VLC_CODEC_SPU
,
"DVD Subtitles"
),
B
(
VLC_CODEC_SPU
,
"DVD Subtitles"
),
...
@@ -1553,5 +1555,5 @@ static const staticentry_t p_list_spu[] = {
...
@@ -1553,5 +1555,5 @@ static const staticentry_t p_list_spu[] = {
B
(
VLC_CODEC_TTML
,
"TTML subtitles"
),
B
(
VLC_CODEC_TTML
,
"TTML subtitles"
),
A
(
"ttml"
),
A
(
"ttml"
),
B
(
0
,
""
)
B
(
VLC_FOURCC
(
0
,
0
,
0
,
0
)
,
""
)
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment