Ejemplo n.º 1
0
            public MetaBlock?NextMetaBlock()
            {
                if (IsDifferent)
                {
                    return(transformingReader.NextMetaBlock());
                }

                var original    = originalReader.NextMetaBlock();
                var transformed = transformingReader.NextMetaBlock();

                if (!ReferenceEquals(original, transformed))  // if the references have not changed, there was no transformation
                {
                    IsDifferent = true;
                }

                return(transformed);
            }
Ejemplo n.º 2
0
        public MetaBlock?NextMetaBlock()
        {
            if (transformedQueue.Count == 0)
            {
                transformedState = original.State; // update state to match start of the next meta-block

                var metaBlock = original.NextMetaBlock();

                if (metaBlock != null)
                {
                    var(transformedMetaBlocks, newTransformedState) = BrotliEncodePipeline.ApplyTransformerChain(transformedState, metaBlock, compressionParameters, transformers);

                    foreach (var transformedMetaBlock in transformedMetaBlocks)
                    {
                        transformedQueue.Enqueue(transformedMetaBlock);
                    }

                    transformedState = newTransformedState;
                }
            }

            return(transformedQueue.TryDequeue(out var next) ? next : null);
        }