return MMFILE_CODEC_SUCCESS;
exception:
- if (codecObject) mmfile_free(codecObject);
+ mmfile_free(codecObject);
return ret;
}
if (codecContext->Decode) codecContext->Decode = NULL;
if (codecContext->Close) codecContext->Close = NULL;
- if (codecContext->privateData) mmfile_free(codecContext->privateData);
+
+ mmfile_free(codecContext->privateData);
mmfile_free(codecContext);
return MMFILE_CODEC_SUCCESS;
inline static void mm_file_free_AvFileContentInfo(AvFileContentInfo *pInfo)
{
if (pInfo) {
- if (pInfo->pToc) mmfile_free(pInfo->pToc);
- if (pInfo->pTitle) mmfile_free(pInfo->pTitle);
- if (pInfo->pArtist) mmfile_free(pInfo->pArtist);
- if (pInfo->pAuthor) mmfile_free(pInfo->pAuthor);
- if (pInfo->pCopyright) mmfile_free(pInfo->pCopyright);
- /*if (pInfo->pDescription) mmfile_free(pInfo->pDescription); */
- if (pInfo->pComment) mmfile_free(pInfo->pComment);
- if (pInfo->pRating) mmfile_free(pInfo->pRating);
- if (pInfo->pAlbum) mmfile_free(pInfo->pAlbum);
- if (pInfo->pAlbum_Artist) mmfile_free(pInfo->pAlbum_Artist);
- if (pInfo->pYear) mmfile_free(pInfo->pYear);
- if (pInfo->pGenre) mmfile_free(pInfo->pGenre);
- if (pInfo->pTrackNum) mmfile_free(pInfo->pTrackNum);
- if (pInfo->pRecDate) mmfile_free(pInfo->pRecDate);
- if (pInfo->pContentGroup) mmfile_free(pInfo->pContentGroup);
- if (pInfo->pEncBy) mmfile_free(pInfo->pEncBy);
- if (pInfo->pURL) mmfile_free(pInfo->pURL);
- if (pInfo->pOriginArtist) mmfile_free(pInfo->pOriginArtist);
- if (pInfo->pComposer) mmfile_free(pInfo->pComposer);
- if (pInfo->imageInfo.pImageBuf) mmfile_free(pInfo->imageInfo.pImageBuf);
+ mmfile_free(pInfo->pToc);
+ mmfile_free(pInfo->pTitle);
+ mmfile_free(pInfo->pArtist);
+ mmfile_free(pInfo->pAuthor);
+ mmfile_free(pInfo->pCopyright);
+ /* mmfile_free(pInfo->pDescription); */
+ mmfile_free(pInfo->pComment);
+ mmfile_free(pInfo->pRating);
+ mmfile_free(pInfo->pAlbum);
+ mmfile_free(pInfo->pAlbum_Artist);
+ mmfile_free(pInfo->pYear);
+ mmfile_free(pInfo->pGenre);
+ mmfile_free(pInfo->pTrackNum);
+ mmfile_free(pInfo->pRecDate);
+ mmfile_free(pInfo->pContentGroup);
+ mmfile_free(pInfo->pEncBy);
+ mmfile_free(pInfo->pURL);
+ mmfile_free(pInfo->pOriginArtist);
+ mmfile_free(pInfo->pComposer);
+ mmfile_free(pInfo->imageInfo.pImageBuf);
}
}
failure:
- if (tagBuff) {
- mmfile_free(tagBuff);
- tagBuff = NULL;
- }
+ mmfile_free(tagBuff);
return ret;
-
}
}
}
- if (formatContext->streams[MMFILE_AUDIO_STREAM]) {
- mmfile_free(formatContext->streams[MMFILE_AUDIO_STREAM]);
- formatContext->streams[MMFILE_AUDIO_STREAM] = NULL;
- }
+ mmfile_free(formatContext->streams[MMFILE_AUDIO_STREAM]);
formatContext->ReadStream = NULL;
formatContext->ReadFrame = NULL;
}
}
- if (formatContext->streams[MMFILE_AUDIO_STREAM]) {
- mmfile_free(formatContext->streams[MMFILE_AUDIO_STREAM]);
- formatContext->streams[MMFILE_AUDIO_STREAM] = NULL;
- }
+ mmfile_free(formatContext->streams[MMFILE_AUDIO_STREAM]);
formatContext->ReadStream = NULL;
formatContext->ReadFrame = NULL;
if (formatContext->filesrc->type == MM_FILE_SRC_TYPE_MEMORY) {
if (avio_ctx_buffer)
av_free(avio_ctx_buffer);
- if (handle)
- mmfile_free(handle);
+
+ mmfile_free(handle);
+
if (pIOCtx)
av_free(pIOCtx);
if (pFormatCtx)
return MMFILE_FORMAT_SUCCESS;
exception:
- if (videoStream) {
- mmfile_free(videoStream);
- formatContext->streams[MMFILE_VIDEO_STREAM] = NULL;
- }
+ mmfile_free(videoStream);
+ mmfile_free(audioStream);
- if (audioStream) {
- mmfile_free(audioStream);
- formatContext->streams[MMFILE_AUDIO_STREAM] = NULL;
- }
+ formatContext->streams[MMFILE_VIDEO_STREAM] = NULL;
+ formatContext->streams[MMFILE_AUDIO_STREAM] = NULL;
if (pFormatCtx) {
avformat_close_input(&pFormatCtx);
if ((pkt.data != NULL) && (pkt.size > 0)) {
/*Set mime type*/
- if (formatContext->artworkMime) mmfile_free(formatContext->artworkMime);
+ mmfile_free(formatContext->artworkMime);
if (codec_id == AV_CODEC_ID_MJPEG)
formatContext->artworkMime = mmfile_strdup("image/jpeg");
debug_error(DEBUG, "Unknown cover type: 0x%x\n", codec_id);
/*Copy artwork*/
- if (formatContext->artwork) mmfile_free(formatContext->artwork);
+ mmfile_free(formatContext->artwork);
formatContext->artworkSize = pkt.size;
formatContext->artwork = mmfile_malloc(pkt.size);
/* set mime type */
current_pos = POS_OF_MIME_LEN + DATA_LENGTH; /*current position is mime type */
- if (formatContext->artworkMime) mmfile_free(formatContext->artworkMime);
+ mmfile_free(formatContext->artworkMime);
formatContext->artworkMime = strndup((const char *)meta_data + current_pos, mime_len);
/* set art work data */
current_pos = mime_len + description_len + (DATA_LENGTH * 8); /*current position is picture data */
- if (formatContext->artwork) mmfile_free(formatContext->artwork);
+ mmfile_free(formatContext->artwork);
formatContext->artwork = mmfile_malloc(data_len);
if (formatContext->artwork != NULL)
exception:
if (pVideoCodecCtx) avcodec_free_context(&pVideoCodecCtx);
- if (frame->frameData) {
- mmfile_free(frame->frameData);
- frame->frameData = NULL;
- }
+ mmfile_free(frame->frameData);
+
if (pFrame) av_frame_free(&pFrame);
return ret;
if (ret == MMFILE_IO_FAILED) {
debug_error(DEBUG, "error: mmfile_open\n");
- if (fp)
- mmfile_close(fp);
+ mmfile_close(fp);
return MMFILE_FORMAT_FAIL;
}
*format = -1;
- if (fp)
- mmfile_close(fp);
+ mmfile_close(fp);
return MMFILE_FORMAT_FAIL;
FILE_FORMAT_SUCCESS:
- if (fp)
- mmfile_close(fp);
+ mmfile_close(fp);
return MMFILE_FORMAT_SUCCESS;
}
return MMFILE_FORMAT_SUCCESS;
exception:
- if (*frame) {
- mmfile_free(*frame);
- *frame = NULL;
- }
+ mmfile_free(*frame);
+
if (pFrame) av_frame_free(&pFrame);
if (pVideoCodecCtx) avcodec_free_context(&pVideoCodecCtx);
if (isDone) {
if (!strncmp(imy_key_buffer, "NAME", 4)) {
- if (tags->title != NULL)
- mmfile_free(tags->title);
+ mmfile_free(tags->title);
tags->title = mmfile_strdup(imy_value_buffer);
} else if (!strncmp(imy_key_buffer, "COMPOSER", 8)) {
- if (tags->composer != NULL)
- mmfile_free(tags->composer);
+ mmfile_free(tags->composer);
tags->composer = mmfile_strdup(imy_value_buffer);
} else if (!strncmp(imy_key_buffer, "COPYRIGHT", 9)) {
- if (tags->copyright != NULL)
- mmfile_free(tags->copyright);
+ mmfile_free(tags->copyright);
tags->copyright = mmfile_strdup(imy_value_buffer);
}
return buf;
failed:
- if (buf) mmfile_free(buf);
- if (fp) mmfile_close(fp);
+ mmfile_free(buf);
+ mmfile_close(fp);
return NULL;
}
return MMFILE_FORMAT_FAIL;
}
- if (formatContext->streams[MMFILE_AUDIO_STREAM]) {
- mmfile_free(formatContext->streams[MMFILE_AUDIO_STREAM]);
- formatContext->streams[MMFILE_AUDIO_STREAM] = NULL;
- }
+ mmfile_free(formatContext->streams[MMFILE_AUDIO_STREAM]);
formatContext->ReadStream = NULL;
formatContext->ReadFrame = NULL;
mmfile_format_free_midi_infomation(MIDI_INFO_SIMPLE *info)
{
if (info) {
- if (info->title) mmfile_free(info->title);
- if (info->copyright) mmfile_free(info->copyright);
- if (info->comment) mmfile_free(info->comment);
+ mmfile_free(info->title);
+ mmfile_free(info->copyright);
+ mmfile_free(info->comment);
mmfile_free(info);
}
}
_RELEASE_RESOURCE:
mmfile_close(fp);
-
- if (buf) mmfile_free(buf);
+ mmfile_free(buf);
return ret_msec;
}
bufLen = pInfo->fileLen - pInfo->tagV2Info.tagLen;
if (IS_ID3V2_TAG(buf)) {
-
-
if (pInfo->tagV2Info.tagVersion == 0x02) {
-
if (!mm_file_id3tag_parse_v222(pInfo, buf))
pInfo->tagV2Info.tagLen = 0;
} else if (pInfo->tagV2Info.tagVersion == 0x03) {
-
if (!mm_file_id3tag_parse_v223(pInfo, buf))
pInfo->tagV2Info.tagLen = 0;
} else if (pInfo->tagV2Info.tagVersion == 0x04) {
-
if (!mm_file_id3tag_parse_v224(pInfo, buf)) /* currently 2.4 ver pased by 2.3 routine */
pInfo->tagV2Info.tagLen = 0;
} else {
}
if (__AvParseMp3Header(pInfo, pHeader) == false) {
/*return -1; */
- if (pHeader)
- _FREE_EX(pHeader);
+ mmfile_free(pHeader);
debug_warning(DEBUG, "Mp3 parse header failed & index(%d)\n", index);
buf++;
index++;
}
if (pInfo->bVbr) {
- if (pHeader)
- _FREE_EX(pHeader);
+ mmfile_free(pHeader);
bFoundSync = true;
break;
} else {
if (__AvIsValidHeader(pInfo, pHeader)) {
- if (pHeader)
- _FREE_EX(pHeader);
+ mmfile_free(pHeader);
__AvGetMp3FrameSize(pInfo);
pInfo->datafileLen = pInfo->fileLen - pInfo->headerPos;
debug_warning(DEBUG, "Is not vaild header pHeader\n");
}
}
- if (pHeader)
- _FREE_EX(pHeader);
+ mmfile_free(pHeader);
} else {
debug_warning(RELEASE, "Mp3 file frist byte is 0xff, but not header sync\n");
}
index++;
}
- _FREE_EX(pHeader);
+ mmfile_free(pHeader);
if (mmfile_seek(hFile, 0, SEEK_SET) < 0) {
debug_error(DEBUG, "seek error!\n");
}
} else {
debug_error(DEBUG, "v2TagExistCheck value read fail!\n");
- if (v2TagExistCheck)
- _FREE_EX(v2TagExistCheck);
+ mmfile_free(v2TagExistCheck);
goto EXCEPTION;
}
- if (v2TagExistCheck)
- _FREE_EX(v2TagExistCheck);
+ mmfile_free(v2TagExistCheck);
if (!(pInfo->fileLen > pInfo->tagV2Info.tagLen))
pInfo->tagV2Info.tagLen = 0;
while (readAmount > 0) {
if (readAmount >= AV_MP3_HEADER_READ_MAX) {
if ((readedDataLen <= _AV_MP3_HEADER_POSITION_MAX + pInfo->tagV2Info.tagLen) && (mmfile_read(hFile, buf + readedDataLen, AV_MP3_HEADER_READ_MAX) <= 0)) {
- if (buf)
- _FREE_EX(buf);
+ mmfile_free(buf);
goto EXCEPTION;
} else {
}
} else {
if ((readedDataLen <= _AV_MP3_HEADER_POSITION_MAX + pInfo->tagV2Info.tagLen) && (mmfile_read(hFile, buf + readedDataLen, readAmount) <= 0)) {
- if (buf)
- _FREE_EX(buf);
+ mmfile_free(buf);
goto EXCEPTION;
} else {
}
if (mmfile_read(hFile, buf, pInfo->fileLen) <= 0) {
- if (buf)
- _FREE_EX(buf);
+ mmfile_free(buf);
goto EXCEPTION;
}
}
debug_msg(RELEASE, "Header Pos: %ld\n", pInfo->headerPos);
- if (buf)
- _FREE_EX(buf);
+ mmfile_free(buf);
if (pInfo->headerPos == -1)
goto EXCEPTION;
tMMFileTagsData *privateData = tagsHandle;
if (privateData) {
- if (privateData->fp) {
- mmfile_close(privateData->fp);
- }
-
- if (privateData->tagList) {
- mmfile_free(privateData->tagList);
- }
-
+ mmfile_close(privateData->fp);
+ mmfile_free(privateData->tagList);
mmfile_free(privateData);
}
return MMFILE_FORMAT_FAIL;
}
- if (formatContext->privateFormatData)
- mmfile_free(formatContext->privateFormatData);
+ mmfile_free(formatContext->privateFormatData);
return MMFILE_FORMAT_SUCCESS;
}
return header;
failed:
- if (header) mmfile_free(header);
- if (fp) mmfile_close(fp);
+ mmfile_free(header);
+ mmfile_close(fp);
return NULL;
}
if (formatContext->ReadTag) formatContext->ReadTag = NULL;
if (formatContext->Close) formatContext->Close = NULL;
- if (formatContext->uriFileName) mmfile_free(formatContext->uriFileName);
- if (formatContext->title) mmfile_free(formatContext->title);
- if (formatContext->artist) mmfile_free(formatContext->artist);
- if (formatContext->author) mmfile_free(formatContext->author);
- if (formatContext->composer) mmfile_free(formatContext->composer);
- if (formatContext->album) mmfile_free(formatContext->album);
- if (formatContext->album_artist) mmfile_free(formatContext->album_artist);
- if (formatContext->copyright) mmfile_free(formatContext->copyright);
- if (formatContext->description) mmfile_free(formatContext->description);
- if (formatContext->comment) mmfile_free(formatContext->comment);
- if (formatContext->genre) mmfile_free(formatContext->genre);
- if (formatContext->classification) mmfile_free(formatContext->classification);
- if (formatContext->year) mmfile_free(formatContext->year);
- if (formatContext->recDate) mmfile_free(formatContext->recDate);
- if (formatContext->tagTrackNum) mmfile_free(formatContext->tagTrackNum);
- if (formatContext->rating) mmfile_free(formatContext->rating);
- if (formatContext->artworkMime) mmfile_free(formatContext->artworkMime);
- if (formatContext->artwork) mmfile_free(formatContext->artwork);
- if (formatContext->conductor) mmfile_free(formatContext->conductor);
- if (formatContext->unsyncLyrics) mmfile_free(formatContext->unsyncLyrics);
- if (formatContext->rotate) mmfile_free(formatContext->rotate);
- if (formatContext->stereoMode) mmfile_free(formatContext->stereoMode);
- if (formatContext->stitchingSoftware) mmfile_free(formatContext->stitchingSoftware);
- if (formatContext->projectionType) mmfile_free(formatContext->projectionType);
- if (formatContext->metadataSourceV2) mmfile_free(formatContext->metadataSourceV2);
+ mmfile_free(formatContext->uriFileName);
+ mmfile_free(formatContext->title);
+ mmfile_free(formatContext->artist);
+ mmfile_free(formatContext->author);
+ mmfile_free(formatContext->composer);
+ mmfile_free(formatContext->album);
+ mmfile_free(formatContext->album_artist);
+ mmfile_free(formatContext->copyright);
+ mmfile_free(formatContext->description);
+ mmfile_free(formatContext->comment);
+ mmfile_free(formatContext->genre);
+ mmfile_free(formatContext->classification);
+ mmfile_free(formatContext->year);
+ mmfile_free(formatContext->recDate);
+ mmfile_free(formatContext->tagTrackNum);
+ mmfile_free(formatContext->rating);
+ mmfile_free(formatContext->artworkMime);
+ mmfile_free(formatContext->artwork);
+ mmfile_free(formatContext->conductor);
+ mmfile_free(formatContext->unsyncLyrics);
+ mmfile_free(formatContext->rotate);
+ mmfile_free(formatContext->stereoMode);
+ mmfile_free(formatContext->stitchingSoftware);
+ mmfile_free(formatContext->projectionType);
+ mmfile_free(formatContext->metadataSourceV2);
if (clean_all) /*syncLyrics has to be freed in mm_file_destroy_tag_attrs() except abnormal status */
- if (formatContext->syncLyrics) mm_file_free_synclyrics_list(formatContext->syncLyrics);
+ mm_file_free_synclyrics_list(formatContext->syncLyrics);
- if (formatContext->privateFormatData) mmfile_free(formatContext->privateFormatData);
- if (formatContext->privateCodecData) mmfile_free(formatContext->privateCodecData);
+ mmfile_free(formatContext->privateFormatData);
+ mmfile_free(formatContext->privateCodecData);
if (formatContext->nbStreams > 0) {
int i = 0;
/*formatContext->streams[0] is video, formatContext->streams[1] is audio.*/
- if (formatContext->streams[0]) mmfile_free(formatContext->streams[0]);
- if (formatContext->streams[1]) mmfile_free(formatContext->streams[1]);
+ mmfile_free(formatContext->streams[0]);
+ mmfile_free(formatContext->streams[1]);
for (i = 2; (i < formatContext->nbStreams) && (i < MAXSTREAMS); i++) {
- if (formatContext->streams[i]) mmfile_free(formatContext->streams[i]);
+ mmfile_free(formatContext->streams[i]);
}
}
if (formatContext->thumbNail) {
- if (formatContext->thumbNail->frameData)
- mmfile_free(formatContext->thumbNail->frameData);
-
- if (formatContext->thumbNail->configData)
- mmfile_free(formatContext->thumbNail->configData);
-
+ mmfile_free(formatContext->thumbNail->frameData);
+ mmfile_free(formatContext->thumbNail->configData);
mmfile_free(formatContext->thumbNail);
}
*formatEnum = -1;
- if (fp)
- mmfile_close(fp);
+ mmfile_close(fp);
return MMFILE_FORMAT_FAIL;
FILE_FORMAT_SUCCESS:
- if (fp)
- mmfile_close(fp);
+ mmfile_close(fp);
return MMFILE_FORMAT_SUCCESS;
}
_CleanupFrameContext(formatContext, clean_all);
- if (formatContext)
- mmfile_free(formatContext);
+ mmfile_free(formatContext);
return MMFILE_FORMAT_SUCCESS;
}
_info_set_attr_media(attrs, formatContext);
if (frameContext.bCompressed) {
- if (frameContext.frameData) mmfile_free(frameContext.frameData);
- if (frameContext.configData) mmfile_free(frameContext.configData);
+ mmfile_free(frameContext.frameData);
+ mmfile_free(frameContext.configData);
if (decodedFrame.frameData) {
mmfile_free(decodedFrame.frameData);
formatContext->commandType = MM_FILE_CONTENTS;
if (frameContext.bCompressed) {
- if (frameContext.frameData)
- mmfile_free(frameContext.frameData);
-
- if (frameContext.configData)
- mmfile_free(frameContext.configData);
+ mmfile_free(frameContext.frameData);
+ mmfile_free(frameContext.configData);
if (decodedFrame.frameData) {
mmfile_free(decodedFrame.frameData);
exception:
if (frameContext.bCompressed) {
- if (frameContext.frameData)
mmfile_free(frameContext.frameData);
-
- if (frameContext.configData)
mmfile_free(frameContext.configData);
if (decodedFrame.frameData) {
}
ret = mm_attrs_get_data_by_name(tag_attrs, MM_FILE_TAG_ARTWORK, &artwork);
-
- if (artwork != NULL) {
- mmfile_free(artwork);
- }
+ mmfile_free(artwork);
ret = mm_attrs_get_data_by_name(tag_attrs, MM_FILE_TAG_SYNCLYRICS, (void **)&synclyrics_list);
-
- if (synclyrics_list != NULL) {
- mm_file_free_synclyrics_list(synclyrics_list);
- }
-
+ mm_file_free_synclyrics_list(synclyrics_list);
mmf_attrs_free(tag_attrs);
debug_fleave(RELEASE);
}
ret = mm_attrs_get_data_by_name(contents_attrs, MM_FILE_CONTENT_VIDEO_THUMBNAIL, &thumbnail);
- if (thumbnail != NULL) {
- mmfile_free(thumbnail);
- }
+ mmfile_free(thumbnail);
mmf_attrs_free(contents_attrs);
Name: libmm-fileinfo
Summary: Media Fileinfo
-Version: 0.6.74
+Version: 0.6.75
Release: 0
Group: System/Libraries
License: Apache-2.0
#define MMFILE_AVIO_BUFFER_LEN 32768
#define MMFILE_RDONLY O_RDONLY
-#define MMFILE_WRONLY O_WRONLY
-#define MMFILE_RDWR O_RDWR
#define MMFILE_SEEK_SET SEEK_SET
#define MMFILE_SEEK_CUR SEEK_CUR
#define MM_FILE_REVERSE_BYTE_ORDER_INT(i) ((int)((((i)&0xFF000000)>>24) | (((i)&0x00FF0000)>>8) | (((i)&0x0000FF00)<<8) | (((i)&0x000000FF)<<24)))
#define MM_FILE_REVERSE_BYTE_ORDER_SHORT(s) ((short)((((s)&0xFF00)>>8) | (((s)&0x00FF)<<8)))
-#define _FREE_EX(ptr) { if ((ptr)) {mmfile_free((ptr)); (ptr) = NULL; } }
#define _STRNCPY_EX(dst, src, size) { if ((size > 0)) {strncpy((char*)(dst), (char*)(src), (size)); *((dst) + (size)) = '\0'; } }
inline static int __AvMemstr(unsigned char *mem, unsigned char *str, int str_len, int search_range)
inline static void mm_file_free_AvFileContentInfo(AvFileContentInfo *pInfo)
{
if (pInfo) {
- if (pInfo->pToc) mmfile_free(pInfo->pToc);
- if (pInfo->pTitle) mmfile_free(pInfo->pTitle);
- if (pInfo->pArtist) mmfile_free(pInfo->pArtist);
- if (pInfo->pAuthor) mmfile_free(pInfo->pAuthor);
- if (pInfo->pCopyright) mmfile_free(pInfo->pCopyright);
- if (pInfo->pDescription) mmfile_free(pInfo->pDescription);
- if (pInfo->pComment) mmfile_free(pInfo->pComment);
- if (pInfo->pRating) mmfile_free(pInfo->pRating);
- if (pInfo->pAlbum) mmfile_free(pInfo->pAlbum);
- if (pInfo->pAlbum_Artist) mmfile_free(pInfo->pAlbum_Artist);
- if (pInfo->pYear) mmfile_free(pInfo->pYear);
- if (pInfo->pGenre) mmfile_free(pInfo->pGenre);
- if (pInfo->pTrackNum) mmfile_free(pInfo->pTrackNum);
- if (pInfo->pRecDate) mmfile_free(pInfo->pRecDate);
- if (pInfo->pConductor) mmfile_free(pInfo->pConductor);
- if (pInfo->pContentGroup) mmfile_free(pInfo->pContentGroup);
- if (pInfo->pEncBy) mmfile_free(pInfo->pEncBy);
- if (pInfo->pURL) mmfile_free(pInfo->pURL);
- if (pInfo->pOriginArtist) mmfile_free(pInfo->pOriginArtist);
- if (pInfo->pComposer) mmfile_free(pInfo->pComposer);
- if (pInfo->pUnsyncLyrics) mmfile_free(pInfo->pUnsyncLyrics);
- if (pInfo->imageInfo.pImageBuf) mmfile_free(pInfo->imageInfo.pImageBuf);
- if (pInfo->imageInfo.imageDescription) mmfile_free(pInfo->imageInfo.imageDescription);
- if (strlen(pInfo->imageInfo.imageMIMEType) > 0) memset(pInfo->imageInfo.imageMIMEType, 0, MP3_ID3_IMAGE_MIME_TYPE_MAX_LENGTH);
+ mmfile_free(pInfo->pToc);
+ mmfile_free(pInfo->pTitle);
+ mmfile_free(pInfo->pArtist);
+ mmfile_free(pInfo->pAuthor);
+ mmfile_free(pInfo->pCopyright);
+ mmfile_free(pInfo->pDescription);
+ mmfile_free(pInfo->pComment);
+ mmfile_free(pInfo->pRating);
+ mmfile_free(pInfo->pAlbum);
+ mmfile_free(pInfo->pAlbum_Artist);
+ mmfile_free(pInfo->pYear);
+ mmfile_free(pInfo->pGenre);
+ mmfile_free(pInfo->pTrackNum);
+ mmfile_free(pInfo->pRecDate);
+ mmfile_free(pInfo->pConductor);
+ mmfile_free(pInfo->pContentGroup);
+ mmfile_free(pInfo->pEncBy);
+ mmfile_free(pInfo->pURL);
+ mmfile_free(pInfo->pOriginArtist);
+ mmfile_free(pInfo->pComposer);
+ mmfile_free(pInfo->pUnsyncLyrics);
+ mmfile_free(pInfo->imageInfo.pImageBuf);
+ mmfile_free(pInfo->imageInfo.imageDescription);
+ if (strlen(pInfo->imageInfo.imageMIMEType) > 0)
+ memset(pInfo->imageInfo.imageMIMEType, 0, MP3_ID3_IMAGE_MIME_TYPE_MAX_LENGTH);
}
}
int mmfile_read(MMFileIOHandle *handle, unsigned char *buf, int size)
{
int ret = 0;
- if (!handle || (handle->flags & MMFILE_WRONLY)) {
+ if (!handle) {
return MMFILE_IO_FAILED;
}
int mmfile_write(MMFileIOHandle *handle, unsigned char *buf, int size)
{
int ret = 0;
- if (!handle || !(handle->flags & (MMFILE_WRONLY | MMFILE_RDWR))) {
+ if (!handle) {
return MMFILE_IO_FAILED;
}
ret = handle->iofunc->mmfile_close(handle);
- if (handle->fileName) {
- mmfile_free(handle->fileName);
- }
-
- if (handle) mmfile_free(handle);
+ mmfile_free(handle->fileName);
+ mmfile_free(handle);
return ret;
}
static int file_open(MMFileIOHandle *handle, const char *filename, int flags)
{
tMMFORMAT_FILEIO_DATA *privateData = NULL;
- int access = 0;
+ int access = O_RDONLY;
int fd = 0;
if (!handle || !filename) {
filename += strlen(handle->iofunc->handleName) + 3; /* :// */
- if (flags & MMFILE_RDWR) {
- access = O_CREAT | O_TRUNC | O_RDWR;
- } else if (flags & MMFILE_WRONLY) {
- access = O_CREAT | O_TRUNC | O_WRONLY;
- } else {
- access = O_RDONLY;
- }
-
#ifdef O_BINARY
access |= O_BINARY;
#endif
- fd = open(filename, access, 0666);
+ fd = open(filename, access);
if (fd < 0) {
debug_error(DEBUG, "open error\n");
return MMFILE_IO_FAILED;
static int file_close(MMFileIOHandle *handle)
{
tMMFORMAT_FILEIO_DATA *privateData = handle->privateData;
- /*int ret = 0;*/
if (privateData) {
- /*ret = */close(privateData->fd);
+ close(privateData->fd);
mmfile_free(privateData);
handle->privateData = NULL;
return MMFILE_IO_SUCCESS;
}
#if 0 /*dead code */
- if (memHandle) {
- mmfile_free(memHandle);
- handle->privateData = NULL;
- }
+ mmfile_free(memHandle);
#endif
return MMFILE_IO_FAILED;
{
MMFMMapIOHandle *mmapHandle = NULL;
struct stat finfo = {0, };
- int access = 0;
+ int access = O_RDONLY;
if (!handle || !filename || !handle->iofunc || !handle->iofunc->handleName) {
debug_error(DEBUG, "invalid param\n");
return MMFILE_IO_FAILED;
}
- if (flags & MMFILE_RDWR) {
- access = O_CREAT | O_TRUNC | O_RDWR;
- } else if (flags & MMFILE_WRONLY) {
- access = O_CREAT | O_TRUNC | O_WRONLY;
- } else {
- access = O_RDONLY;
- }
-
#ifdef O_BINARY
access |= O_BINARY;
#endif
- mmapHandle->fd = open(filename, access, 0666);
+ mmapHandle->fd = open(filename, access);
if (mmapHandle->fd < 0) {
debug_error(DEBUG, "error: open error: %s\n", filename);
goto exception;
mmapHandle->offset = 0;
mmapHandle->state = 0;
- if (flags & MMFILE_RDWR) {
- /*mmapHandle->ptr = mmap64(0, mmapHandle->size, PROT_WRITE | PROT_READ, MAP_SHARED, mmapHandle->fd, 0); */
- mmapHandle->ptr = mmap(0, mmapHandle->size, PROT_WRITE | PROT_READ, MAP_SHARED, mmapHandle->fd, 0);
- } else if (flags & MMFILE_WRONLY) {
- /*mmapHandle->ptr = mmap64(0, mmapHandle->size, PROT_WRITE, MAP_SHARED, mmapHandle->fd, 0); */
- mmapHandle->ptr = mmap(0, mmapHandle->size, PROT_WRITE, MAP_SHARED, mmapHandle->fd, 0);
- } else {
- /*mmapHandle->ptr = mmap64(0, mmapHandle->size, PROT_READ, MAP_SHARED, mmapHandle->fd, 0); */
- mmapHandle->ptr = mmap(0, mmapHandle->size, PROT_READ, MAP_SHARED, mmapHandle->fd, 0);
- }
+ /*mmapHandle->ptr = mmap64(0, mmapHandle->size, PROT_READ, MAP_SHARED, mmapHandle->fd, 0); */
+ mmapHandle->ptr = mmap(0, mmapHandle->size, PROT_READ, MAP_SHARED, mmapHandle->fd, 0);
if (mmapHandle->ptr == (void *)-1) {
debug_error(DEBUG, "error: mmap\n");
texttag.text = NULL;
mmfile_seek(fp, basic_header->start_offset + basic_header->size, SEEK_SET);
- _FREE_EX(temp_text);
+ mmfile_free(temp_text);
return MMFILE_UTIL_SUCCESS;
exception:
mmfile_seek(fp, basic_header->start_offset + basic_header->size, SEEK_SET);
- if (texttag.text) {
- mmfile_free(texttag.text);
- }
+ mmfile_free(texttag.text);
+
return ret;
}
if (!formatContext->album)
formatContext->album = temp_text;
else
- _FREE_EX(temp_text);
+ mmfile_free(temp_text);
debug_msg(RELEASE, "formatContext->album=%s, strlen=%d\n", formatContext->album, strlen(formatContext->album));
}
}
exit:
- if (fp)
- mmfile_close(fp);
+ mmfile_close(fp);
if (buffer)
free(buffer);
tmp_genre_len = strlen(tmp_genre);
if (tmp_genre_len > 0) {
- if (pInfo->pGenre) _FREE_EX(pInfo->pGenre);
+ mmfile_free(pInfo->pGenre);
pInfo->pGenre = mmfile_malloc(sizeof(char) * (tmp_genre_len + 1));
if (pInfo->pGenre) {
SAFE_STRLCPY(pInfo->pGenre, tmp_genre, tmp_genre_len + 1);
needToloopv2taglen = MP3_TAGv2_22_TXT_HEADER_LEN;
}
- if (pExtContent) _FREE_EX(pExtContent);
+ mmfile_free(pExtContent);
memset(CompTmp, 0, 4);
if (curPos < taglen) {
needToloopv2taglen -= oneFrameLen;
debug_msg(RELEASE, "this text string(%s) encoded by ISO-8859-1 encodingOffSet(%d)\n", CompTmp, encodingOffSet);
}
- if (pExtContent) _FREE_EX(pExtContent);
+ mmfile_free(pExtContent);
if (encodingOffSet < purelyFramelen) {
realCpyFrameNum = purelyFramelen - encodingOffSet;
} else {
char_set = mmfile_get_charset((const char *)&pExtContent[tmp]);
}
- _FREE_EX(lang_info);
+ mmfile_free(lang_info);
}
if (char_set == NULL) {
pInfo->pUnsyncLyrics = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->unsynclyricsLen);
} else {
pInfo->pUnsyncLyrics = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", char_set, NULL, (unsigned int *)&pInfo->unsynclyricsLen);
- _FREE_EX(char_set);
+ mmfile_free(char_set);
}
} else {
debug_msg(RELEASE, "failed to get Unsynchronised lyrics Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
tmp_genre_len = strlen(tmp_genre);
if (tmp_genre_len > 0) {
- if (pInfo->pGenre) _FREE_EX(pInfo->pGenre);
+ mmfile_free(pInfo->pGenre);
pInfo->pGenre = mmfile_malloc(sizeof(char) * (tmp_genre_len + 1));
if (pInfo->pGenre) {
SAFE_STRLCPY(pInfo->pGenre, tmp_genre, tmp_genre_len + 1);
debug_msg(RELEASE, "This Frame's size is Zero! purelyFramelen(%lu)\n", purelyFramelen);
}
- if (pExtContent) _FREE_EX(pExtContent);
+ mmfile_free(pExtContent);
memset(CompTmp, 0, 4);
if (curPos < taglen) {
}
}
- if (pExtContent) _FREE_EX(pExtContent);
+ mmfile_free(pExtContent);
if (encodingOffSet < purelyFramelen) {
realCpyFrameNum = purelyFramelen - encodingOffSet;
tmp_genre_len = strlen(tmp_genre);
if (tmp_genre_len > 0) {
- if (pInfo->pGenre) _FREE_EX(pInfo->pGenre);
+ mmfile_free(pInfo->pGenre);
pInfo->pGenre = mmfile_malloc(sizeof(char) * (tmp_genre_len + 1));
if (pInfo->pGenre) {
SAFE_STRLCPY(pInfo->pGenre, tmp_genre, tmp_genre_len + 1);
needToloopv2taglen = MP3_TAGv2_23_TXT_HEADER_LEN;
}
- if (pExtContent) _FREE_EX(pExtContent);
+ mmfile_free(pExtContent);
memset(CompTmp, 0, 4);
if (curPos < taglen) {
needToloopv2taglen -= oneFrameLen;
}
}
- if (pInfo->pGenre) _FREE_EX(pInfo->pGenre);
+ mmfile_free(pInfo->pGenre);
/*tmpinx = 0;*/
if (mpegAudioGenre != NULL) {
} else {
debug_msg(RELEASE, "mpegAudioGenre = %s\n", mpegAudioGenre);
}
- if (mpegAudioGenre)
- _FREE_EX(mpegAudioGenre);
+ mmfile_free(mpegAudioGenre);
} else {
debug_msg(RELEASE, "Neither ID3 v1 nor v2 info doesn't have Genre Info.\n");