~ubuntu-branches/ubuntu/wily/smplayer/wily

« back to all changes in this revision

Viewing changes to zlib-1.2.6/contrib/ada/buffer_demo.adb

  • Committer: Package Import Robot
  • Author(s): Maia Kozheva, Maia Kozheva, Alessio Treglia
  • Date: 2012-04-14 12:01:57 UTC
  • mfrom: (1.1.13)
  • mto: (20.2.1 sid)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: package-import@ubuntu.com-20120414120157-mndwobcslgisomso
[ Maia Kozheva ]
* New upstream release:
  - Changes since 0.7.1:
    + A toolbar editor has been added. Now it's possible to select the
      buttons and controls that want to appear in the toolbars.
    + New video filters: gradfun, blur and sharpen.
    + Now it's possible to change the GUI (default, mini, mpc) at runtime,
      no restart required.
    + sub files from opensubtitles should work again.
    + (Youtube) Recognize short urls (like this one:
      http://y2u.be/F5OcZBVPwOA)
    + Better support for chapters in video files.
    + Bug fix: remote m3u files work from the favorites menu or command line.
    + Internal changes in the single instance option (switch to 
      QtSingleApplication).
  - Fixes since 0.7.0:
    + SMPlayer took more than 10 seconds to show when running for the very
      first time.
    + The links to download subtitles from Opensubtitles were wrong.
    + SMPlayer crashed in the favorite editor when trying to select a file
      if the KDE open dialog was used.
  - Changes since 0.7.0:
    + By default the screenshots are saved in the user's pictures folder
      instead of the SMPlayer's config folder.
    + Now it's possible to change the opensubtitles server.
    + Youtube: seeking is slow with flv videos, so now flv videos have the
      lowest priority.
    + Youtube: now it's possible to search and download videos from youtube.
      This is provided by an external application (in linux you have to
      install an independent package: smtube).
* debian/copyright:
  - Rewrite according to DEP-5 specification.
* debian/control:
  - Depend on mplayer2 | mplayer. (Closes: #638279)
  - Update Standards-Version to 3.9.3.
* Remove debian/patches/handle_local_urls.diff, merged upstream.

[ Alessio Treglia ]
* Mention smplayer is also a front-end for MPlayer2.
* Fix small typo in the description.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
----------------------------------------------------------------
 
2
--  ZLib for Ada thick binding.                               --
 
3
--                                                            --
 
4
--  Copyright (C) 2002-2004 Dmitriy Anisimkov                 --
 
5
--                                                            --
 
6
--  Open source license information is in the zlib.ads file.  --
 
7
----------------------------------------------------------------
 
8
--
 
9
--  $Id: buffer_demo.adb,v 1.3 2004/09/06 06:55:35 vagul Exp $
 
10
 
 
11
--  This demo program provided by Dr Steve Sangwine <sjs@essex.ac.uk>
 
12
--
 
13
--  Demonstration of a problem with Zlib-Ada (already fixed) when a buffer
 
14
--  of exactly the correct size is used for decompressed data, and the last
 
15
--  few bytes passed in to Zlib are checksum bytes.
 
16
 
 
17
--  This program compresses a string of text, and then decompresses the
 
18
--  compressed text into a buffer of the same size as the original text.
 
19
 
 
20
with Ada.Streams; use Ada.Streams;
 
21
with Ada.Text_IO;
 
22
 
 
23
with ZLib; use ZLib;
 
24
 
 
25
procedure Buffer_Demo is
 
26
   EOL  : Character renames ASCII.LF;
 
27
   Text : constant String
 
28
     := "Four score and seven years ago our fathers brought forth," & EOL &
 
29
        "upon this continent, a new nation, conceived in liberty," & EOL &
 
30
        "and dedicated to the proposition that `all men are created equal'.";
 
31
 
 
32
   Source : Stream_Element_Array (1 .. Text'Length);
 
33
   for Source'Address use Text'Address;
 
34
 
 
35
begin
 
36
   Ada.Text_IO.Put (Text);
 
37
   Ada.Text_IO.New_Line;
 
38
   Ada.Text_IO.Put_Line
 
39
     ("Uncompressed size : " & Positive'Image (Text'Length) & " bytes");
 
40
 
 
41
   declare
 
42
      Compressed_Data : Stream_Element_Array (1 .. Text'Length);
 
43
      L               : Stream_Element_Offset;
 
44
   begin
 
45
      Compress : declare
 
46
         Compressor : Filter_Type;
 
47
         I : Stream_Element_Offset;
 
48
      begin
 
49
         Deflate_Init (Compressor);
 
50
 
 
51
         --  Compress the whole of T at once.
 
52
 
 
53
         Translate (Compressor, Source, I, Compressed_Data, L, Finish);
 
54
         pragma Assert (I = Source'Last);
 
55
 
 
56
         Close (Compressor);
 
57
 
 
58
         Ada.Text_IO.Put_Line
 
59
           ("Compressed size :   "
 
60
            & Stream_Element_Offset'Image (L) & " bytes");
 
61
      end Compress;
 
62
 
 
63
      --  Now we decompress the data, passing short blocks of data to Zlib
 
64
      --  (because this demonstrates the problem - the last block passed will
 
65
      --  contain checksum information and there will be no output, only a
 
66
      --  check inside Zlib that the checksum is correct).
 
67
 
 
68
      Decompress : declare
 
69
         Decompressor : Filter_Type;
 
70
 
 
71
         Uncompressed_Data : Stream_Element_Array (1 .. Text'Length);
 
72
 
 
73
         Block_Size : constant := 4;
 
74
         --  This makes sure that the last block contains
 
75
         --  only Adler checksum data.
 
76
 
 
77
         P : Stream_Element_Offset := Compressed_Data'First - 1;
 
78
         O : Stream_Element_Offset;
 
79
      begin
 
80
         Inflate_Init (Decompressor);
 
81
 
 
82
         loop
 
83
            Translate
 
84
              (Decompressor,
 
85
               Compressed_Data
 
86
                 (P + 1 .. Stream_Element_Offset'Min (P + Block_Size, L)),
 
87
               P,
 
88
               Uncompressed_Data
 
89
                 (Total_Out (Decompressor) + 1 .. Uncompressed_Data'Last),
 
90
               O,
 
91
               No_Flush);
 
92
 
 
93
               Ada.Text_IO.Put_Line
 
94
                 ("Total in : " & Count'Image (Total_In (Decompressor)) &
 
95
                  ", out : " & Count'Image (Total_Out (Decompressor)));
 
96
 
 
97
               exit when P = L;
 
98
         end loop;
 
99
 
 
100
         Ada.Text_IO.New_Line;
 
101
         Ada.Text_IO.Put_Line
 
102
           ("Decompressed text matches original text : "
 
103
             & Boolean'Image (Uncompressed_Data = Source));
 
104
      end Decompress;
 
105
   end;
 
106
end Buffer_Demo;