EXPORT_API
int MMFileFormatIsValidWMA(MMFileIOHandle *pFileIO, const char *mmfileuri, int dummy)
{
-#define _MMFILE_ASF_HEADER_LENGTH 16
- MMFileIOHandle *fp = pFileIO;
- unsigned char buffer[_MMFILE_ASF_HEADER_LENGTH] = {0, };
- int readed = 0;
- int ret = 0;
-
- if (fp == NULL) {
- ret = mmfile_open(&fp, mmfileuri, MMFILE_RDONLY);
- if (ret == MMFILE_IO_FAILED) {
- debug_error(DEBUG, "error: mmfile_open\n");
- goto exit;
- }
- }
-
- mmfile_seek(fp, 0L, MMFILE_SEEK_SET);
-
- readed = mmfile_read(fp, buffer, _MMFILE_ASF_HEADER_LENGTH);
-
- if (_MMFILE_ASF_HEADER_LENGTH != readed) {
- debug_error(RELEASE, "read error. size = %d. Maybe end of file.\n", readed);
-
- ret = 0;
- goto exit;
- }
-
- if (1 == _MMFileIsASFHeader(buffer)) {
- debug_msg(RELEASE, "Header Detected\n");
- ret = 1;
- goto exit;
- }
-
-exit:
- if (pFileIO == NULL && fp != NULL)
- mmfile_close(fp);
-
- return ret;
+ return MMFileFormatIsValidASF(pFileIO, mmfileuri, dummy);
}
EXPORT_API
int MMFileFormatIsValidWMV(MMFileIOHandle *pFileIO, const char *mmfileuri, int dummy)
{
-#define _MMFILE_ASF_HEADER_LENGTH 16
- MMFileIOHandle *fp = pFileIO;
- unsigned char buffer[_MMFILE_ASF_HEADER_LENGTH] = {0, };
- int readed = 0;
- int ret = 0;
-
- if (fp == NULL) {
- ret = mmfile_open(&fp, mmfileuri, MMFILE_RDONLY);
- if (ret == MMFILE_IO_FAILED) {
- debug_error(DEBUG, "error: mmfile_open\n");
- goto exit;
- }
- }
-
- mmfile_seek(fp, 0L, MMFILE_SEEK_SET);
-
- readed = mmfile_read(fp, buffer, _MMFILE_ASF_HEADER_LENGTH);
-
- if (_MMFILE_ASF_HEADER_LENGTH != readed) {
- debug_error(RELEASE, "read error. size = %d. Maybe end of file.\n", readed);
- ret = 0;
- goto exit;
- }
-
- if (1 == _MMFileIsASFHeader(buffer)) {
- debug_msg(RELEASE, "Header Detected\n");
- ret = 1;
- goto exit;
- }
-
-exit:
- if (pFileIO == NULL && fp != NULL)
- mmfile_close(fp);
-
- return ret;
+ return MMFileFormatIsValidASF(pFileIO, mmfileuri, dummy);
}