~ubuntu-branches/ubuntu/wily/kid3/wily

« back to all changes in this revision

Viewing changes to src/plugins/taglibmetadata/taglibext/mp2/mp2filetyperesolver.cpp

  • Committer: Package Import Robot
  • Author(s): Mark Purcell, Patrick Matthäi, Mark Purcell
  • Date: 2013-11-30 15:44:59 UTC
  • mfrom: (1.1.16) (2.1.18 sid)
  • Revision ID: package-import@ubuntu.com-20131130154459-s6lpalx8yy2zq7gx
Tags: 3.0.2-1
* New upstream release 

[ Patrick Matthäi ]
* New upstream release.
  - Add new libreadline-dev build dependency.
* Don't explicitly request xz compression - dpkg 1.17 does this by default.
* Bump Standards-Version to 3.9.5 (no changes needed).
* Fix Vcs-Browser control field.

[ Mark Purcell ]
* Switch to dh - reduce debian/rules bloat
* kid3 Replaces kid3-qt - low popcon, reduce archive bloat
* Fix vcs-field-not-canonical
* debian/compat -> 9
* Update Description:

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   This library is free software; you can redistribute it and/or modify  *
 
3
 *   it  under the terms of the GNU Lesser General Public License version  *
 
4
 *   2.1 as published by the Free Software Foundation.                     *
 
5
 *                                                                         *
 
6
 *   This library is distributed in the hope that it will be useful, but   *
 
7
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
 
8
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
 
9
 *   Lesser General Public License for more details.                       *
 
10
 *                                                                         *
 
11
 *   You should have received a copy of the GNU Lesser General Public      *
 
12
 *   License along with this library; if not, write to the Free Software   *
 
13
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,            *
 
14
 *   MA  02110-1301  USA                                                   *
 
15
 ***************************************************************************/
 
16
 
 
17
#if defined __GNUC__ && (__GNUC__ * 100 + __GNUC_MINOR__) >= 407
 
18
/** Defined if GCC is used and supports diagnostic pragmas */
 
19
#define GCC_HAS_DIAGNOSTIC_PRAGMA
 
20
#endif
 
21
 
 
22
#ifdef GCC_HAS_DIAGNOSTIC_PRAGMA
 
23
#pragma GCC diagnostic push
 
24
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
 
25
#endif
 
26
 
 
27
#include "mp2filetyperesolver.h"
 
28
#include <mpegfile.h>
 
29
 
 
30
#include <string.h>
 
31
#if (((TAGLIB_MAJOR_VERSION) << 16) + ((TAGLIB_MINOR_VERSION) << 8) + (TAGLIB_PATCH_VERSION)) > 0x010400  && defined _WIN32
 
32
 
 
33
TagLib::File *MP2FileTypeResolver::createFile(TagLib::FileName fileName,
 
34
        bool readProperties,
 
35
        TagLib::AudioProperties::ReadStyle propertiesStyle) const
 
36
{
 
37
    const wchar_t* wstr = static_cast<const wchar_t*>(fileName);
 
38
    const char* str = static_cast<const char*>(fileName);
 
39
    const wchar_t* wext;
 
40
    const char* ext;
 
41
    if ((wstr && (wext = wcsrchr(fileName, L'.')) != 0 && !wcsicmp(wext, L".mp2")) ||
 
42
        (str  && (ext  = strrchr(fileName,  '.')) != 0 && !stricmp(ext, ".mp2")))
 
43
    {
 
44
        return new TagLib::MPEG::File(fileName, readProperties, propertiesStyle);
 
45
    }
 
46
 
 
47
    return 0;
 
48
}
 
49
 
 
50
#else
 
51
 
 
52
TagLib::File *MP2FileTypeResolver::createFile(const char *fileName,
 
53
        bool readProperties,
 
54
        TagLib::AudioProperties::ReadStyle propertiesStyle) const
 
55
{
 
56
    const char *ext = strrchr(fileName, '.');
 
57
    if(ext && !strcasecmp(ext, ".mp2"))
 
58
    {
 
59
        return new TagLib::MPEG::File(fileName, readProperties, propertiesStyle);
 
60
    }
 
61
 
 
62
    return 0;
 
63
}
 
64
 
 
65
#endif
 
66
 
 
67
#ifdef GCC_HAS_DIAGNOSTIC_PRAGMA
 
68
#pragma GCC diagnostic pop
 
69
#endif