mp4tag/taglib_mp4filetyperesolver.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002     copyright            : (C) 2005 by Martin Aumueller
00003     email                : aumuell@reserv.at
00004  ***************************************************************************/
00005 
00006 /***************************************************************************
00007  *   This library is free software; you can redistribute it and/or modify  *
00008  *   it  under the terms of the GNU Lesser General Public License version  *
00009  *   2.1 as published by the Free Software Foundation.                     *
00010  *                                                                         *
00011  *   This library is distributed in the hope that it will be useful, but   *
00012  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00014  *   Lesser General Public License for more details.                       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with this library; if not, write to the Free Software   *
00018  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,            *
00019  *   MA  02110-1301  USA                                                   *
00020  ***************************************************************************/
00021 
00022 // (c) 2005 Martin Aumueller <aumuell@reserv.at>
00023 // See COPYING file for licensing information
00024 
00025 #include "taglib_mp4filetyperesolver.h"
00026 #include "mp4file.h"
00027 
00028 TagLib::File *MP4FileTypeResolver::createFile(const char *fileName,
00029         bool readProperties,
00030         TagLib::AudioProperties::ReadStyle propertiesStyle) const
00031 {
00032     const char *ext = strrchr(fileName, '.');
00033     if(ext && (!strcasecmp(ext, ".m4a")
00034                 || !strcasecmp(ext, ".m4b") || !strcasecmp(ext, ".m4p")
00035                 || !strcasecmp(ext, ".mp4")
00036                 || !strcasecmp(ext, ".m4v") || !strcasecmp(ext, ".mp4v")))
00037     {
00038         MP4FileHandle h = MP4Read(fileName, 0);
00039         if(MP4_INVALID_FILE_HANDLE == h)
00040         {
00041             return 0;
00042         }
00043 
00044         return new TagLib::MP4::File(fileName, readProperties, propertiesStyle, h);
00045     }
00046 
00047     return 0;
00048 }

Generated on Mon Aug 6 21:24:20 2007 for plai by  doxygen 1.5.1