Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -349,31 +349,31 @@ mpv$(EXESUF):
$(CC) -o $@ $^ $(EXTRALIBS)

codec-cfg.c: codecs.conf.h
codecs.conf.h: TOOLS/file2string.py etc/codecs.conf
codecs.conf.h: TOOLS/file2string.pl etc/codecs.conf
./$^ >$@

input/input.c: input/input_conf.h
input/input_conf.h: TOOLS/file2string.py etc/input.conf
input/input_conf.h: TOOLS/file2string.pl etc/input.conf
./$^ >$@

libvo/vo_vdpau.c: libvo/vdpau_template.c
libvo/vdpau_template.c: TOOLS/vdpau_functions.py
libvo/vdpau_template.c: TOOLS/vdpau_functions.pl
./$< > $@

libmpdemux/ebml.c libmpdemux/demux_mkv.c: libmpdemux/ebml_types.h
libmpdemux/ebml_types.h: TOOLS/matroska.py
libmpdemux/ebml_types.h: TOOLS/matroska.pl
./$< --generate-header > $@

libmpdemux/ebml.c: libmpdemux/ebml_defs.c
libmpdemux/ebml_defs.c: TOOLS/matroska.py
libmpdemux/ebml_defs.c: TOOLS/matroska.pl
./$< --generate-definitions > $@

libvo/vo_opengl.c: libvo/vo_opengl_shaders.h
libvo/vo_opengl_shaders.h: TOOLS/file2string.py libvo/vo_opengl_shaders.glsl
libvo/vo_opengl_shaders.h: TOOLS/file2string.pl libvo/vo_opengl_shaders.glsl
./$^ >$@

sub/osd_libass.c: sub/osd_font.h
sub/osd_font.h: TOOLS/file2string.py sub/osd_font.pfb
sub/osd_font.h: TOOLS/file2string.pl sub/osd_font.pfb
./$^ >$@

# ./configure must be rerun if it changed
Expand Down
24 changes: 24 additions & 0 deletions TOOLS/file2string.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#! /usr/bin/env perl

use strict;
use warnings;

# Convert the contents of a file into a C string constant.
# Note that the compiler will implicitly add an extra 0 byte at the end
# of every string, so code using the string may need to remove that to get
# the exact contents of the original file.
# FIXME: why not a char array?

# treat only alphanumeric and not-" punctuation as safe
my $unsafe_chars = qr{[^][A-Za-z0-9!#%&'()*+,./:;<=>?^_{|}~ -]};

for my $file (@ARGV) {
open my $fh, '<:raw', $file or next;
print "/* Generated from $file */\n";
while (<$fh>) {
# replace unsafe chars with their equivalent octal escapes
s/($unsafe_chars)/\\@{[sprintf '%03o', ord($1)]}/gos;
print "\"$_\"\n"
}
close $fh;
}
27 changes: 0 additions & 27 deletions TOOLS/file2string.py

This file was deleted.

30 changes: 30 additions & 0 deletions TOOLS/lib/Parse/Matroska.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use 5.008;
use strict;
use warnings;

# ABSTRACT: Module collection to parse Matroska files.
package Parse::Matroska;

=head1 DESCRIPTION

C<use>s L<Parse::Matroska::Reader>. See the documentation
of the modules mentioned in L</"SEE ALSO"> for more information
in how to use this module.

It's intended for this module to contain high-level interfaces
to the other modules in the distribution.

=head1 SOURCE CODE

L<https://github.com/Kovensky/Parse-Matroska>

=head1 SEE ALSO

L<Parse::Matroska::Reader>, L<Parse::Matroska::Element>,
L<Parse::Matroska::Definitions>.

=cut

use Parse::Matroska::Reader;

1;
Loading