~ubuntu-branches/ubuntu/karmic/taglib-extras/karmic

« back to all changes in this revision

Viewing changes to taglib-extras/wav/wavfile.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2009-09-22 12:47:10 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090922124710-6l1av537z7npr7mm
Tags: 1.0.1-0ubuntu1
* New upstream bugfix release
* Closes LP: #431968

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
    copyright            : (C) 2006 by Martin Aumueller
3
 
    email                : aumuell@reserv.at
4
 
 
5
 
    copyright            : (C) 2005 by Andy Leadbetter
6
 
    email                : andrew.leadbetter@gmail.com
7
 
                           (original mp4 implementation)
8
 
 ***************************************************************************/
9
 
 
10
 
/***************************************************************************
11
 
 *   This library is free software; you can redistribute it and/or modify  *
12
 
 *   it  under the terms of the GNU Lesser General Public License version  *
13
 
 *   2.1 as published by the Free Software Foundation.                     *
14
 
 *                                                                         *
15
 
 *   This library is distributed in the hope that it will be useful, but   *
16
 
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
17
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
18
 
 *   Lesser General Public License for more details.                       *
19
 
 *                                                                         *
20
 
 *   You should have received a copy of the GNU Lesser General Public      *
21
 
 *   License along with this library; if not, write to the Free Software   *
22
 
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,            *
23
 
 *   MA  02110-1301  USA                                                   *
24
 
 ***************************************************************************/
25
 
 
26
 
#include "wavfile.h"
27
 
 
28
 
#include <tfile_helper.h>
29
 
#include <audioproperties.h>
30
 
#include <tag.h>
31
 
#include <stdio.h>
32
 
 
33
 
namespace TagLib {
34
 
////////////////////////////////////////////////////////////////////////////////
35
 
// public members
36
 
////////////////////////////////////////////////////////////////////////////////
37
 
 
38
 
Wav::File::File(TagLib::FileName file,
39
 
        bool readProperties,
40
 
        Properties::ReadStyle propertiesStyle,
41
 
        FILE *fp)
42
 
        : TagLib::File(file)
43
 
        , wavtag( NULL )
44
 
        , properties( NULL )
45
 
{
46
 
 
47
 
    //   debug ("Wav::File: create new file object.");
48
 
    //debug ( file );
49
 
 
50
 
    /**
51
 
     * Create the Wav file.
52
 
     */
53
 
 
54
 
    if(fp)
55
 
        wavfile = fp;
56
 
    else
57
 
        wavfile = TagLibOpenFile(file, "rb");
58
 
 
59
 
    if( isOpen() )
60
 
    {
61
 
        read(readProperties, propertiesStyle );
62
 
    }
63
 
}
64
 
 
65
 
Wav::File::~File()
66
 
{
67
 
    if(wavfile)
68
 
        fclose(wavfile);
69
 
    delete properties;
70
 
}
71
 
 
72
 
TagLib::Tag *Wav::File::tag() const
73
 
{
74
 
    return NULL;
75
 
}
76
 
 
77
 
TagLib::Tag *Wav::File::getWavTag() const
78
 
{
79
 
    return NULL;
80
 
}
81
 
 
82
 
Wav::Properties *Wav::File::audioProperties() const
83
 
{
84
 
    return properties;
85
 
}
86
 
 
87
 
bool Wav::File::save()
88
 
{
89
 
    return false;
90
 
}
91
 
 
92
 
bool Wav::File::isOpen()
93
 
{
94
 
    return wavfile != NULL;
95
 
}
96
 
 
97
 
////////////////////////////////////////////////////////////////////////////////
98
 
// private members
99
 
////////////////////////////////////////////////////////////////////////////////
100
 
 
101
 
void Wav::File::read(bool readProperties, Properties::ReadStyle propertiesStyle)
102
 
{
103
 
    properties =  new Wav::Properties(propertiesStyle);
104
 
 
105
 
    if (wavfile != NULL) {
106
 
        if(readProperties)
107
 
        {
108
 
            // Parse bitrate etc.
109
 
            properties->readWavProperties( wavfile );
110
 
        }
111
 
    }
112
 
}
113
 
 
114
 
}