Skip to content

Commit 2aedac3

Browse files
committed
initial import
0 parents  commit 2aedac3

11 files changed

Lines changed: 267 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea/
2+
vendor/

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2012-2013 brainbits GmbH (http://www.brainbits.net)
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Transcoder Bundle [![Build Status](https://travis-ci.org/brainbits/transcoder-bundle.png?branch=master)](https://travis-ci.org/brainbits/transcoder-bundle)
2+
==================
3+
The Transcoder Bundle provides methods to transcode data.

composer.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "brainbits/transcoder-bundle",
3+
"description": "Bundle for encoding, decoding transcoding data.",
4+
"keywords": ["symfony", "encoder", "decoder"],
5+
"homepage": "http://brainbits.net",
6+
"license": "MIT",
7+
"authors": [
8+
{
9+
"name": "Gregor Welters",
10+
"email": "gwelters@brainbits.net"
11+
},
12+
{
13+
"name": "Phillip Look",
14+
"email": "plook@brainbits.net"
15+
}
16+
],
17+
"require": {
18+
"php": ">=5.4.0",
19+
"brainbits/transcoder": ">=1.0.0",
20+
"symfony/framework-bundle": ">=2.1.0"
21+
},
22+
"autoload": {
23+
"psr-0": { "Brainbits": "src/" }
24+
},
25+
"minimum-stability": "stable"
26+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/**
3+
* This file is part of the brainbits transcoderbundle package.
4+
*
5+
* (c) 2012-2013 brainbits GmbH (http://www.brainbits.net)
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace Brainbits\TranscoderBundle;
12+
13+
use Brainbits\TranscoderBundle\DependencyInjection\Compiler\AddDecoderPass;
14+
use Brainbits\TranscoderBundle\DependencyInjection\Compiler\AddEncoderPass;
15+
use Symfony\Component\DependencyInjection\ContainerBuilder;
16+
use Symfony\Component\HttpKernel\Bundle\Bundle;
17+
18+
/**
19+
* brainbits transcoder bundle
20+
*
21+
* @author Phillip Look <plook@brainbits.net>
22+
*/
23+
class BrainbitsTranscoderBundle extends Bundle
24+
{
25+
public function build(ContainerBuilder $container)
26+
{
27+
parent::build($container);
28+
29+
$container->addCompilerPass(new AddDecoderPass());
30+
$container->addCompilerPass(new AddEncoderPass());
31+
}
32+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* This file is part of the brainbits transcoderbundle package.
4+
*
5+
* (c) 2012-2013 brainbits GmbH (http://www.brainbits.net)
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace Brainbits\TranscoderBundle\DependencyInjection;
12+
13+
use Symfony\Component\DependencyInjection\ContainerBuilder;
14+
use Symfony\Component\Config\FileLocator;
15+
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
16+
use Symfony\Component\DependencyInjection\Loader;
17+
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
18+
19+
/**
20+
* This is the class that loads and manages your bundle configuration
21+
*
22+
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
23+
*
24+
* @author Gregor Welters <gwelters@brainbits.net>
25+
*/
26+
class BrainbitsTranscoderExtension extends Extension
27+
{
28+
/**
29+
* {@inheritDoc}
30+
*/
31+
public function load(array $configs, ContainerBuilder $container)
32+
{
33+
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
34+
35+
$loader->load('decoders.xml');
36+
$loader->load('encoders.xml');
37+
$loader->load('services.xml');
38+
}
39+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Brainbits\TranscoderBundle\DependencyInjection\Compiler;
4+
5+
use Symfony\Component\DependencyInjection\ContainerBuilder;
6+
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7+
use Symfony\Component\DependencyInjection\Reference;
8+
9+
class AddDecoderPass implements CompilerPassInterface
10+
{
11+
public function process(ContainerBuilder $container)
12+
{
13+
if (false === $container->hasDefinition('brainbits.transcoder.decoder.resolver')) {
14+
return;
15+
}
16+
17+
$decoders = array();
18+
foreach ($container->findTaggedServiceIds('transcoder.decoder') as $id => $attributes) {
19+
$decoders[] = new Reference($id);
20+
}
21+
22+
$container->getDefinition('brainbits.transcoder.decoder.resolver')->replaceArgument(0, $decoders);
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Brainbits\TranscoderBundle\DependencyInjection\Compiler;
4+
5+
use Symfony\Component\DependencyInjection\ContainerBuilder;
6+
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7+
use Symfony\Component\DependencyInjection\Reference;
8+
9+
class AddEncoderPass implements CompilerPassInterface
10+
{
11+
public function process(ContainerBuilder $container)
12+
{
13+
if (false === $container->hasDefinition('brainbits.transcoder.encoder.resolver')) {
14+
return;
15+
}
16+
17+
$encoders = array();
18+
foreach ($container->findTaggedServiceIds('transcoder.encoder') as $id => $attributes) {
19+
$encoders[] = new Reference($id);
20+
}
21+
22+
$container->getDefinition('brainbits.transcoder.encoder.resolver')->replaceArgument(0, $encoders);
23+
}
24+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
6+
7+
<services>
8+
9+
<service id="brainbits.transcoder.decoder.7z" class="Brainbits\Transcoder\Decoder\SevenzDecoder">
10+
<tag name="transcoder.decoder"/>
11+
</service>
12+
13+
<service id="brainbits.transcoder.decoder.bzip2" class="Brainbits\Transcoder\Decoder\Bzip2Decoder">
14+
<tag name="transcoder.decoder"/>
15+
</service>
16+
17+
<service id="brainbits.transcoder.decoder.deflate" class="Brainbits\Transcoder\Decoder\DeflateDecoder">
18+
<tag name="transcoder.decoder"/>
19+
</service>
20+
21+
<service id="brainbits.transcoder.decoder.gzip" class="Brainbits\Transcoder\Decoder\GzipDecoder">
22+
<tag name="transcoder.decoder"/>
23+
</service>
24+
25+
<service id="brainbits.transcoder.decoder.null" class="Brainbits\Transcoder\Decoder\NullDecoder">
26+
<tag name="transcoder.decoder"/>
27+
</service>
28+
29+
<service id="brainbits.transcoder.decoder.resolver" class="Brainbits\Transcoder\Decoder\DecoderResolver">
30+
<argument type="collection">
31+
<service id="brainbits.transcoder.decoder.7z"></service>
32+
<service id="brainbits.transcoder.decoder.bzip2"></service>
33+
<service id="brainbits.transcoder.decoder.deflate"></service>
34+
<service id="brainbits.transcoder.decoder.gzip"></service>
35+
<service id="brainbits.transcoder.decoder.null"></service>
36+
</argument>
37+
</service>
38+
</services>
39+
40+
</container>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
6+
7+
<services>
8+
9+
<service id="brainbits.transcoder.encoder.7z" class="Brainbits\Transcoder\Encoder\SevenzEncoder">
10+
<tag name="transcoder.encoder"/>
11+
</service>
12+
13+
<service id="brainbits.transcoder.encoder.bzip2" class="Brainbits\Transcoder\Encoder\Bzip2Encoder">
14+
<tag name="transcoder.encoder"/>
15+
</service>
16+
17+
<service id="brainbits.transcoder.encoder.deflate" class="Brainbits\Transcoder\Encoder\DeflateEncoder">
18+
<tag name="transcoder.encoder"/>
19+
</service>
20+
21+
<service id="brainbits.transcoder.encoder.gzip" class="Brainbits\Transcoder\Encoder\GzipEncoder">
22+
<tag name="transcoder.encoder"/>
23+
</service>
24+
25+
<service id="brainbits.transcoder.encoder.null" class="Brainbits\Transcoder\Encoder\NullEncoder">
26+
<tag name="transcoder.encoder"/>
27+
</service>
28+
29+
<service id="brainbits.transcoder.encoder.resolver" class="Brainbits\Transcoder\Encoder\EncoderResolver">
30+
<argument type="collection">
31+
<service id="brainbits.transcoder.encoder.7z"></service>
32+
<service id="brainbits.transcoder.encoder.bzip2"></service>
33+
<service id="brainbits.transcoder.encoder.deflate"></service>
34+
<service id="brainbits.transcoder.encoder.gzip"></service>
35+
<service id="brainbits.transcoder.encoder.null"></service>
36+
</argument>
37+
</service>
38+
39+
</services>
40+
41+
</container>

0 commit comments

Comments
 (0)