From: <suc...@us...> - 2007-04-08 14:52:22
|
Revision: 405 http://svn.sourceforge.net/pmplib/?rev=405&view=rev Author: sucknblow Date: 2007-04-08 07:52:22 -0700 (Sun, 08 Apr 2007) Log Message: ----------- Set svn:eol-style to native for source files Modified Paths: -------------- trunk/pmplib/lib/gmi/gmi_mp4v2.c Property Changed: ---------------- trunk/pmplib/lib/gmi/contrib/mp4v2/mp4.h trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip.h trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip_version.h trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip_win32.h trunk/pmplib/lib/gmi/gmi_mp4v2.c Property changes on: trunk/pmplib/lib/gmi/contrib/mp4v2/mp4.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip_version.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/pmplib/lib/gmi/contrib/mp4v2/mpeg4ip_win32.h ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/pmplib/lib/gmi/gmi_mp4v2.c =================================================================== --- trunk/pmplib/lib/gmi/gmi_mp4v2.c 2007-03-06 04:55:33 UTC (rev 404) +++ trunk/pmplib/lib/gmi/gmi_mp4v2.c 2007-04-08 14:52:22 UTC (rev 405) @@ -1,144 +1,144 @@ -/* - * Tag and audio information retrieval by libmp4v2 - * - * Copyright (c) 2005-2007 Naoaki Okazaki - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit - * http://www.gnu.org/copyleft/gpl.html . - * - */ - -/* $Id:$ */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif/*HAVE_CONFIG_H*/ - -#if defined(WIN32) -/* In Win32 version of libmp4v2, <mp4.h> header also includes <winsock2.h> - * header, which cannot coexist with <winsock.h>. Defining _WINSOCKAPI_ will - * prevent from <winsock.h> being referred to by <windows.h>, which is also - * referred to by <os.h> header (Win32 only). Therefore, this definition - * must be placed before including <os.h>. - */ -#define _WINSOCKAPI_ -/* Add Winsock2 library */ -#pragma comment(lib, "ws2_32.lib") -#endif/*defined(WIN32)*/ - -#include <os.h> -#include <limits.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <pmplib/ucs2char.h> -#include <gmi.h> - -#include <mp4.h> - -#ifdef WIN32 -/* Taken from mpeg4ip-1.5.0.1/lib/gnu/need_for_win32.c */ -#include <sys/timeb.h> - -int gettimeofday (struct timeval *t, void *foo) -{ - struct _timeb temp; - _ftime(&temp); - t->tv_sec = temp.time; - t->tv_usec = temp.millitm * 1000; - return (0); -} -#endif/*WIN32*/ - - - -int gmi_mp4v2(media_info_t* info, const ucs2char_t *filename, const char *charset) -{ - int ret = 0; - uint32_t i, num_tracks = 0; - uint16_t numvalue, numvalue2; - char *value = ucs2dupmbs(filename); - MP4FileHandle mp4file = MP4_INVALID_FILE_HANDLE; - - mp4file = MP4Read(value, 0); - ucs2free(value); - if (mp4file == MP4_INVALID_FILE_HANDLE) { - ret = -1; - goto error_exit; - } - - num_tracks = MP4GetNumberOfTracks(mp4file, NULL, 0); - for (i = 0;i < num_tracks;++i) { - uint32_t tid = MP4FindTrackId(mp4file, (u_int16_t)i, NULL, 0); - const char *type = MP4GetTrackType(mp4file, tid); - - if (type && strcmp(type, MP4_AUDIO_TRACK_TYPE) == 0) { - MP4Duration duration = MP4GetTrackDuration(mp4file, tid); - info->num_samples = (uint64_t)duration; - info->duration = (uint32_t)MP4ConvertFromTrackDuration(mp4file, tid, duration, MP4_MSECS_TIME_SCALE); - info->sample_rate = MP4GetTrackTimeScale(mp4file, tid); - info->bitrate = MP4GetTrackBitRate(mp4file, tid); - } - } - - if (MP4GetMetadataName(mp4file, &value) && value != NULL) { - ucs2free(info->title); - info->title = utf8dupucs2(value); - free(value); - } - if (MP4GetMetadataArtist(mp4file, &value) && value != NULL) { - ucs2free(info->artist); - info->artist = utf8dupucs2(value); - free(value); - } - if (MP4GetMetadataAlbum(mp4file, &value) && value != NULL) { - ucs2free(info->album); - info->album = utf8dupucs2(value); - free(value); - } - if (MP4GetMetadataWriter(mp4file, &value) && value != NULL) { - ucs2free(info->composer); - info->composer = utf8dupucs2(value); - free(value); - } - if (MP4GetMetadataGenre(mp4file, &value) && value != NULL) { - ucs2free(info->genre); - info->genre = utf8dupucs2(value); - free(value); - } - if (MP4GetMetadataYear(mp4file, &value) && value != NULL) { - ucs2free(info->date); - info->date = utf8dupucs2(value); - free(value); - } - if (MP4GetMetadataTrack(mp4file, &numvalue, &numvalue2)) { - info->track_number = numvalue; - info->total_tracks = numvalue2; - } - if (MP4GetMetadataDisk(mp4file, &numvalue, &numvalue2)) { - info->disc_number = numvalue; - info->total_discs = numvalue2; - } - - info->codec = PMPCODEC_MPEG4AUDIO; - -error_exit: - if (mp4file != MP4_INVALID_FILE_HANDLE) { - MP4Close(mp4file); - } - return ret; -} +/* + * Tag and audio information retrieval by libmp4v2 + * + * Copyright (c) 2005-2007 Naoaki Okazaki + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit + * http://www.gnu.org/copyleft/gpl.html . + * + */ + +/* $Id:$ */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif/*HAVE_CONFIG_H*/ + +#if defined(WIN32) +/* In Win32 version of libmp4v2, <mp4.h> header also includes <winsock2.h> + * header, which cannot coexist with <winsock.h>. Defining _WINSOCKAPI_ will + * prevent from <winsock.h> being referred to by <windows.h>, which is also + * referred to by <os.h> header (Win32 only). Therefore, this definition + * must be placed before including <os.h>. + */ +#define _WINSOCKAPI_ +/* Add Winsock2 library */ +#pragma comment(lib, "ws2_32.lib") +#endif/*defined(WIN32)*/ + +#include <os.h> +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <pmplib/ucs2char.h> +#include <gmi.h> + +#include <mp4.h> + +#ifdef WIN32 +/* Taken from mpeg4ip-1.5.0.1/lib/gnu/need_for_win32.c */ +#include <sys/timeb.h> + +int gettimeofday (struct timeval *t, void *foo) +{ + struct _timeb temp; + _ftime(&temp); + t->tv_sec = temp.time; + t->tv_usec = temp.millitm * 1000; + return (0); +} +#endif/*WIN32*/ + + + +int gmi_mp4v2(media_info_t* info, const ucs2char_t *filename, const char *charset) +{ + int ret = 0; + uint32_t i, num_tracks = 0; + uint16_t numvalue, numvalue2; + char *value = ucs2dupmbs(filename); + MP4FileHandle mp4file = MP4_INVALID_FILE_HANDLE; + + mp4file = MP4Read(value, 0); + ucs2free(value); + if (mp4file == MP4_INVALID_FILE_HANDLE) { + ret = -1; + goto error_exit; + } + + num_tracks = MP4GetNumberOfTracks(mp4file, NULL, 0); + for (i = 0;i < num_tracks;++i) { + uint32_t tid = MP4FindTrackId(mp4file, (u_int16_t)i, NULL, 0); + const char *type = MP4GetTrackType(mp4file, tid); + + if (type && strcmp(type, MP4_AUDIO_TRACK_TYPE) == 0) { + MP4Duration duration = MP4GetTrackDuration(mp4file, tid); + info->num_samples = (uint64_t)duration; + info->duration = (uint32_t)MP4ConvertFromTrackDuration(mp4file, tid, duration, MP4_MSECS_TIME_SCALE); + info->sample_rate = MP4GetTrackTimeScale(mp4file, tid); + info->bitrate = MP4GetTrackBitRate(mp4file, tid); + } + } + + if (MP4GetMetadataName(mp4file, &value) && value != NULL) { + ucs2free(info->title); + info->title = utf8dupucs2(value); + free(value); + } + if (MP4GetMetadataArtist(mp4file, &value) && value != NULL) { + ucs2free(info->artist); + info->artist = utf8dupucs2(value); + free(value); + } + if (MP4GetMetadataAlbum(mp4file, &value) && value != NULL) { + ucs2free(info->album); + info->album = utf8dupucs2(value); + free(value); + } + if (MP4GetMetadataWriter(mp4file, &value) && value != NULL) { + ucs2free(info->composer); + info->composer = utf8dupucs2(value); + free(value); + } + if (MP4GetMetadataGenre(mp4file, &value) && value != NULL) { + ucs2free(info->genre); + info->genre = utf8dupucs2(value); + free(value); + } + if (MP4GetMetadataYear(mp4file, &value) && value != NULL) { + ucs2free(info->date); + info->date = utf8dupucs2(value); + free(value); + } + if (MP4GetMetadataTrack(mp4file, &numvalue, &numvalue2)) { + info->track_number = numvalue; + info->total_tracks = numvalue2; + } + if (MP4GetMetadataDisk(mp4file, &numvalue, &numvalue2)) { + info->disc_number = numvalue; + info->total_discs = numvalue2; + } + + info->codec = PMPCODEC_MPEG4AUDIO; + +error_exit: + if (mp4file != MP4_INVALID_FILE_HANDLE) { + MP4Close(mp4file); + } + return ret; +} Property changes on: trunk/pmplib/lib/gmi/gmi_mp4v2.c ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |