X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FIO%2FCompress%2FBrotli.pm;h=05651f770e3e0dc96bb19b0c08d873aeb5d28fec;hb=c4002818175e31a54bd84cac98ac3f82024a8942;hp=9117f704d3a571aa8cfd238d0435b8843fb17ccb;hpb=09cf71869cec48dd79483c65c190f7b79a442da8;p=io-compress-brotli.git
diff --git a/lib/IO/Compress/Brotli.pm b/lib/IO/Compress/Brotli.pm
index 9117f70..05651f7 100644
--- a/lib/IO/Compress/Brotli.pm
+++ b/lib/IO/Compress/Brotli.pm
@@ -3,36 +3,14 @@ package IO::Compress::Brotli;
use 5.014000;
use strict;
use warnings;
+use parent qw/Exporter/;
use IO::Uncompress::Brotli;
-use parent qw/Exporter/;
-
our @EXPORT = qw/bro/;
our @EXPORT_OK = @EXPORT;
-our $VERSION = '0.001001';
-
-sub create {
- my ($class) = @_;
- my $state = BrotliEncoderCreateInstance();
- bless \$state, $class
-}
-
-sub DESTROY {
- my ($self) = @_;
- BrotliEncoderDestroyInstance($$self)
-}
-
-sub quality {
- my ($self, $quality) = @_;
- BrotliEncoderSetQuality($$self, $quality)
-}
-
-sub window {
- my ($self, $window) = @_;
- BrotliEncoderSetWindow($$self, $window)
-}
+our $VERSION = '0.003_001';
my %BROTLI_ENCODER_MODE = ( generic => 0, text => 1, font => 2 );
sub mode {
@@ -41,34 +19,9 @@ sub mode {
die "Invalid encoder mode"
unless $BROTLI_ENCODER_MODE{$mode};
- BrotliEncoderSetMode($$self, $mode)
+ _mode($$self, $mode)
}
-use constant {
- BROTLI_OPERATION_PROCESS => 0,
- BROTLI_OPERATION_FLUSH => 1,
- BROTLI_OPERATION_FINISH => 2
-};
-sub compress {
- my ($self, $data) = @_;
- BrotliEncoderCompressStream($$self, $data, BROTLI_OPERATION_PROCESS )
-}
-
-sub flush {
- my ($self) = @_;
- BrotliEncoderCompressStream($$self, '', BROTLI_OPERATION_FLUSH )
-}
-
-sub finish {
- my ($self) = @_;
- BrotliEncoderCompressStream($$self, '', BROTLI_OPERATION_FINISH )
-}
-
-# Untested, probably not working
-sub set_dictionary {
- my ($self, $dict) = @_;
- BrotliEncoderSetCustomDictionary($$self, $dict)
-}
1;
__END__
@@ -77,7 +30,7 @@ __END__
=head1 NAME
-IO::Compress::Brotli - [Not yet implemented] Write Brotli buffers/streams
+IO::Compress::Brotli - Write Brotli buffers/streams
=head1 SYNOPSIS
@@ -179,9 +132,24 @@ Brotli source code: L
Marius Gavrilescu, Emarius@ieval.roE
+The encoder bindings, modernisation of the decoder bindings and a
+clean up of the overall project were contributed by:
+
+=over
+
+=item Quim Rovira, Equim@rovira.catE
+
+=item Ãvar Arnfjörð Bjarmason, Eavarab@gmail.comE
+
+=item Marcell Szathmári
+
+=item Mattia Barbon, Emattia@barbon.orgE
+
+=back
+
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2015 by Marius Gavrilescu
+Copyright (C) 2015-2017 by Marius Gavrilescu
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.20.2 or,