~ubuntu-branches/ubuntu/lucid/gmusicbrowser/lucid

« back to all changes in this revision

Viewing changes to flacheader.pm

  • Committer: Bazaar Package Importer
  • Author(s): James Westby, Arnaud Soyez, James Westby
  • Date: 2008-11-27 00:53:40 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20081127005340-odrpldkb6gjs6zdj
Tags: 1.0.1-0ubuntu1
[ Arnaud Soyez ]
* New upstream version. (LP: #302422)

[ James Westby ]
* Drop suggests on flac123 as it has been removed, remove it from the
  description ogg123 in vorbis-tools (already suggested is plays flac)
  (LP: #301652)
* Change gmusicbrowser_123.pm to use ogg123 instead of flac123.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
use warnings;
12
12
our @ISA=('Tag::OGG');
13
13
 
 
14
use bytes;
14
15
use constant
15
16
{ STREAMINFO    => 0,
16
17
  PADDING       => 1,
74
75
 
75
76
}
76
77
 
77
 
sub write_file  # experimental
 
78
sub write_file
78
79
{       my $self=shift;
79
80
        local $_;
80
81
        my ($INfh,$OUTfh);
91
92
                if ($type!=VORBIS_COMMENT && $type!=PADDING)
92
93
                {       $buffer&=0x7fffffff;    #set Last-metadata-block flag to 0
93
94
                        $towrite.=pack 'N',$buffer;
94
 
                        unless (read($fh,$towrite,$size,length($towrite))==$size)
 
95
                        unless (read($fh,$towrite,$size,bytes::length($towrite))==$size)
95
96
                         { warn "flac: Premature end of file\n"; return undef; }
96
97
                }
97
98
                else {$padding+=$size+4; seek $fh,$size,1; }
98
99
        }
99
 
        $padding-=4+length $$newcom_packref;
 
100
        $padding -= 4 + bytes::length $$newcom_packref;
100
101
        my $header=VORBIS_COMMENT;
101
102
        my $inplace=($padding==0 || ($padding>3 && $padding<8192) );
102
103
        #if ($inplace && $padding<4)
106
107
        {       $padding=$inplace? $padding-4 : 256;
107
108
                $padding=pack "Nx$padding",((0x80+PADDING)<<24)+$padding;
108
109
        }
109
 
        $header=pack 'N',($header<<24)+length $$newcom_packref;
 
110
        $header=pack 'N',($header<<24) + bytes::length $$newcom_packref;
110
111
        if ($inplace)
111
112
        {       $self->_close;
112
113
                $fh=$self->_openw or return undef;
200
201
        {       my $nb=$count{$key}++ || 0;
201
202
                my $val=$self->{comments}{$key}[$nb];
202
203
                next unless defined $val;
203
 
                push @comments,$key.'='.$val;
 
204
                push @comments, $key.'='.$val;
204
205
        }
205
206
        my $packet=pack 'V/a* V (V/a*)*',$self->{vorbis_string},scalar @comments,@comments;
206
 
        #$packet.="\x01"; #framing_flag #gstreamer doesn't like it and not needed anyway
 
207
        #$packet.="\x01"; #framing_flag #gstreamer doesn't like it and not needed in flac files anyway
207
208
        return \$packet;
208
209
}
209
210