From ef9f832fb3ecc5c639387d9af71dcafbbed2ff70 Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Thu, 6 May 2004 18:49:04 +0000 Subject: mp4/aac now use InputStream git-svn-id: https://svn.musicpd.org/mpd/trunk@925 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/tag.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/tag.c') diff --git a/src/tag.c b/src/tag.c index 42124adfd..ccd7b421e 100644 --- a/src/tag.c +++ b/src/tag.c @@ -26,6 +26,7 @@ #include "utils.h" #include "utf8.h" #include "log.h" +#include "inputStream.h" #include #include @@ -209,7 +210,7 @@ MpdTag * aacTagDup(char * utf8file) { MpdTag * mp4DataDup(char * utf8file, int * mp4MetadataFound) { MpdTag * ret = NULL; - FILE * fh; + InputStream inStream; mp4ff_t * mp4fh; mp4ff_callback_t * cb; int32_t track; @@ -217,28 +218,29 @@ MpdTag * mp4DataDup(char * utf8file, int * mp4MetadataFound) { int32_t scale; *mp4MetadataFound = 0; - - fh = fopen(rmp2amp(utf8ToFsCharset(utf8file)),"r"); - if(!fh) { + + if(openInputStreamFromFile(&inStream,rmp2amp(utf8ToFsCharset(utf8file))) + < 0) + { return NULL; } cb = malloc(sizeof(mp4ff_callback_t)); - cb->read = mp4_readCallback; - cb->seek = mp4_seekCallback; - cb->user_data = fh; + cb->read = mp4_inputStreamReadCallback; + cb->seek = mp4_inputStreamSeekCallback; + cb->user_data = &inStream; mp4fh = mp4ff_open_read(cb); if(!mp4fh) { free(cb); - fclose(fh); + closeInputStream(&inStream); return NULL; } track = mp4_getAACTrack(mp4fh); if(track < 0) { mp4ff_close(mp4fh); - fclose(fh); + closeInputStream(&inStream); free(cb); return NULL; } @@ -248,7 +250,7 @@ MpdTag * mp4DataDup(char * utf8file, int * mp4MetadataFound) { scale = mp4ff_time_scale(mp4fh,track); if(scale < 0) { mp4ff_close(mp4fh); - fclose(fh); + closeInputStream(&inStream); free(cb); freeMpdTag(ret); return NULL; @@ -272,7 +274,7 @@ MpdTag * mp4DataDup(char * utf8file, int * mp4MetadataFound) { } mp4ff_close(mp4fh); - fclose(fh); + closeInputStream(&inStream); free(cb); return ret; -- cgit v1.2.3