AAC_PROFILE_SSR,
AAC_PROFILE_LTP,
AAC_PROFILE_UNKNOWN
-}TAacProfileType;
+} TAacProfileType;
typedef void* MMFileAACHandle;
} AvID3v2EncodingType;
-typedef struct{
+typedef struct {
char *pImageBuf;
char imageDescription[MP3_ID3_IMAGE_DESCRIPTION_MAX_LENGTH];
char imageMIMEType[MP3_ID3_IMAGE_MIME_TYPE_MAX_LENGTH];
int pictureType;
int imageLen;
int imgDesLen;
- int imgMimetypeLen;
- bool bURLInfo;
+ int imgMimetypeLen;
+ bool bURLInfo;
} AvTagVer2ImageInfo;
- typedef struct{
+typedef struct {
int tagLen;
char tagVersion;
int recdateLen;
/* for PC Studio Podcast */
- int contentGroupLen;
+ int contentGroupLen;
/* for ID3V2 Tag */
int encbyLen;
int composerLen;
/* To send resolution info to appl from OEM */
- int width;
- int height;
+ int width;
+ int height;
unsigned int bitRate;
unsigned int sampleRate;
char *pYear;
char *pGenre;
char *pTrackNum; /*Track number/Position in set */
- char *pRecDate; /*Recording dates */
+ char *pRecDate; /*Recording dates */
/* for PC Studio Podcast */
char *pContentGroup;
typedef struct {
int videocodec;
int audiocodec;
- int width;
- int height;
+ int width;
+ int height;
} AvExtraInfo;
inline static void mm_file_free_AvFileContentInfo(AvFileContentInfo *pInfo)
/* Array to Number conversions */
#define GET_INT_NUMBER(buff) (int)((((int)(buff)[0]) << 24) | \
- (((int)(buff)[1]) << 16) | \
- (((int)(buff)[2]) << 8) | \
- (((int)(buff)[3])))
+ (((int)(buff)[1]) << 16) | \
+ (((int)(buff)[2]) << 8) | \
+ (((int)(buff)[3])))
#define GET_SHORT_NUMBER(buff) (short)(((short)(buff)[0] << 8) | \
- ((short)(buff)[1]))
+ ((short)(buff)[1]))
/*Index table for Sampling frequency */
const int Sampling_freq_table[16] = { 96000, 88200, 64000, 48000,
- 44100, 32000, 24000, 22050,
- 16000, 12000, 11025, 8000,
- 0, 0, 0, 0
- };
+ 44100, 32000, 24000, 22050,
+ 16000, 12000, 11025, 8000,
+ 0, 0, 0, 0
+ };
/* internal APIs */
void _aac_init_handle(tMMFILE_AAC_HANDLE *privateData);
pData->tagInfoSize = MP3_TAGv2_HEADER_LEN;
pData->tagInfoSize += (((encSize & 0x0000007F) >> 0) | ((encSize & 0x00007F00) >> 1) | \
- ((encSize & 0x007F0000) >> 2) | ((encSize & 0x7F000000) >> 3));
+ ((encSize & 0x007F0000) >> 2) | ((encSize & 0x7F000000) >> 3));
if (pData->tagInfoSize > pData->streamInfo.fileSize) {
debug_msg(RELEASE, "Invalid size");
}
switch (hTag->tagV2Info.tagVersion) {
- case 1:
- ret = mm_file_id3tag_parse_v110(hTag, tagBuff);
- break;
- case 2:
- ret = mm_file_id3tag_parse_v222(hTag, tagBuff);
- break;
- case 3:
- ret = mm_file_id3tag_parse_v223(hTag, tagBuff);
- break;
- case 4:
- ret = mm_file_id3tag_parse_v224(hTag, tagBuff);
- break;
- default:
- debug_error(DEBUG, "Invalid Tag version [%d]\n", hTag->tagV2Info.tagVersion);
- break;
+ case 1:
+ ret = mm_file_id3tag_parse_v110(hTag, tagBuff);
+ break;
+ case 2:
+ ret = mm_file_id3tag_parse_v222(hTag, tagBuff);
+ break;
+ case 3:
+ ret = mm_file_id3tag_parse_v223(hTag, tagBuff);
+ break;
+ case 4:
+ ret = mm_file_id3tag_parse_v224(hTag, tagBuff);
+ break;
+ default:
+ debug_error(DEBUG, "Invalid Tag version [%d]\n", hTag->tagV2Info.tagVersion);
+ break;
}
if (ret == FALSE) {
debug_msg(RELEASE, "\nFILE POS: %lld\n", filePosBefore);
debug_msg(RELEASE, "\nADTS HEADER: [%2x] [%2x] [%2x] [%2x] [%2x] [%2x]\n",
- adtsHeader[0], adtsHeader[1], adtsHeader[2], adtsHeader[3], adtsHeader[4], adtsHeader[5]);
+ adtsHeader[0], adtsHeader[1], adtsHeader[2], adtsHeader[3], adtsHeader[4], adtsHeader[5]);
if (mmfile_tell(pData->hFile) >= pData->streamInfo.fileSize) {
*frameLen = 0;
EXPORT_API
-int mmfile_format_read_frame_aac(MMFileFormatContext *formatContext,
- unsigned int timestamp, MMFileFormatFrame *frame)
+int mmfile_format_read_frame_aac(MMFileFormatContext *formatContext, unsigned int timestamp, MMFileFormatFrame *frame)
{
debug_error(DEBUG, "error: mmfile_format_read_frame_aac, no handling\n");
}
debug_msg(RELEASE, "\nAMR HEADER: [%2x] [%2x] [%2x] [%2x] [%2x]\n \
- [%2x] [%2x] [%2x] [%2x] [%2x]\n \
- [%2x] [%2x] [%2x] [%2x] [%2x]\n",
- header[0], header[1], header[2], header[3], header[4],
- header[5], header[6], header[7], header[8], header[9],
- header[10], header[11], header[12], header[13], header[14]);
+ [%2x] [%2x] [%2x] [%2x] [%2x]\n \
+ [%2x] [%2x] [%2x] [%2x] [%2x]\n",
+ header[0], header[1], header[2], header[3], header[4],
+ header[5], header[6], header[7], header[8], header[9],
+ header[10], header[11], header[12], header[13], header[14]);
if (!(memcmp(header, MMFILE_AMR_SINGLE_CH_HEADER, MMFILE_AMR_SINGLE_CH_HEADER_SIZE))) {
pData->amrFormat = AMR_FORMAT_NB;
goto exception;
}
- debug_msg(RELEASE, "AMR Format Type: %s\n", \
- privateData->amrFormat == AMR_FORMAT_NB ? "AMR-NB" : "AMR-WB");
+ debug_msg(RELEASE, "AMR Format Type: %s\n", privateData->amrFormat == AMR_FORMAT_NB ? "AMR-NB" : "AMR-WB");
*handle = privateData;
EXPORT_API
-int mmfile_format_read_frame_amr(MMFileFormatContext *formatContext,
- unsigned int timestamp, MMFileFormatFrame *frame)
+int mmfile_format_read_frame_amr(MMFileFormatContext *formatContext, unsigned int timestamp, MMFileFormatFrame *frame)
{
debug_error(DEBUG, "error: mmfile_format_read_frame_amr, no handling\n");
memHandle = opaque;
switch (whence) {
- case SEEK_SET:
- tmp_offset = 0 + pos;
- break;
- case SEEK_CUR:
- tmp_offset = memHandle->offset + pos;
- break;
- case SEEK_END:
- tmp_offset = memHandle->size + pos;
- break;
- case AVSEEK_SIZE: /*FFMPEG specific*/
- return memHandle->size;
- default:
- return MMFILE_UTIL_FAIL;
+ case SEEK_SET:
+ tmp_offset = 0 + pos;
+ break;
+ case SEEK_CUR:
+ tmp_offset = memHandle->offset + pos;
+ break;
+ case SEEK_END:
+ tmp_offset = memHandle->size + pos;
+ break;
+ case AVSEEK_SIZE: /*FFMPEG specific*/
+ return memHandle->size;
+ default:
+ return MMFILE_UTIL_FAIL;
}
/*check validation*/
videoStream->bitRate = pVideoCodecCtx->bit_rate;
}
}
- }
- else if (pFormatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
+ } else if (pFormatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
if (formatContext->audioStreamId == -1) {
audioStream = mmfile_malloc(sizeof(MMFileFormatStream));
if (NULL == audioStream) {
} else {
if (avcodec_get_type(pFormatCtx->streams[pkt.stream_index]->codecpar->codec_id) == AVMEDIA_TYPE_VIDEO) {
v++;
- if ((pkt.flags & AV_PKT_FLAG_KEY) || (key_detected == 1))
- {
+ if ((pkt.flags & AV_PKT_FLAG_KEY) || (key_detected == 1)) {
debug_msg(RELEASE, "video frame: %d, %d, %d\n", retry, i, v);
#ifdef __MMFILE_TEST_MODE__
_dump_av_packet(&pkt);
int ret_codecid = 0;
switch (AVVideoCodecID) {
- case AV_CODEC_ID_NONE:
- ret_codecid = MM_VIDEO_CODEC_NONE;
- break;
- case AV_CODEC_ID_MPEG1VIDEO:
- ret_codecid = MM_VIDEO_CODEC_MPEG1;
- break;
- case AV_CODEC_ID_MPEG2VIDEO: /*/< preferred ID for MPEG-1/2 video decoding */
- case AV_CODEC_ID_MPEG2VIDEO_XVMC:
- case AV_CODEC_ID_MPEG2TS:
- ret_codecid = MM_VIDEO_CODEC_MPEG2;
- break;
- case AV_CODEC_ID_H261:
- ret_codecid = MM_VIDEO_CODEC_H261;
- break;
- case AV_CODEC_ID_H263:
- ret_codecid = MM_VIDEO_CODEC_H263;
- break;
- case AV_CODEC_ID_MPEG4:
- ret_codecid = MM_VIDEO_CODEC_MPEG4;
- break;
- case AV_CODEC_ID_MSMPEG4V1:
- ret_codecid = MM_VIDEO_CODEC_MPEG4;
- break;
- case AV_CODEC_ID_MSMPEG4V2:
- ret_codecid = MM_VIDEO_CODEC_MPEG4;
- break;
- case AV_CODEC_ID_MSMPEG4V3:
- ret_codecid = MM_VIDEO_CODEC_MPEG4;
- break;
- case AV_CODEC_ID_WMV1:
- ret_codecid = MM_VIDEO_CODEC_WMV;
- break;
- case AV_CODEC_ID_WMV2:
- ret_codecid = MM_VIDEO_CODEC_WMV;
- break;
- case AV_CODEC_ID_H263P:
- ret_codecid = MM_VIDEO_CODEC_H263;
- break;
- case AV_CODEC_ID_H263I:
- ret_codecid = MM_VIDEO_CODEC_H263;
- break;
- case AV_CODEC_ID_FLV1:
- ret_codecid = MM_VIDEO_CODEC_FLV;
- break;
- case AV_CODEC_ID_H264:
- ret_codecid = MM_VIDEO_CODEC_H264;
- break;
- case AV_CODEC_ID_INDEO2:
- case AV_CODEC_ID_INDEO3:
- case AV_CODEC_ID_INDEO4:
- case AV_CODEC_ID_INDEO5:
- ret_codecid = MM_VIDEO_CODEC_INDEO;
- break;
- case AV_CODEC_ID_THEORA:
- ret_codecid = MM_VIDEO_CODEC_THEORA;
- break;
- case AV_CODEC_ID_CINEPAK:
- ret_codecid = MM_VIDEO_CODEC_CINEPAK;
- break;
- case AV_CODEC_ID_VC1:
- ret_codecid = MM_VIDEO_CODEC_VC1;
- break;
- case AV_CODEC_ID_WMV3:
- ret_codecid = MM_VIDEO_CODEC_WMV;
- break;
- case AV_CODEC_ID_AVS:
- ret_codecid = MM_VIDEO_CODEC_AVS;
- break;
- case AV_CODEC_ID_RL2:
- case AV_CODEC_ID_RV10: /* RealVideo 1 */
- case AV_CODEC_ID_RV20: /* RealVideo 2 */
- case AV_CODEC_ID_RV30: /* RealVideo 3 */
- case AV_CODEC_ID_RV40: /* RealVideo 4 */
- ret_codecid = MM_VIDEO_CODEC_REAL;
- break;
+ case AV_CODEC_ID_NONE:
+ ret_codecid = MM_VIDEO_CODEC_NONE;
+ break;
+ case AV_CODEC_ID_MPEG1VIDEO:
+ ret_codecid = MM_VIDEO_CODEC_MPEG1;
+ break;
+ case AV_CODEC_ID_MPEG2VIDEO: /*/< preferred ID for MPEG-1/2 video decoding */
+ case AV_CODEC_ID_MPEG2VIDEO_XVMC:
+ case AV_CODEC_ID_MPEG2TS:
+ ret_codecid = MM_VIDEO_CODEC_MPEG2;
+ break;
+ case AV_CODEC_ID_H261:
+ ret_codecid = MM_VIDEO_CODEC_H261;
+ break;
+ case AV_CODEC_ID_H263:
+ ret_codecid = MM_VIDEO_CODEC_H263;
+ break;
+ case AV_CODEC_ID_MPEG4:
+ ret_codecid = MM_VIDEO_CODEC_MPEG4;
+ break;
+ case AV_CODEC_ID_MSMPEG4V1:
+ ret_codecid = MM_VIDEO_CODEC_MPEG4;
+ break;
+ case AV_CODEC_ID_MSMPEG4V2:
+ ret_codecid = MM_VIDEO_CODEC_MPEG4;
+ break;
+ case AV_CODEC_ID_MSMPEG4V3:
+ ret_codecid = MM_VIDEO_CODEC_MPEG4;
+ break;
+ case AV_CODEC_ID_WMV1:
+ ret_codecid = MM_VIDEO_CODEC_WMV;
+ break;
+ case AV_CODEC_ID_WMV2:
+ ret_codecid = MM_VIDEO_CODEC_WMV;
+ break;
+ case AV_CODEC_ID_H263P:
+ ret_codecid = MM_VIDEO_CODEC_H263;
+ break;
+ case AV_CODEC_ID_H263I:
+ ret_codecid = MM_VIDEO_CODEC_H263;
+ break;
+ case AV_CODEC_ID_FLV1:
+ ret_codecid = MM_VIDEO_CODEC_FLV;
+ break;
+ case AV_CODEC_ID_H264:
+ ret_codecid = MM_VIDEO_CODEC_H264;
+ break;
+ case AV_CODEC_ID_INDEO2:
+ case AV_CODEC_ID_INDEO3:
+ case AV_CODEC_ID_INDEO4:
+ case AV_CODEC_ID_INDEO5:
+ ret_codecid = MM_VIDEO_CODEC_INDEO;
+ break;
+ case AV_CODEC_ID_THEORA:
+ ret_codecid = MM_VIDEO_CODEC_THEORA;
+ break;
+ case AV_CODEC_ID_CINEPAK:
+ ret_codecid = MM_VIDEO_CODEC_CINEPAK;
+ break;
+ case AV_CODEC_ID_VC1:
+ ret_codecid = MM_VIDEO_CODEC_VC1;
+ break;
+ case AV_CODEC_ID_WMV3:
+ ret_codecid = MM_VIDEO_CODEC_WMV;
+ break;
+ case AV_CODEC_ID_AVS:
+ ret_codecid = MM_VIDEO_CODEC_AVS;
+ break;
+ case AV_CODEC_ID_RL2:
+ case AV_CODEC_ID_RV10: /* RealVideo 1 */
+ case AV_CODEC_ID_RV20: /* RealVideo 2 */
+ case AV_CODEC_ID_RV30: /* RealVideo 3 */
+ case AV_CODEC_ID_RV40: /* RealVideo 4 */
+ ret_codecid = MM_VIDEO_CODEC_REAL;
+ break;
#ifdef __MMFILE_LIBAV_VERSION__
- case AV_CODEC_ID_HEVC:
- ret_codecid = MM_VIDEO_CODEC_MPEG4;
- break;
+ case AV_CODEC_ID_HEVC:
+ ret_codecid = MM_VIDEO_CODEC_MPEG4;
+ break;
#endif
- default:
- ret_codecid = MM_VIDEO_CODEC_NONE;
- break;
+ default:
+ ret_codecid = MM_VIDEO_CODEC_NONE;
+ break;
}
return ret_codecid;
int ret_codecid = 0;
switch (AVAudioCodecID) {
- case AV_CODEC_ID_AMR_NB:
- case AV_CODEC_ID_AMR_WB:
- ret_codecid = MM_AUDIO_CODEC_AMR;
- break;
- /* RealAudio codecs*/
- case AV_CODEC_ID_RA_144: /* RealAudio 1 */
- case AV_CODEC_ID_RA_288: /* RealAudio 2 */
- case AV_CODEC_ID_COOK: /* RealAudio 6 */
- ret_codecid = MM_AUDIO_CODEC_REAL;
- break;
- case AV_CODEC_ID_MP2:
- ret_codecid = MM_AUDIO_CODEC_MP2;
- break;
- case AV_CODEC_ID_MP3:
- case AV_CODEC_ID_MP3ADU:
- case AV_CODEC_ID_MP3ON4:
- ret_codecid = MM_AUDIO_CODEC_MP3;
- break;
- case AV_CODEC_ID_AAC:
- ret_codecid = MM_AUDIO_CODEC_AAC;
- break;
- case AV_CODEC_ID_AC3:
- ret_codecid = MM_AUDIO_CODEC_AC3;
- break;
- case AV_CODEC_ID_VORBIS:
- ret_codecid = MM_AUDIO_CODEC_VORBIS;
- break;
- case AV_CODEC_ID_WMAV1:
- case AV_CODEC_ID_WMAV2:
- case AV_CODEC_ID_WMAVOICE:
- case AV_CODEC_ID_WMAPRO:
- case AV_CODEC_ID_WMALOSSLESS:
- ret_codecid = MM_AUDIO_CODEC_WMA;
- break;
- case AV_CODEC_ID_FLAC:
- ret_codecid = MM_AUDIO_CODEC_FLAC;
- break;
- case AV_CODEC_ID_ALAC:
- ret_codecid = MM_AUDIO_CODEC_ALAC;
- break;
- case AV_CODEC_ID_WAVPACK:
- ret_codecid = MM_AUDIO_CODEC_WAVE;
- break;
- case AV_CODEC_ID_ATRAC3:
- case AV_CODEC_ID_ATRAC3P:
- case AV_CODEC_ID_EAC3:
- ret_codecid = MM_AUDIO_CODEC_AC3;
- break;
- case AV_CODEC_ID_PCM_S8:
- case AV_CODEC_ID_PCM_S16BE:
- case AV_CODEC_ID_PCM_S24BE:
- case AV_CODEC_ID_PCM_S32BE:
- ret_codecid = MM_AUDIO_CODEC_PCM;
- break;
- default:
- ret_codecid = MM_AUDIO_CODEC_NONE;
- break;
+ case AV_CODEC_ID_AMR_NB:
+ case AV_CODEC_ID_AMR_WB:
+ ret_codecid = MM_AUDIO_CODEC_AMR;
+ break;
+ /* RealAudio codecs*/
+ case AV_CODEC_ID_RA_144: /* RealAudio 1 */
+ case AV_CODEC_ID_RA_288: /* RealAudio 2 */
+ case AV_CODEC_ID_COOK: /* RealAudio 6 */
+ ret_codecid = MM_AUDIO_CODEC_REAL;
+ break;
+ case AV_CODEC_ID_MP2:
+ ret_codecid = MM_AUDIO_CODEC_MP2;
+ break;
+ case AV_CODEC_ID_MP3:
+ case AV_CODEC_ID_MP3ADU:
+ case AV_CODEC_ID_MP3ON4:
+ ret_codecid = MM_AUDIO_CODEC_MP3;
+ break;
+ case AV_CODEC_ID_AAC:
+ ret_codecid = MM_AUDIO_CODEC_AAC;
+ break;
+ case AV_CODEC_ID_AC3:
+ ret_codecid = MM_AUDIO_CODEC_AC3;
+ break;
+ case AV_CODEC_ID_VORBIS:
+ ret_codecid = MM_AUDIO_CODEC_VORBIS;
+ break;
+ case AV_CODEC_ID_WMAV1:
+ case AV_CODEC_ID_WMAV2:
+ case AV_CODEC_ID_WMAVOICE:
+ case AV_CODEC_ID_WMAPRO:
+ case AV_CODEC_ID_WMALOSSLESS:
+ ret_codecid = MM_AUDIO_CODEC_WMA;
+ break;
+ case AV_CODEC_ID_FLAC:
+ ret_codecid = MM_AUDIO_CODEC_FLAC;
+ break;
+ case AV_CODEC_ID_ALAC:
+ ret_codecid = MM_AUDIO_CODEC_ALAC;
+ break;
+ case AV_CODEC_ID_WAVPACK:
+ ret_codecid = MM_AUDIO_CODEC_WAVE;
+ break;
+ case AV_CODEC_ID_ATRAC3:
+ case AV_CODEC_ID_ATRAC3P:
+ case AV_CODEC_ID_EAC3:
+ ret_codecid = MM_AUDIO_CODEC_AC3;
+ break;
+ case AV_CODEC_ID_PCM_S8:
+ case AV_CODEC_ID_PCM_S16BE:
+ case AV_CODEC_ID_PCM_S24BE:
+ case AV_CODEC_ID_PCM_S32BE:
+ ret_codecid = MM_AUDIO_CODEC_PCM;
+ break;
+ default:
+ ret_codecid = MM_AUDIO_CODEC_NONE;
+ break;
}
return ret_codecid;
int ret = 0; /*default: success*/
switch (formatId) {
- case MM_FILE_FORMAT_3GP:
- case MM_FILE_FORMAT_MP4:
- snprintf(mimeType, buf_size, "video/3gpp");
- break;
- case MM_FILE_FORMAT_ASF:
- case MM_FILE_FORMAT_WMA:
- case MM_FILE_FORMAT_WMV:
- snprintf(mimeType, buf_size, "video/x-ms-asf");
- break;
- case MM_FILE_FORMAT_AVI:
- snprintf(mimeType, buf_size, "video/avi");
- break;
- case MM_FILE_FORMAT_OGG:
- snprintf(mimeType, buf_size, "video/ogg");
- break;
- case MM_FILE_FORMAT_REAL:
- snprintf(mimeType, buf_size, "video/vnd.rn-realmedia");
- break;
- case MM_FILE_FORMAT_AMR:
- snprintf(mimeType, buf_size, "audio/AMR");
- break;
- case MM_FILE_FORMAT_AAC:
- snprintf(mimeType, buf_size, "audio/aac");
- break;
- case MM_FILE_FORMAT_MP3:
- snprintf(mimeType, buf_size, "audio/mp3");
- break;
- case MM_FILE_FORMAT_AIFF:
- case MM_FILE_FORMAT_WAV:
- snprintf(mimeType, buf_size, "audio/wave");
- break;
- case MM_FILE_FORMAT_MID:
- snprintf(mimeType, buf_size, "audio/midi");
- break;
- case MM_FILE_FORMAT_MMF:
- snprintf(mimeType, buf_size, "audio/mmf");
- break;
- case MM_FILE_FORMAT_DIVX:
- snprintf(mimeType, buf_size, "video/divx");
- break;
- case MM_FILE_FORMAT_IMELODY:
- snprintf(mimeType, buf_size, "audio/iMelody");
- break;
- case MM_FILE_FORMAT_JPG:
- snprintf(mimeType, buf_size, "image/jpeg");
- break;
- case MM_FILE_FORMAT_AU:
- snprintf(mimeType, buf_size, "audio/basic");
- break;
- case MM_FILE_FORMAT_VOB:
- snprintf(mimeType, buf_size, "video/dvd");
- break;
- case MM_FILE_FORMAT_FLV:
- snprintf(mimeType, buf_size, "video/x-flv");
- break;
- case MM_FILE_FORMAT_QT:
- snprintf(mimeType, buf_size, "video/quicktime");
- break;
- case MM_FILE_FORMAT_MATROSKA:
- snprintf(mimeType, buf_size, "video/x-matroska");
- break;
- case MM_FILE_FORMAT_FLAC:
- snprintf(mimeType, buf_size, "audio/x-flac");
- break;
- case MM_FILE_FORMAT_M2TS:
- snprintf(mimeType, buf_size, "video/MP2T");
- break;
- case MM_FILE_FORMAT_M2PS:
- snprintf(mimeType, buf_size, "video/MP2P");
- break;
- case MM_FILE_FORMAT_M1AUDIO:
- snprintf(mimeType, buf_size, "audio/x-mpegaudio");
- break;
- case MM_FILE_FORMAT_M1VIDEO:
- snprintf(mimeType, buf_size, "video/mpeg");
- break;
- default:
- ret = -1;
+ case MM_FILE_FORMAT_3GP:
+ case MM_FILE_FORMAT_MP4:
+ snprintf(mimeType, buf_size, "video/3gpp");
+ break;
+ case MM_FILE_FORMAT_ASF:
+ case MM_FILE_FORMAT_WMA:
+ case MM_FILE_FORMAT_WMV:
+ snprintf(mimeType, buf_size, "video/x-ms-asf");
+ break;
+ case MM_FILE_FORMAT_AVI:
+ snprintf(mimeType, buf_size, "video/avi");
+ break;
+ case MM_FILE_FORMAT_OGG:
+ snprintf(mimeType, buf_size, "video/ogg");
+ break;
+ case MM_FILE_FORMAT_REAL:
+ snprintf(mimeType, buf_size, "video/vnd.rn-realmedia");
+ break;
+ case MM_FILE_FORMAT_AMR:
+ snprintf(mimeType, buf_size, "audio/AMR");
+ break;
+ case MM_FILE_FORMAT_AAC:
+ snprintf(mimeType, buf_size, "audio/aac");
+ break;
+ case MM_FILE_FORMAT_MP3:
+ snprintf(mimeType, buf_size, "audio/mp3");
+ break;
+ case MM_FILE_FORMAT_AIFF:
+ case MM_FILE_FORMAT_WAV:
+ snprintf(mimeType, buf_size, "audio/wave");
+ break;
+ case MM_FILE_FORMAT_MID:
+ snprintf(mimeType, buf_size, "audio/midi");
+ break;
+ case MM_FILE_FORMAT_MMF:
+ snprintf(mimeType, buf_size, "audio/mmf");
+ break;
+ case MM_FILE_FORMAT_DIVX:
+ snprintf(mimeType, buf_size, "video/divx");
+ break;
+ case MM_FILE_FORMAT_IMELODY:
+ snprintf(mimeType, buf_size, "audio/iMelody");
+ break;
+ case MM_FILE_FORMAT_JPG:
+ snprintf(mimeType, buf_size, "image/jpeg");
+ break;
+ case MM_FILE_FORMAT_AU:
+ snprintf(mimeType, buf_size, "audio/basic");
+ break;
+ case MM_FILE_FORMAT_VOB:
+ snprintf(mimeType, buf_size, "video/dvd");
+ break;
+ case MM_FILE_FORMAT_FLV:
+ snprintf(mimeType, buf_size, "video/x-flv");
+ break;
+ case MM_FILE_FORMAT_QT:
+ snprintf(mimeType, buf_size, "video/quicktime");
+ break;
+ case MM_FILE_FORMAT_MATROSKA:
+ snprintf(mimeType, buf_size, "video/x-matroska");
+ break;
+ case MM_FILE_FORMAT_FLAC:
+ snprintf(mimeType, buf_size, "audio/x-flac");
+ break;
+ case MM_FILE_FORMAT_M2TS:
+ snprintf(mimeType, buf_size, "video/MP2T");
+ break;
+ case MM_FILE_FORMAT_M2PS:
+ snprintf(mimeType, buf_size, "video/MP2P");
+ break;
+ case MM_FILE_FORMAT_M1AUDIO:
+ snprintf(mimeType, buf_size, "audio/x-mpegaudio");
+ break;
+ case MM_FILE_FORMAT_M1VIDEO:
+ snprintf(mimeType, buf_size, "video/mpeg");
+ break;
+ default:
+ ret = -1;
}
debug_msg(RELEASE, "id: %d, mimetype: %s\n", formatId, mimeType);
memHandle = opaque;
switch (whence) {
- case SEEK_SET:
- tmp_offset = 0 + pos;
- break;
- case SEEK_CUR:
- tmp_offset = memHandle->offset + pos;
- break;
- case SEEK_END:
- tmp_offset = memHandle->size + pos;
- break;
- case AVSEEK_SIZE: /*FFMPEG specific*/
- return memHandle->size;
- default:
- return MMFILE_UTIL_FAIL;
+ case SEEK_SET:
+ tmp_offset = 0 + pos;
+ break;
+ case SEEK_CUR:
+ tmp_offset = memHandle->offset + pos;
+ break;
+ case SEEK_END:
+ tmp_offset = memHandle->size + pos;
+ break;
+ case AVSEEK_SIZE: /*FFMPEG specific*/
+ return memHandle->size;
+ default:
+ return MMFILE_UTIL_FAIL;
}
/*check validation*/
int ret = 0; /*default: success*/
switch (formatId) {
- case MM_FILE_FORMAT_3GP:
- case MM_FILE_FORMAT_MP4:
- snprintf(mimeType, buf_size, "video/3gpp");
- break;
- case MM_FILE_FORMAT_ASF:
- case MM_FILE_FORMAT_WMA:
- case MM_FILE_FORMAT_WMV:
- snprintf(mimeType, buf_size, "video/x-ms-asf");
- break;
- case MM_FILE_FORMAT_AVI:
- snprintf(mimeType, buf_size, "video/avi");
- break;
- case MM_FILE_FORMAT_OGG:
- snprintf(mimeType, buf_size, "video/ogg");
- break;
- case MM_FILE_FORMAT_REAL:
- snprintf(mimeType, buf_size, "video/vnd.rn-realmedia");
- break;
- case MM_FILE_FORMAT_AMR:
- snprintf(mimeType, buf_size, "audio/AMR");
- break;
- case MM_FILE_FORMAT_AAC:
- snprintf(mimeType, buf_size, "audio/aac");
- break;
- case MM_FILE_FORMAT_MP3:
- snprintf(mimeType, buf_size, "audio/mp3");
- break;
- case MM_FILE_FORMAT_AIFF:
- case MM_FILE_FORMAT_WAV:
- snprintf(mimeType, buf_size, "audio/wave");
- break;
- case MM_FILE_FORMAT_MID:
- snprintf(mimeType, buf_size, "audio/midi");
- break;
- case MM_FILE_FORMAT_MMF:
- snprintf(mimeType, buf_size, "audio/mmf");
- break;
- case MM_FILE_FORMAT_DIVX:
- snprintf(mimeType, buf_size, "video/divx");
- break;
- case MM_FILE_FORMAT_IMELODY:
- snprintf(mimeType, buf_size, "audio/iMelody");
- break;
- case MM_FILE_FORMAT_JPG:
- snprintf(mimeType, buf_size, "image/jpeg");
- break;
- case MM_FILE_FORMAT_AU:
- snprintf(mimeType, buf_size, "audio/basic");
- break;
- case MM_FILE_FORMAT_VOB:
- snprintf(mimeType, buf_size, "video/dvd");
- break;
- case MM_FILE_FORMAT_FLV:
- snprintf(mimeType, buf_size, "video/x-flv");
- break;
- case MM_FILE_FORMAT_QT:
- snprintf(mimeType, buf_size, "video/quicktime");
- break;
- case MM_FILE_FORMAT_MATROSKA:
- snprintf(mimeType, buf_size, "video/x-matroska");
- break;
- case MM_FILE_FORMAT_FLAC:
- snprintf(mimeType, buf_size, "audio/x-flac");
- break;
- case MM_FILE_FORMAT_M2TS:
- snprintf(mimeType, buf_size, "video/MP2T");
- break;
- case MM_FILE_FORMAT_M2PS:
- snprintf(mimeType, buf_size, "video/MP2P");
- break;
- case MM_FILE_FORMAT_M1VIDEO:
- snprintf(mimeType, buf_size, "video/mpeg");
- break;
- case MM_FILE_FORMAT_M1AUDIO:
- snprintf(mimeType, buf_size, "audio/x-mpegaudio");
- break;
- default:
- ret = -1;
- break;
+ case MM_FILE_FORMAT_3GP:
+ case MM_FILE_FORMAT_MP4:
+ snprintf(mimeType, buf_size, "video/3gpp");
+ break;
+ case MM_FILE_FORMAT_ASF:
+ case MM_FILE_FORMAT_WMA:
+ case MM_FILE_FORMAT_WMV:
+ snprintf(mimeType, buf_size, "video/x-ms-asf");
+ break;
+ case MM_FILE_FORMAT_AVI:
+ snprintf(mimeType, buf_size, "video/avi");
+ break;
+ case MM_FILE_FORMAT_OGG:
+ snprintf(mimeType, buf_size, "video/ogg");
+ break;
+ case MM_FILE_FORMAT_REAL:
+ snprintf(mimeType, buf_size, "video/vnd.rn-realmedia");
+ break;
+ case MM_FILE_FORMAT_AMR:
+ snprintf(mimeType, buf_size, "audio/AMR");
+ break;
+ case MM_FILE_FORMAT_AAC:
+ snprintf(mimeType, buf_size, "audio/aac");
+ break;
+ case MM_FILE_FORMAT_MP3:
+ snprintf(mimeType, buf_size, "audio/mp3");
+ break;
+ case MM_FILE_FORMAT_AIFF:
+ case MM_FILE_FORMAT_WAV:
+ snprintf(mimeType, buf_size, "audio/wave");
+ break;
+ case MM_FILE_FORMAT_MID:
+ snprintf(mimeType, buf_size, "audio/midi");
+ break;
+ case MM_FILE_FORMAT_MMF:
+ snprintf(mimeType, buf_size, "audio/mmf");
+ break;
+ case MM_FILE_FORMAT_DIVX:
+ snprintf(mimeType, buf_size, "video/divx");
+ break;
+ case MM_FILE_FORMAT_IMELODY:
+ snprintf(mimeType, buf_size, "audio/iMelody");
+ break;
+ case MM_FILE_FORMAT_JPG:
+ snprintf(mimeType, buf_size, "image/jpeg");
+ break;
+ case MM_FILE_FORMAT_AU:
+ snprintf(mimeType, buf_size, "audio/basic");
+ break;
+ case MM_FILE_FORMAT_VOB:
+ snprintf(mimeType, buf_size, "video/dvd");
+ break;
+ case MM_FILE_FORMAT_FLV:
+ snprintf(mimeType, buf_size, "video/x-flv");
+ break;
+ case MM_FILE_FORMAT_QT:
+ snprintf(mimeType, buf_size, "video/quicktime");
+ break;
+ case MM_FILE_FORMAT_MATROSKA:
+ snprintf(mimeType, buf_size, "video/x-matroska");
+ break;
+ case MM_FILE_FORMAT_FLAC:
+ snprintf(mimeType, buf_size, "audio/x-flac");
+ break;
+ case MM_FILE_FORMAT_M2TS:
+ snprintf(mimeType, buf_size, "video/MP2T");
+ break;
+ case MM_FILE_FORMAT_M2PS:
+ snprintf(mimeType, buf_size, "video/MP2P");
+ break;
+ case MM_FILE_FORMAT_M1VIDEO:
+ snprintf(mimeType, buf_size, "video/mpeg");
+ break;
+ case MM_FILE_FORMAT_M1AUDIO:
+ snprintf(mimeType, buf_size, "audio/x-mpegaudio");
+ break;
+ default:
+ ret = -1;
+ break;
}
debug_msg(RELEASE, "id: %d, mimetype: %s\n", formatId, mimeType);
debug_msg(RELEASE, "search index = [%d]\n", index);
switch (index) {
- case MM_FILE_FORMAT_QT:
- case MM_FILE_FORMAT_3GP:
- case MM_FILE_FORMAT_MP4:
- *format = MM_FILE_FORMAT_3GP;
- break;
+ case MM_FILE_FORMAT_QT:
+ case MM_FILE_FORMAT_3GP:
+ case MM_FILE_FORMAT_MP4:
+ *format = MM_FILE_FORMAT_3GP;
+ break;
- case MM_FILE_FORMAT_ASF:
- case MM_FILE_FORMAT_WMA:
- case MM_FILE_FORMAT_WMV:
- *format = MM_FILE_FORMAT_ASF;
- break;
+ case MM_FILE_FORMAT_ASF:
+ case MM_FILE_FORMAT_WMA:
+ case MM_FILE_FORMAT_WMV:
+ *format = MM_FILE_FORMAT_ASF;
+ break;
- case MM_FILE_FORMAT_DIVX:
- case MM_FILE_FORMAT_AVI:
- *format = MM_FILE_FORMAT_AVI;
- break;
+ case MM_FILE_FORMAT_DIVX:
+ case MM_FILE_FORMAT_AVI:
+ *format = MM_FILE_FORMAT_AVI;
+ break;
- case MM_FILE_FORMAT_MATROSKA:
- case MM_FILE_FORMAT_FLV:
- case MM_FILE_FORMAT_M2TS:
- case MM_FILE_FORMAT_M2PS:
- case MM_FILE_FORMAT_REAL:
- case MM_FILE_FORMAT_M1AUDIO:
- case MM_FILE_FORMAT_M1VIDEO:
- *format = index;
- break;
+ case MM_FILE_FORMAT_MATROSKA:
+ case MM_FILE_FORMAT_FLV:
+ case MM_FILE_FORMAT_M2TS:
+ case MM_FILE_FORMAT_M2PS:
+ case MM_FILE_FORMAT_REAL:
+ case MM_FILE_FORMAT_M1AUDIO:
+ case MM_FILE_FORMAT_M1VIDEO:
+ *format = index;
+ break;
- default: {
- *format = MM_FILE_FORMAT_NUM;
- debug_error(DEBUG, "error: not supported or invaild format enum[%d]\n", index);
- break;
- }
+ default: {
+ *format = MM_FILE_FORMAT_NUM;
+ debug_error(DEBUG, "error: not supported or invaild format enum[%d]\n", index);
+ break;
+ }
}
- if (MMFileFunc[*format].Valid!= NULL && MMFileFunc[*format].Valid(fp, NULL, 0)) {
+ if (MMFileFunc[*format].Valid != NULL && MMFileFunc[*format].Valid(fp, NULL, 0)) {
goto FILE_FORMAT_SUCCESS;
}
}
if (len < 0 && len != AVERROR(EAGAIN) && len != AVERROR_EOF) {
debug_warning(DEBUG, "Error while avcodec_receive_frame");
} else if (len >= 0) {
- if ((packet.flags & AV_PKT_FLAG_KEY) ) {
+ if ((packet.flags & AV_PKT_FLAG_KEY)) {
if (first_seek || !is_accurate) {
/* This is first seeking or not accurate mode.
char *urifilename = NULL;
AVFormatContext *pFormatCtx = NULL;
AVInputFormat *grab_iformat = NULL;
- AVIOContext *pIOCtx = NULL;
+ AVIOContext *pIOCtx = NULL;
MMFmemIOHandle *handle = NULL;
uint8_t *avio_ctx_buffer = NULL;
}
ret = _mmf_mem_open(&handle, urifilename);
- if (ret !=MMFILE_IO_SUCCESS) {
+ if (ret != MMFILE_IO_SUCCESS) {
debug_warning(DEBUG, "failed to _mmf_mem_open.\n");
av_free(avio_ctx_buffer);
ret = MMFILE_FORMAT_FAIL;
static unsigned char midiData[AV_MIDI_COUNT_MAX] ;
static unsigned char midiHeader[MIDI_HEADER_LENGTH] = {0x4d, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x30, 0x4d, 0x54,
- 0x72, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x58, 0x04, 0x04, 0x02, 0x18, 0x08, 0x00, 0xff,
- 0x59, 0x02, 0x00, 0x00, 0x00, 0xff, 0x51, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0xb0,
- 0x07, 0x00, 0x00, 0x90
- };
+ 0x72, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x58, 0x04, 0x04, 0x02, 0x18, 0x08, 0x00, 0xff,
+ 0x59, 0x02, 0x00, 0x00, 0x00, 0xff, 0x51, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0xb0,
+ 0x07, 0x00, 0x00, 0x90
+ };
static unsigned char noteTotal[AV_MIDI_COUNT_MAX];
static int durationSpec[AV_MIDI_NOTE_MAX];
static int restSpec[AV_MIDI_NOTE_MAX];
-static struct {
+static struct {
char flat_sharp;
char note;
char duration;
tag_len = strlen(taginfo.title);
cnv_len = 0;
formatContext->title = mmfile_string_convert((const char *)taginfo.title,
- tag_len,
- "UTF-8",
- locale,
- NULL,
- (unsigned int *)&cnv_len);
+ tag_len,
+ "UTF-8",
+ locale,
+ NULL,
+ (unsigned int *)&cnv_len);
if (formatContext->title == NULL) {
debug_warning(DEBUG, "failed to UTF8 convert.\n");
tag_len = strlen(taginfo.composer);
cnv_len = 0;
formatContext->composer = mmfile_string_convert((const char *)taginfo.composer,
- tag_len,
- "UTF-8",
- locale,
- NULL,
- (unsigned int *)&cnv_len);
+ tag_len,
+ "UTF-8",
+ locale,
+ NULL,
+ (unsigned int *)&cnv_len);
if (formatContext->composer == NULL) {
debug_warning(DEBUG, "failed to UTF8 convert.\n");
formatContext->composer = mmfile_strdup(taginfo.composer);
tag_len = strlen(taginfo.comment);
cnv_len = 0;
formatContext->comment = mmfile_string_convert((const char *)taginfo.comment,
- tag_len,
- "UTF-8",
- locale,
- NULL,
- (unsigned int *)&cnv_len);
+ tag_len,
+ "UTF-8",
+ locale,
+ NULL,
+ (unsigned int *)&cnv_len);
if (formatContext->comment == NULL) {
debug_warning(DEBUG, "failed to UTF8 convert.\n");
formatContext->comment = mmfile_strdup(taginfo.comment);
tag_len = strlen(taginfo.copyright);
cnv_len = 0;
formatContext->copyright = mmfile_string_convert((const char *)taginfo.copyright,
- tag_len,
- "UTF-8",
- locale,
- NULL,
- (unsigned int *)&cnv_len);
+ tag_len,
+ "UTF-8",
+ locale,
+ NULL,
+ (unsigned int *)&cnv_len);
if (formatContext->copyright == NULL) {
debug_warning(DEBUG, "failed to UTF8 convert.\n");
formatContext->copyright = mmfile_strdup(taginfo.copyright);
if (Melody[number].flat_sharp == '#') {
switch (Melody[number].note) {
- case 'c':
- noteData[number].note = octaveValue + 1;
- break;
- case 'd':
- noteData[number].note = octaveValue + 3;
- break;
- case 'f':
- noteData[number].note = octaveValue + 6;
- break;
- case 'g':
- noteData[number].note = octaveValue + 8;
- break;
- case 'a':
- noteData[number].note = octaveValue + 10;
- break;
- default:
- break;
+ case 'c':
+ noteData[number].note = octaveValue + 1;
+ break;
+ case 'd':
+ noteData[number].note = octaveValue + 3;
+ break;
+ case 'f':
+ noteData[number].note = octaveValue + 6;
+ break;
+ case 'g':
+ noteData[number].note = octaveValue + 8;
+ break;
+ case 'a':
+ noteData[number].note = octaveValue + 10;
+ break;
+ default:
+ break;
}
}
else if (Melody[number].flat_sharp == '&') {
switch (Melody[number].note) {
- case 'd':
- noteData[number].note = octaveValue + 1;
- break;
- case 'e':
- noteData[number].note = octaveValue + 3;
- break;
- case 'g':
- noteData[number].note = octaveValue + 6;
- break;
- case 'a':
- noteData[number].note = octaveValue + 8;
- break;
- case 'b':
- noteData[number].note = octaveValue + 10;
- break;
- default:
- break;
+ case 'd':
+ noteData[number].note = octaveValue + 1;
+ break;
+ case 'e':
+ noteData[number].note = octaveValue + 3;
+ break;
+ case 'g':
+ noteData[number].note = octaveValue + 6;
+ break;
+ case 'a':
+ noteData[number].note = octaveValue + 8;
+ break;
+ case 'b':
+ noteData[number].note = octaveValue + 10;
+ break;
+ default:
+ break;
}
}
else {
switch (Melody[number].note) {
- case 'c':
- noteData[number].note = octaveValue;
- break;
- case 'd':
- noteData[number].note = octaveValue + 2;
- break;
- case 'e':
- noteData[number].note = octaveValue + 4;
- break;
- case 'f':
- noteData[number].note = octaveValue + 5;
- break;
- case 'g':
- noteData[number].note = octaveValue + 7;
- break;
- case 'a':
- noteData[number].note = octaveValue + 9;
- break;
- case 'b':
- noteData[number].note = octaveValue + 11;
- break;
- default:
- break;
+ case 'c':
+ noteData[number].note = octaveValue;
+ break;
+ case 'd':
+ noteData[number].note = octaveValue + 2;
+ break;
+ case 'e':
+ noteData[number].note = octaveValue + 4;
+ break;
+ case 'f':
+ noteData[number].note = octaveValue + 5;
+ break;
+ case 'g':
+ noteData[number].note = octaveValue + 7;
+ break;
+ case 'a':
+ noteData[number].note = octaveValue + 9;
+ break;
+ case 'b':
+ noteData[number].note = octaveValue + 11;
+ break;
+ default:
+ break;
}
}
}
for (number = 0; number < noteCount; number++) {
if (style == '0') {
switch (Melody[number].duration) {
- case '0':
- noteData[number].duration_on = 183;
- noteData[number].duration_off = 9;
- break;
- case '1':
- noteData[number].duration_on = 91;
- noteData[number].duration_off = 5;
- break;
- case '2':
- noteData[number].duration_on = 46;
- noteData[number].duration_off = 2;
- break;
- case '3':
- noteData[number].duration_on = 23;
- noteData[number].duration_off = 1;
- break;
- case '4':
- noteData[number].duration_on = 11;
- noteData[number].duration_off = 1;
- break;
- case '5':
- noteData[number].duration_on = 5;
- noteData[number].duration_off = 1;
- break;
- default:
- break;
+ case '0':
+ noteData[number].duration_on = 183;
+ noteData[number].duration_off = 9;
+ break;
+ case '1':
+ noteData[number].duration_on = 91;
+ noteData[number].duration_off = 5;
+ break;
+ case '2':
+ noteData[number].duration_on = 46;
+ noteData[number].duration_off = 2;
+ break;
+ case '3':
+ noteData[number].duration_on = 23;
+ noteData[number].duration_off = 1;
+ break;
+ case '4':
+ noteData[number].duration_on = 11;
+ noteData[number].duration_off = 1;
+ break;
+ case '5':
+ noteData[number].duration_on = 5;
+ noteData[number].duration_off = 1;
+ break;
+ default:
+ break;
}
}
else if (style == '1') {
switch (Melody[number].duration) {
- case '0':
- noteData[number].duration_on = 192;
- noteData[number].duration_off = 0;
- break;
- case '1':
- noteData[number].duration_on = 96;
- noteData[number].duration_off = 0;
- break;
- case '2':
- noteData[number].duration_on = 48;
- noteData[number].duration_off = 0;
- break;
- case '3':
- noteData[number].duration_on = 24;
- noteData[number].duration_off = 0;
- break;
- case '4':
- noteData[number].duration_on = 12;
- noteData[number].duration_off = 0;
- break;
- case '5':
- noteData[number].duration_on = 6;
- noteData[number].duration_off = 0;
- break;
- default:
- break;
+ case '0':
+ noteData[number].duration_on = 192;
+ noteData[number].duration_off = 0;
+ break;
+ case '1':
+ noteData[number].duration_on = 96;
+ noteData[number].duration_off = 0;
+ break;
+ case '2':
+ noteData[number].duration_on = 48;
+ noteData[number].duration_off = 0;
+ break;
+ case '3':
+ noteData[number].duration_on = 24;
+ noteData[number].duration_off = 0;
+ break;
+ case '4':
+ noteData[number].duration_on = 12;
+ noteData[number].duration_off = 0;
+ break;
+ case '5':
+ noteData[number].duration_on = 6;
+ noteData[number].duration_off = 0;
+ break;
+ default:
+ break;
}
}
else {
switch (Melody[number].duration) {
- case '0':
- noteData[number].duration_on = 96;
- noteData[number].duration_off = 96;
- break;
- case '1':
- noteData[number].duration_on = 48;
- noteData[number].duration_off = 48;
- break;
- case '2':
- noteData[number].duration_on = 24;
- noteData[number].duration_off = 24;
- break;
- case '3':
- noteData[number].duration_on = 12;
- noteData[number].duration_off = 12;
- break;
- case '4':
- noteData[number].duration_on = 6;
- noteData[number].duration_off = 6;
- break;
- case '5':
- noteData[number].duration_on = 3;
- noteData[number].duration_off = 3;
- break;
- default:
- break;
- }
- }
-
- switch (Melody[number].duration) {
case '0':
- durationSpec[number] = 192;
+ noteData[number].duration_on = 96;
+ noteData[number].duration_off = 96;
break;
case '1':
- durationSpec[number] = 96;
+ noteData[number].duration_on = 48;
+ noteData[number].duration_off = 48;
break;
case '2':
- durationSpec[number] = 48;
+ noteData[number].duration_on = 24;
+ noteData[number].duration_off = 24;
break;
case '3':
- durationSpec[number] = 24;
+ noteData[number].duration_on = 12;
+ noteData[number].duration_off = 12;
break;
case '4':
- durationSpec[number] = 12;
+ noteData[number].duration_on = 6;
+ noteData[number].duration_off = 6;
break;
case '5':
- durationSpec[number] = 6;
+ noteData[number].duration_on = 3;
+ noteData[number].duration_off = 3;
break;
default:
break;
+ }
+ }
+
+ switch (Melody[number].duration) {
+ case '0':
+ durationSpec[number] = 192;
+ break;
+ case '1':
+ durationSpec[number] = 96;
+ break;
+ case '2':
+ durationSpec[number] = 48;
+ break;
+ case '3':
+ durationSpec[number] = 24;
+ break;
+ case '4':
+ durationSpec[number] = 12;
+ break;
+ case '5':
+ durationSpec[number] = 6;
+ break;
+ default:
+ break;
}
if (Melody[number].duration_specifier != '%') {
switch (Melody[number].duration_specifier) {
- case '.':
- noteData[number].duration_on += (durationSpec[number] / 2);
- break;
- case ':':
- noteData[number].duration_on += durationSpec[number];
- break;
- case ';':
- noteData[number].duration_on -= (durationSpec[number] / 3);
- break;
- default:
- break;
+ case '.':
+ noteData[number].duration_on += (durationSpec[number] / 2);
+ break;
+ case ':':
+ noteData[number].duration_on += durationSpec[number];
+ break;
+ case ';':
+ noteData[number].duration_on -= (durationSpec[number] / 3);
+ break;
+ default:
+ break;
}
if (noteData[number].duration_on > MIDI_MAX)
for (number = 1; number < noteCount; number++) {
if (Melody[number].rest >= '0' && Melody[number].rest <= '5') {
switch (Melody[number].rest) {
- case '0':
- noteData[number - 1].duration_off += 192;
- restSpec[number] = 192;
- break;
- case '1':
- noteData[number - 1].duration_off += 96;
- restSpec[number] = 96;
- break;
- case '2':
- noteData[number - 1].duration_off += 48;
- restSpec[number] = 48;
- break;
- case '3':
- noteData[number - 1].duration_off += 24;
- restSpec[number] = 24;
- break;
- case '4':
- noteData[number - 1].duration_off += 12;
- restSpec[number] = 12;
- break;
- case '5':
- noteData[number - 1].duration_off += 6;
- restSpec[number] = 6;
- break;
- default:
- break;
- }
-
- if (noteData[number - 1].duration_off > MIDI_MAX && Melody[number].rest_specifier == '%')
- noteData[number - 1].duration_off = MIDI_LIMIT;
- }
-
- if (Melody[number].rest_specifier != '%') {
- switch (Melody[number].rest_specifier) {
- case '.':
- noteData[number - 1].duration_off += (restSpec[number] / 2);
- break;
- case ':':
- noteData[number - 1].duration_off += restSpec[number];
- break;
- case ';':
- noteData[number - 1].duration_off -= (restSpec[number] / 3);
- break;
- default:
- break;
- }
-
- if (noteData[number - 1].duration_off > MIDI_MAX)
- noteData[number - 1].duration_off = MIDI_LIMIT;
- }
- }
-
- if (Melody[0].rest >= '0' && Melody[0].rest <= '5') {
- switch (Melody[0].rest) {
case '0':
- midiData[50] += 192;
- restSpec[0] = 192;
+ noteData[number - 1].duration_off += 192;
+ restSpec[number] = 192;
break;
case '1':
- midiData[50] += 96;
- restSpec[0] = 96;
+ noteData[number - 1].duration_off += 96;
+ restSpec[number] = 96;
break;
case '2':
- midiData[50] += 48;
- restSpec[0] = 48;
+ noteData[number - 1].duration_off += 48;
+ restSpec[number] = 48;
break;
case '3':
- midiData[50] += 24;
- restSpec[0] = 24;
+ noteData[number - 1].duration_off += 24;
+ restSpec[number] = 24;
break;
case '4':
- midiData[50] += 12;
- restSpec[0] = 12;
+ noteData[number - 1].duration_off += 12;
+ restSpec[number] = 12;
break;
case '5':
- midiData[50] += 6;
- restSpec[0] = 6;
+ noteData[number - 1].duration_off += 6;
+ restSpec[number] = 6;
+ break;
+ default:
+ break;
+ }
+
+ if (noteData[number - 1].duration_off > MIDI_MAX && Melody[number].rest_specifier == '%')
+ noteData[number - 1].duration_off = MIDI_LIMIT;
+ }
+
+ if (Melody[number].rest_specifier != '%') {
+ switch (Melody[number].rest_specifier) {
+ case '.':
+ noteData[number - 1].duration_off += (restSpec[number] / 2);
+ break;
+ case ':':
+ noteData[number - 1].duration_off += restSpec[number];
+ break;
+ case ';':
+ noteData[number - 1].duration_off -= (restSpec[number] / 3);
break;
default:
break;
+ }
+
+ if (noteData[number - 1].duration_off > MIDI_MAX)
+ noteData[number - 1].duration_off = MIDI_LIMIT;
+ }
+ }
+
+ if (Melody[0].rest >= '0' && Melody[0].rest <= '5') {
+ switch (Melody[0].rest) {
+ case '0':
+ midiData[50] += 192;
+ restSpec[0] = 192;
+ break;
+ case '1':
+ midiData[50] += 96;
+ restSpec[0] = 96;
+ break;
+ case '2':
+ midiData[50] += 48;
+ restSpec[0] = 48;
+ break;
+ case '3':
+ midiData[50] += 24;
+ restSpec[0] = 24;
+ break;
+ case '4':
+ midiData[50] += 12;
+ restSpec[0] = 12;
+ break;
+ case '5':
+ midiData[50] += 6;
+ restSpec[0] = 6;
+ break;
+ default:
+ break;
}
if (Melody[0].rest_specifier != '%') {
switch (Melody[0].rest_specifier) {
- case '.':
- midiData[50] += (restSpec[0] / 2);
- break;
- case ':':
- midiData[50] += restSpec[0];
- break;
- case ';':
- midiData[50] -= (restSpec[0] / 3);
- break;
- default:
- break;
+ case '.':
+ midiData[50] += (restSpec[0] / 2);
+ break;
+ case ':':
+ midiData[50] += restSpec[0];
+ break;
+ case ';':
+ midiData[50] -= (restSpec[0] / 3);
+ break;
+ default:
+ break;
}
}
noteTotal[1] = 84 - VOL_INTERVAL;
switch (Melody[number].vol) {
- case '+':
- noteTotal[6 * number + 1] = noteTotal[6 * (number - 1) + 1] + VOL_INTERVAL;
- break;
- case '-':
- noteTotal[6 * number + 1] = noteTotal[6 * (number - 1) + 1] - VOL_INTERVAL;
- break;
- default:
- break;
+ case '+':
+ noteTotal[6 * number + 1] = noteTotal[6 * (number - 1) + 1] + VOL_INTERVAL;
+ break;
+ case '-':
+ noteTotal[6 * number + 1] = noteTotal[6 * (number - 1) + 1] - VOL_INTERVAL;
+ break;
+ default:
+ break;
}
if (noteTotal[6 * number + 1] > MIDI_LIMIT)
if (Melody[number].flat_sharp == '#') {
switch (Melody[number].note) {
- case 'c':
- noteData[number].note = octaveValue + 1;
- break;
- case 'd':
- noteData[number].note = octaveValue + 3;
- break;
- case 'f':
- noteData[number].note = octaveValue + 6;
- break;
- case 'g':
- noteData[number].note = octaveValue + 8;
- break;
- case 'a':
- noteData[number].note = octaveValue + 10;
- break;
- default:
- break;
+ case 'c':
+ noteData[number].note = octaveValue + 1;
+ break;
+ case 'd':
+ noteData[number].note = octaveValue + 3;
+ break;
+ case 'f':
+ noteData[number].note = octaveValue + 6;
+ break;
+ case 'g':
+ noteData[number].note = octaveValue + 8;
+ break;
+ case 'a':
+ noteData[number].note = octaveValue + 10;
+ break;
+ default:
+ break;
}
}
else if (Melody[number].flat_sharp == '&') {
switch (Melody[number].note) {
- case 'd':
- noteData[number].note = octaveValue + 1;
- break;
- case 'e':
- noteData[number].note = octaveValue + 3;
- break;
- case 'g':
- noteData[number].note = octaveValue + 6;
- break;
- case 'a':
- noteData[number].note = octaveValue + 8;
- break;
- case 'b':
- noteData[number].note = octaveValue + 10;
- break;
- default:
- break;
+ case 'd':
+ noteData[number].note = octaveValue + 1;
+ break;
+ case 'e':
+ noteData[number].note = octaveValue + 3;
+ break;
+ case 'g':
+ noteData[number].note = octaveValue + 6;
+ break;
+ case 'a':
+ noteData[number].note = octaveValue + 8;
+ break;
+ case 'b':
+ noteData[number].note = octaveValue + 10;
+ break;
+ default:
+ break;
}
}
else {
switch (Melody[number].note) {
- case 'c':
- noteData[number].note = octaveValue;
- break;
- case 'd':
- noteData[number].note = octaveValue + 2;
- break;
- case 'e':
- noteData[number].note = octaveValue + 4;
- break;
- case 'f':
- noteData[number].note = octaveValue + 5;
- break;
- case 'g':
- noteData[number].note = octaveValue + 7;
- break;
- case 'a':
- noteData[number].note = octaveValue + 9;
- break;
- case 'b':
- noteData[number].note = octaveValue + 11;
- break;
- default:
- break;
+ case 'c':
+ noteData[number].note = octaveValue;
+ break;
+ case 'd':
+ noteData[number].note = octaveValue + 2;
+ break;
+ case 'e':
+ noteData[number].note = octaveValue + 4;
+ break;
+ case 'f':
+ noteData[number].note = octaveValue + 5;
+ break;
+ case 'g':
+ noteData[number].note = octaveValue + 7;
+ break;
+ case 'a':
+ noteData[number].note = octaveValue + 9;
+ break;
+ case 'b':
+ noteData[number].note = octaveValue + 11;
+ break;
+ default:
+ break;
}
}
if (style == '0') {
switch (Melody[number].duration) {
- case '0':
- noteData[number].duration_on = 183;
- noteData[number].duration_off = 9;
- break;
- case '1':
- noteData[number].duration_on = 91;
- noteData[number].duration_off = 5;
- break;
- case '2':
- noteData[number].duration_on = 46;
- noteData[number].duration_off = 2;
- break;
- case '3':
- noteData[number].duration_on = 23;
- noteData[number].duration_off = 1;
- break;
- case '4':
- noteData[number].duration_on = 11;
- noteData[number].duration_off = 1;
- break;
- case '5':
- noteData[number].duration_on = 5;
- noteData[number].duration_off = 1;
- break;
- default:
- break;
+ case '0':
+ noteData[number].duration_on = 183;
+ noteData[number].duration_off = 9;
+ break;
+ case '1':
+ noteData[number].duration_on = 91;
+ noteData[number].duration_off = 5;
+ break;
+ case '2':
+ noteData[number].duration_on = 46;
+ noteData[number].duration_off = 2;
+ break;
+ case '3':
+ noteData[number].duration_on = 23;
+ noteData[number].duration_off = 1;
+ break;
+ case '4':
+ noteData[number].duration_on = 11;
+ noteData[number].duration_off = 1;
+ break;
+ case '5':
+ noteData[number].duration_on = 5;
+ noteData[number].duration_off = 1;
+ break;
+ default:
+ break;
}
}
else if (style == '1') {
switch (Melody[number].duration) {
- case '0':
- noteData[number].duration_on = 192;
- noteData[number].duration_off = 0;
- break;
- case '1':
- noteData[number].duration_on = 96;
- noteData[number].duration_off = 0;
- break;
- case '2':
- noteData[number].duration_on = 48;
- noteData[number].duration_off = 0;
- break;
- case '3':
- noteData[number].duration_on = 24;
- noteData[number].duration_off = 0;
- break;
- case '4':
- noteData[number].duration_on = 12;
- noteData[number].duration_off = 0;
- break;
- case '5':
- noteData[number].duration_on = 6;
- noteData[number].duration_off = 0;
- break;
- default:
- break;
+ case '0':
+ noteData[number].duration_on = 192;
+ noteData[number].duration_off = 0;
+ break;
+ case '1':
+ noteData[number].duration_on = 96;
+ noteData[number].duration_off = 0;
+ break;
+ case '2':
+ noteData[number].duration_on = 48;
+ noteData[number].duration_off = 0;
+ break;
+ case '3':
+ noteData[number].duration_on = 24;
+ noteData[number].duration_off = 0;
+ break;
+ case '4':
+ noteData[number].duration_on = 12;
+ noteData[number].duration_off = 0;
+ break;
+ case '5':
+ noteData[number].duration_on = 6;
+ noteData[number].duration_off = 0;
+ break;
+ default:
+ break;
}
}
else {
switch (Melody[number].duration) {
- case '0':
- noteData[number].duration_on = 96;
- noteData[number].duration_off = 96;
- break;
- case '1':
- noteData[number].duration_on = 48;
- noteData[number].duration_off = 48;
- break;
- case '2':
- noteData[number].duration_on = 24;
- noteData[number].duration_off = 24;
- break;
- case '3':
- noteData[number].duration_on = 12;
- noteData[number].duration_off = 12;
- break;
- case '4':
- noteData[number].duration_on = 6;
- noteData[number].duration_off = 6;
- break;
- case '5':
- noteData[number].duration_on = 3;
- noteData[number].duration_off = 3;
- break;
- default:
- break;
- }
- }
-
- switch (Melody[number].duration) {
case '0':
- durationSpec[number] = 192;
+ noteData[number].duration_on = 96;
+ noteData[number].duration_off = 96;
break;
case '1':
- durationSpec[number] = 96;
+ noteData[number].duration_on = 48;
+ noteData[number].duration_off = 48;
break;
case '2':
- durationSpec[number] = 48;
+ noteData[number].duration_on = 24;
+ noteData[number].duration_off = 24;
break;
case '3':
- durationSpec[number] = 24;
+ noteData[number].duration_on = 12;
+ noteData[number].duration_off = 12;
break;
case '4':
- durationSpec[number] = 12;
+ noteData[number].duration_on = 6;
+ noteData[number].duration_off = 6;
break;
case '5':
- durationSpec[number] = 6;
+ noteData[number].duration_on = 3;
+ noteData[number].duration_off = 3;
break;
default:
break;
+ }
+ }
+
+ switch (Melody[number].duration) {
+ case '0':
+ durationSpec[number] = 192;
+ break;
+ case '1':
+ durationSpec[number] = 96;
+ break;
+ case '2':
+ durationSpec[number] = 48;
+ break;
+ case '3':
+ durationSpec[number] = 24;
+ break;
+ case '4':
+ durationSpec[number] = 12;
+ break;
+ case '5':
+ durationSpec[number] = 6;
+ break;
+ default:
+ break;
}
if (Melody[number].duration_specifier != '%') {
switch (Melody[number].duration_specifier) {
- case '.':
- noteData[number].duration_on += (durationSpec[number] / 2);
- break;
- case ':':
- noteData[number].duration_on += durationSpec[number];
- break;
- case ';':
- noteData[number].duration_on -= (durationSpec[number] / 3);
- break;
- default:
- break;
+ case '.':
+ noteData[number].duration_on += (durationSpec[number] / 2);
+ break;
+ case ':':
+ noteData[number].duration_on += durationSpec[number];
+ break;
+ case ';':
+ noteData[number].duration_on -= (durationSpec[number] / 3);
+ break;
+ default:
+ break;
}
if (noteData[number].duration_on > MIDI_MAX)
for (number = count + 1; number < noteCount && number < AV_MIDI_NOTE_MAX; number++) {
if (Melody[number].rest >= '0' && Melody[number].rest <= '5') {
switch (Melody[number].rest) {
- case '0':
- noteData[number - 1].duration_off += 192;
- restSpec[number] = 192;
- break;
- case '1':
- noteData[number - 1].duration_off += 96;
- restSpec[number] = 96;
- break;
- case '2':
- noteData[number - 1].duration_off += 48;
- restSpec[number] = 48;
- break;
- case '3':
- noteData[number - 1].duration_off += 24;
- restSpec[number] = 24;
- break;
- case '4':
- noteData[number - 1].duration_off += 12;
- restSpec[number] = 12;
- break;
- case '5':
- noteData[number - 1].duration_off += 6;
- restSpec[number] = 6;
- break;
- default:
- break;
+ case '0':
+ noteData[number - 1].duration_off += 192;
+ restSpec[number] = 192;
+ break;
+ case '1':
+ noteData[number - 1].duration_off += 96;
+ restSpec[number] = 96;
+ break;
+ case '2':
+ noteData[number - 1].duration_off += 48;
+ restSpec[number] = 48;
+ break;
+ case '3':
+ noteData[number - 1].duration_off += 24;
+ restSpec[number] = 24;
+ break;
+ case '4':
+ noteData[number - 1].duration_off += 12;
+ restSpec[number] = 12;
+ break;
+ case '5':
+ noteData[number - 1].duration_off += 6;
+ restSpec[number] = 6;
+ break;
+ default:
+ break;
}
if (noteData[number - 1].duration_off > MIDI_MAX && Melody[number].rest_specifier == '%')
if (Melody[number].rest_specifier != '%') {
switch (Melody[number].rest_specifier) {
- case '.':
- noteData[number - 1].duration_off += (restSpec[number] / 2);
- break;
- case ':':
- noteData[number - 1].duration_off += restSpec[number];
- break;
- case ';':
- noteData[number - 1].duration_off -= (restSpec[number] / 3);
- break;
- default:
- break;
+ case '.':
+ noteData[number - 1].duration_off += (restSpec[number] / 2);
+ break;
+ case ':':
+ noteData[number - 1].duration_off += restSpec[number];
+ break;
+ case ';':
+ noteData[number - 1].duration_off -= (restSpec[number] / 3);
+ break;
+ default:
+ break;
}
if (noteData[number - 1].duration_off > MIDI_MAX)
if (Melody[count].rest >= '0' && Melody[count].rest <= '5') {
switch (Melody[count].rest) {
- case '0':
- midiData[52 + (6 * count * (repeat + 1) - 1)] += 192;
- restSpec[count] = 192;
- break;
- case '1':
- midiData[52 + (6 * count * (repeat + 1) - 1)] += 96;
- restSpec[count] = 96;
- break;
- case '2':
- midiData[52 + (6 * count * (repeat + 1) - 1)] += 48;
- restSpec[count] = 48;
- break;
- case '3':
- midiData[52 + (6 * count * (repeat + 1) - 1)] += 24;
- restSpec[count] = 24;
+ case '0':
+ midiData[52 + (6 * count * (repeat + 1) - 1)] += 192;
+ restSpec[count] = 192;
+ break;
+ case '1':
+ midiData[52 + (6 * count * (repeat + 1) - 1)] += 96;
+ restSpec[count] = 96;
+ break;
+ case '2':
+ midiData[52 + (6 * count * (repeat + 1) - 1)] += 48;
+ restSpec[count] = 48;
+ break;
+ case '3':
+ midiData[52 + (6 * count * (repeat + 1) - 1)] += 24;
+ restSpec[count] = 24;
+ break;
+ case '4':
+ midiData[52 + (6 * count * (repeat + 1) - 1)] += 12;
+ restSpec[count] = 12;
+ break;
+ case '5':
+ midiData[52 + (6 * count * (repeat + 1) - 1)] += 6;
+ restSpec[count] = 6;
+ break;
+ default:
+ break;
+ }
+
+ if (Melody[count].rest_specifier != '%') {
+ switch (Melody[count].rest_specifier) {
+ case '.':
+ midiData[52 + (6 * count * (repeat + 1) - 1)] += (restSpec[count] / 2);
break;
- case '4':
- midiData[52 + (6 * count * (repeat + 1) - 1)] += 12;
- restSpec[count] = 12;
+ case ':':
+ midiData[52 + (6 * count * (repeat + 1) - 1)] += restSpec[count];
break;
- case '5':
- midiData[52 + (6 * count * (repeat + 1) - 1)] += 6;
- restSpec[count] = 6;
+ case ';':
+ midiData[52 + (6 * count * (repeat + 1) - 1)] -= (restSpec[count] / 3);
break;
default:
break;
- }
-
- if (Melody[count].rest_specifier != '%') {
- switch (Melody[count].rest_specifier) {
- case '.':
- midiData[52 + (6 * count * (repeat + 1) - 1)] += (restSpec[count] / 2);
- break;
- case ':':
- midiData[52 + (6 * count * (repeat + 1) - 1)] += restSpec[count];
- break;
- case ';':
- midiData[52 + (6 * count * (repeat + 1) - 1)] -= (restSpec[count] / 3);
- break;
- default:
- break;
}
}
noteTotal[6 * count + 1] = MIDI_LIMIT;
switch (Melody[number].vol) {
- case '+':
- noteTotal[6 * number + 1] = noteTotal[6 * (number - 1) + 1] + VOL_INTERVAL;
- break;
- case '-':
- noteTotal[6 * number + 1] = noteTotal[6 * (number - 1) + 1] - VOL_INTERVAL;
- break;
- default:
- break;
+ case '+':
+ noteTotal[6 * number + 1] = noteTotal[6 * (number - 1) + 1] + VOL_INTERVAL;
+ break;
+ case '-':
+ noteTotal[6 * number + 1] = noteTotal[6 * (number - 1) + 1] - VOL_INTERVAL;
+ break;
+ default:
+ break;
}
if (noteTotal[6 * number + 1] > MIDI_LIMIT)
pMelodyBuf++;
switch (*pMelodyBuf) {
- case '0':
- midiVol = AV_MIDI_VOL_MAX;
- break;
- case '1':
- midiVol = AV_MIDI_VOL_MAX;
- break;
- case '2':
- midiVol = AV_MIDI_VOL_MAX;
- break;
- case '3':
- midiVol = AV_MIDI_VOL_MAX;
- break;
- case '4':
- midiVol = AV_MIDI_VOL_MAX;
- break;
- case '5':
- midiVol = AV_MIDI_VOL_MAX;
- break;
- default:
- midiVol = AV_MIDI_VOL_MAX;
- break;
+ case '0':
+ midiVol = AV_MIDI_VOL_MAX;
+ break;
+ case '1':
+ midiVol = AV_MIDI_VOL_MAX;
+ break;
+ case '2':
+ midiVol = AV_MIDI_VOL_MAX;
+ break;
+ case '3':
+ midiVol = AV_MIDI_VOL_MAX;
+ break;
+ case '4':
+ midiVol = AV_MIDI_VOL_MAX;
+ break;
+ case '5':
+ midiVol = AV_MIDI_VOL_MAX;
+ break;
+ default:
+ midiVol = AV_MIDI_VOL_MAX;
+ break;
}
}
else
switch (*pMelodyBuf) {
- case '0':
- midiVol = 0;
- break;
- case '2':
- midiVol = AV_MIDI_VOL_MAX;
- break;
- case '3':
- midiVol = AV_MIDI_VOL_MAX;
- break;
- case '4':
- midiVol = AV_MIDI_VOL_MAX;
- break;
- case '5':
- midiVol = AV_MIDI_VOL_MAX;
- break;
- case '6':
- midiVol = AV_MIDI_VOL_MAX;
- break;
- case '7':
- midiVol = AV_MIDI_VOL_MAX;
- break;
- case '8':
- midiVol = AV_MIDI_VOL_MAX;
- break;
- case '9':
- midiVol = AV_MIDI_VOL_MAX;
- break;
- default:
- midiVol = AV_MIDI_VOL_MAX;
- break;
+ case '0':
+ midiVol = 0;
+ break;
+ case '2':
+ midiVol = AV_MIDI_VOL_MAX;
+ break;
+ case '3':
+ midiVol = AV_MIDI_VOL_MAX;
+ break;
+ case '4':
+ midiVol = AV_MIDI_VOL_MAX;
+ break;
+ case '5':
+ midiVol = AV_MIDI_VOL_MAX;
+ break;
+ case '6':
+ midiVol = AV_MIDI_VOL_MAX;
+ break;
+ case '7':
+ midiVol = AV_MIDI_VOL_MAX;
+ break;
+ case '8':
+ midiVol = AV_MIDI_VOL_MAX;
+ break;
+ case '9':
+ midiVol = AV_MIDI_VOL_MAX;
+ break;
+ default:
+ midiVol = AV_MIDI_VOL_MAX;
+ break;
}
}
#define AvSMW_CNVID_HVS (9) /* HV Script */
#define AvSMW_CNVID_WAV (11) /* WAVE */
-#define AvSMW_SUCCESS (0) /* success */
+#define AvSMW_SUCCESS (0) /* success */
#define AvSMW_ERROR (-1) /* error */
#define AvSMW_ERROR_ARGUMENT (-2) /* error of arguments */
#define AvSMW_ERROR_RESOURCE_OVER (-3) /* over specified resources */
-#define AvSMW_ERROR_ID (-4) /* error id number */
-#define AvSMW_ERROR_TIMEOUT (-5) /* timeout */
+#define AvSMW_ERROR_ID (-4) /* error id number */
+#define AvSMW_ERROR_TIMEOUT (-5) /* timeout */
#define AvSMW_ERROR_SOFTRESET (-6) /* error of soft reset for MA-5 */
#define AvSMW_ERROR_FILE (-16) /* file error */
#define AvSMW_ERROR_CONTENTS_TYPE (-18) /* SMAF Contents Type shows can't play */
#define AvSMW_ERROR_CHUNK_SIZE (-19) /* illegal SAvF Chunk Size value */
#define AvSMW_ERROR_CHUNK (-20) /* illegal SAvF Track Chunk value */
-#define AvSMW_ERROR_UNMATCHED_TAG (-21) /* unmathced specified TAG */
-#define AvSMW_ERROR_SHORT_LENGTH (-22) /* short sequence */
-#define AvSMW_ERROR_LONG_LENGTH (-23) /* long sequence */
+#define AvSMW_ERROR_UNMATCHED_TAG (-21) /* unmathced specified TAG */
+#define AvSMW_ERROR_SHORT_LENGTH (-22) /* short sequence */
+#define AvSMW_ERROR_LONG_LENGTH (-23) /* long sequence */
#define AvSMW_ERROR_UNSUPPORTED (-24) /* unsupported format */
#define AvSMW_ERROR_NO_INFORMATION (-25) /* no specified information */
#define AvSMW_ERROR_HV_CONFLICT (-26) /* conflict about HV resource */
#define SINT signed int
#define SINT8 signed char
-#define SINT16 signed short
-#define SINT32 signed long
+#define SINT16 signed short
+#define SINT32 signed long
#define UINT unsigned int
-#define UINT8 unsigned char
+#define UINT8 unsigned char
#define UINT16 unsigned short
-#define UINT32 unsigned long
-#define ULONG unsigned long
+#define UINT32 unsigned long
+#define ULONG unsigned long
/*--------------------------------------------------------------------------*/
/* Defines */
if (info->title) {
tag_len = strlen(info->title);
cnv_len = 0;
- formatContext->title = mmfile_string_convert((const char *)info->title,
- tag_len,
- "UTF-8",
- locale,
- NULL,
- (unsigned int *)&cnv_len);
+ formatContext->title = mmfile_string_convert((const char *)info->title, tag_len, "UTF-8", locale, NULL, (unsigned int *)&cnv_len);
if (formatContext->title == NULL) {
debug_warning(DEBUG, "failed to UTF8 convert.\n");
formatContext->title = mmfile_strdup(info->title);
if (info->copyright) {
tag_len = strlen(info->copyright);
cnv_len = 0;
- formatContext->copyright = mmfile_string_convert((const char *)info->copyright,
- tag_len,
- "UTF-8",
- locale,
- NULL,
- (unsigned int *)&cnv_len);
+ formatContext->copyright = mmfile_string_convert((const char *)info->copyright, tag_len, "UTF-8", locale, NULL, (unsigned int *)&cnv_len);
if (formatContext->copyright == NULL) {
debug_warning(DEBUG, "failed to UTF8 convert.\n");
formatContext->copyright = mmfile_strdup(info->copyright);
if (info->comment) {
tag_len = strlen(info->comment);
cnv_len = 0;
- formatContext->comment = mmfile_string_convert((const char *)info->comment,
- tag_len,
- "UTF-8",
- locale,
- NULL,
- (unsigned int *)&cnv_len);
+ formatContext->comment = mmfile_string_convert((const char *)info->comment, tag_len, "UTF-8", locale, NULL, (unsigned int *)&cnv_len);
if (formatContext->comment == NULL) {
debug_warning(DEBUG, "failed to UTF8 convert.\n");
formatContext->comment = mmfile_strdup(info->comment);
/*check format*/
if (!(memcmp(pbFile, MMFILE_XMF_100, 8)) ||
- !(memcmp(pbFile, MMFILE_XMF_101, 8)) ||
- !(memcmp(pbFile, MMFILE_MXMF_200, 8))) {
+ !(memcmp(pbFile, MMFILE_XMF_101, 8)) ||
+ !(memcmp(pbFile, MMFILE_MXMF_200, 8))) {
is_xmf = 1;
codecType = AV_DEC_AUDIO_XMF;
UINT32 sdTotalTicks;
SINT32 sdCurrentTime;
SINT32 sdDelta;
- PMIDCHINFO pCh;
+ PMIDCHINFO pCh;
UINT32 dCh;
UINT32 dSetup; /* bit0:beat@0, bit1:tempo@0, bit2:GmOn@0, bit3:tempo@1 */
dCh = dCmd & 0x0f;
switch (dCmd & 0xf0) {
- case 0x90: /* NoteOn */
- /* Conductor Track Note Check */
- if (sdTr == 0) dConductorNote |= 1;
- switch (dCurrBank[dCh] >> 8) {
- case 0x79:
- /* Melody */
- break;
-
- case 0x78:
- /* Drum */
- pI->bVoiceMap[DRUM_MAP][pMt->pbBase[pMt->dOffset] & 0x7F] = 1;
- break;
-
- default:
- if (dCh == 9) {
- /* Unknown: default GM Drum */
- pI->bVoiceMap[DRUM_MAP][pMt->pbBase[pMt->dOffset] & 0x7F] = 1;
- }
- }
- pMt->dOffset += 2;
+ case 0x90: /* NoteOn */
+ /* Conductor Track Note Check */
+ if (sdTr == 0) dConductorNote |= 1;
+ switch (dCurrBank[dCh] >> 8) {
+ case 0x79:
+ /* Melody */
break;
- case 0xC0: /* Program change */
- switch (dBank[dCh] >> 8) {
- case 0x79:
- if (dBank[dCh] != 0x7906) {
- /* Melody */
- pI->bVoiceMap[MELODY_MAP][pMt->pbBase[pMt->dOffset] & 0x7F] = 1;
- } else {
- /* Vibration Note */
- pI->dVibNoteVoice = 1;
- }
- break;
-
- case 0x78:
- /* Drum */
- break;
+ case 0x78:
+ /* Drum */
+ pI->bVoiceMap[DRUM_MAP][pMt->pbBase[pMt->dOffset] & 0x7F] = 1;
+ break;
- default:
- /* default GM Melody */
- if (dCh != 9) {
- pI->bVoiceMap[MELODY_MAP][pMt->pbBase[pMt->dOffset] & 0x7F] = 1;
- }
+ default:
+ if (dCh == 9) {
+ /* Unknown: default GM Drum */
+ pI->bVoiceMap[DRUM_MAP][pMt->pbBase[pMt->dOffset] & 0x7F] = 1;
+ }
+ }
+ pMt->dOffset += 2;
+ break;
+
+ case 0xC0: /* Program change */
+ switch (dBank[dCh] >> 8) {
+ case 0x79:
+ if (dBank[dCh] != 0x7906) {
+ /* Melody */
+ pI->bVoiceMap[MELODY_MAP][pMt->pbBase[pMt->dOffset] & 0x7F] = 1;
+ } else {
+ /* Vibration Note */
+ pI->dVibNoteVoice = 1;
}
-
- dCurrBank[dCh] = dBank[dCh];
- pMt->dOffset++;
break;
- case 0xD0: /* Channel pressure */
- pMt->dOffset++;
+ case 0x78:
+ /* Drum */
break;
- case 0xB0: /* Control Change */
- switch (pMt->pbBase[pMt->dOffset]) {
- case 0x00: /* Bank select(MSB) */
- dBank[dCh] = (dBank[dCh] & 0x00FF) | (pMt->pbBase[pMt->dOffset + 1] << 8);
- break;
-
- case 0x20: /* Bank select (LSB) */
- dBank[dCh] = (dBank[dCh] & 0xFF00) | pMt->pbBase[pMt->dOffset + 1];
- break;
- default:
- break;
+ default:
+ /* default GM Melody */
+ if (dCh != 9) {
+ pI->bVoiceMap[MELODY_MAP][pMt->pbBase[pMt->dOffset] & 0x7F] = 1;
}
- pMt->dOffset += 2;
+ }
+
+ dCurrBank[dCh] = dBank[dCh];
+ pMt->dOffset++;
+ break;
+
+ case 0xD0: /* Channel pressure */
+ pMt->dOffset++;
+ break;
+
+ case 0xB0: /* Control Change */
+ switch (pMt->pbBase[pMt->dOffset]) {
+ case 0x00: /* Bank select(MSB) */
+ dBank[dCh] = (dBank[dCh] & 0x00FF) | (pMt->pbBase[pMt->dOffset + 1] << 8);
break;
+ case 0x20: /* Bank select (LSB) */
+ dBank[dCh] = (dBank[dCh] & 0xFF00) | pMt->pbBase[pMt->dOffset + 1];
+ break;
default:
- pMt->dOffset += 2;
break;
+ }
+ pMt->dOffset += 2;
+ break;
+
+ default:
+ pMt->dOffset += 2;
+ break;
}
} else {
switch (dCmd) {
- case 0xF0: /* SysEx */
- case 0xF7: /* SysEx */
- pMt->dSmfCmd = 0;
- dSize = 0;
- do {
- dTemp = (UINT32)pMt->pbBase[pMt->dOffset++];
- dSize = (dSize << 7) + (dTemp & 0x7f);
- } while (dTemp >= 0x80);
-
- if ((dSize == 5) &&
- (pMt->pbBase[pMt->dOffset] == 0x7e) &&
- (pMt->pbBase[pMt->dOffset + 1] == 0x7f) &&
- (pMt->pbBase[pMt->dOffset + 2] == 0x09) &&
- (pMt->pbBase[pMt->dOffset + 3] == 0x01)) {
- /* System On */
- if (sdTotalTicks == 0) {
- dSetup |= 0x04;
- }
- } else {
- if (pI->dSetupBar == 0) {
- if ((dSize == 22) &&
- (pMt->pbBase[pMt->dOffset] == 0x43) &&
- (pMt->pbBase[pMt->dOffset + 1] == 0x79) &&
- (pMt->pbBase[pMt->dOffset + 2] == 0x06) &&
- (pMt->pbBase[pMt->dOffset + 3] == 0x7C) &&
- (pMt->pbBase[pMt->dOffset + 4] == 0x02)) {
- /* Channel status */
- for (dCh = 0; dCh < 16; dCh++) {
- pCh = &pI->ChInfo[dCh];
- dTemp = pMt->pbBase[pMt->dOffset + 5 + dCh];
- pCh->dKeyCon = (dTemp >> 2) & 0x03;
- pCh->dVibSync = (dTemp >> 1) & 0x01;
- pCh->dLedSync = dTemp & 0x01;
- }
+ case 0xF0: /* SysEx */
+ case 0xF7: /* SysEx */
+ pMt->dSmfCmd = 0;
+ dSize = 0;
+ do {
+ dTemp = (UINT32)pMt->pbBase[pMt->dOffset++];
+ dSize = (dSize << 7) + (dTemp & 0x7f);
+ } while (dTemp >= 0x80);
+
+ if ((dSize == 5) &&
+ (pMt->pbBase[pMt->dOffset] == 0x7e) &&
+ (pMt->pbBase[pMt->dOffset + 1] == 0x7f) &&
+ (pMt->pbBase[pMt->dOffset + 2] == 0x09) &&
+ (pMt->pbBase[pMt->dOffset + 3] == 0x01)) {
+ /* System On */
+ if (sdTotalTicks == 0) {
+ dSetup |= 0x04;
+ }
+ } else {
+ if (pI->dSetupBar == 0) {
+ if ((dSize == 22) &&
+ (pMt->pbBase[pMt->dOffset] == 0x43) &&
+ (pMt->pbBase[pMt->dOffset + 1] == 0x79) &&
+ (pMt->pbBase[pMt->dOffset + 2] == 0x06) &&
+ (pMt->pbBase[pMt->dOffset + 3] == 0x7C) &&
+ (pMt->pbBase[pMt->dOffset + 4] == 0x02)) {
+ /* Channel status */
+ for (dCh = 0; dCh < 16; dCh++) {
+ pCh = &pI->ChInfo[dCh];
+ dTemp = pMt->pbBase[pMt->dOffset + 5 + dCh];
+ pCh->dKeyCon = (dTemp >> 2) & 0x03;
+ pCh->dVibSync = (dTemp >> 1) & 0x01;
+ pCh->dLedSync = dTemp & 0x01;
}
}
}
+ }
+
+ pMt->dOffset += dSize;
+ break;
+
+ case 0xF1: /* System Msg */
+ case 0xF3: /* System Msg */
+ pMt->dOffset++;
+ break;
+
+ case 0xF2: /* System Msg */
+ pMt->dOffset += 2;
+ break;
+
+ case 0xFF: /* Meta */
+ dCmd2 = (UINT32)pMt->pbBase[pMt->dOffset++]; /* Meta Command */
+ dSize = 0; /* Size */
+ do {
+ dTemp = (UINT32)pMt->pbBase[pMt->dOffset++];
+ dSize = (dSize << 7) + (dTemp & 0x7f);
+ } while (dTemp >= 0x80);
+
+ switch (dCmd2) {
+ case 0x01: /* Text */
+ if (pI->pbText == NULL) {
+ pI->pbText = &pMt->pbBase[pMt->dOffset];
+ pI->dSizeText = dSize;
+ }
+ break;
- pMt->dOffset += dSize;
+ case 0x02: /* Copyright */
+ if (pI->pbCopyright == NULL) {
+ pI->pbCopyright = &pMt->pbBase[pMt->dOffset];
+ pI->dSizeCopyright = dSize;
+ }
break;
- case 0xF1: /* System Msg */
- case 0xF3: /* System Msg */
- pMt->dOffset++;
+ case 0x06: /* Title */
+ if (pI->pbTitle == NULL) {
+ pI->pbTitle = &pMt->pbBase[pMt->dOffset];
+ pI->dSizeTitle = dSize;
+ }
break;
- case 0xF2: /* System Msg */
- pMt->dOffset += 2;
+ case 0x2f: /* End */
+ pI->dEndFlag &= ~(1L << sdTr);
break;
- case 0xFF: /* Meta */
- dCmd2 = (UINT32)pMt->pbBase[pMt->dOffset++]; /* Meta Command */
- dSize = 0; /* Size */
- do {
- dTemp = (UINT32)pMt->pbBase[pMt->dOffset++];
- dSize = (dSize << 7) + (dTemp & 0x7f);
- } while (dTemp >= 0x80);
-
- switch (dCmd2) {
- case 0x01: /* Text */
- if (pI->pbText == NULL) {
- pI->pbText = &pMt->pbBase[pMt->dOffset];
- pI->dSizeText = dSize;
- }
- break;
+ case 0x51: /* Set Tempo */
+ switch (dSize) {
+ case 3:
+ case 4:
+ dTime = ((UINT32)pMt->pbBase[pMt->dOffset] << 16) +
+ ((UINT32)pMt->pbBase[pMt->dOffset + 1] << 8) +
+ (UINT32)pMt->pbBase[pMt->dOffset + 2];
+ if ((sdTotalTicks == 0) && (dTime == 250000)) dSetup |= 0x02;
+ if (sdTotalTicks == (UINT32)pI->dTimeResolution) dSetup |= 0x08;
- case 0x02: /* Copyright */
- if (pI->pbCopyright == NULL) {
- pI->pbCopyright = &pMt->pbBase[pMt->dOffset];
- pI->dSizeCopyright = dSize;
- }
- break;
+ /*<== I Think that Below Code is Trash!! and Erase it! (Actually I Don Know ^^)
+ dTime = (dTime << 7) / 125; */
- case 0x06: /* Title */
- if (pI->pbTitle == NULL) {
- pI->pbTitle = &pMt->pbBase[pMt->dOffset];
- pI->dSizeTitle = dSize;
- }
- break;
-
- case 0x2f: /* End */
- pI->dEndFlag &= ~(1L << sdTr);
- break;
-
- case 0x51: /* Set Tempo */
- switch (dSize) {
- case 3:
- case 4:
- dTime = ((UINT32)pMt->pbBase[pMt->dOffset] << 16) +
- ((UINT32)pMt->pbBase[pMt->dOffset + 1] << 8) +
- (UINT32)pMt->pbBase[pMt->dOffset + 2];
- if ((sdTotalTicks == 0) && (dTime == 250000)) dSetup |= 0x02;
- if (sdTotalTicks == (UINT32)pI->dTimeResolution) dSetup |= 0x08;
-
- /*<== I Think that Below Code is Trash!! and Erase it! (Actually I Don Know ^^)
- dTime = (dTime << 7) / 125; */
-
- sdDelta = (UINT32)(dTime / (pI->dTimeResolution > 0 ? pI->dTimeResolution : 1));
- break;
-
- default:
- break;
- }
- break;
-
- case 0x58: /* Set TimeSignature */
- if ((sdTotalTicks == 0) &&
- (pMt->pbBase[pMt->dOffset] == 1) &&
- (pMt->pbBase[pMt->dOffset + 1] == 2)) dSetup |= 0x01;
- break;
- default:
- break;
+ sdDelta = (UINT32)(dTime / (pI->dTimeResolution > 0 ? pI->dTimeResolution : 1));
+ break;
+
+ default:
+ break;
}
- pMt->dOffset += dSize;
+ break;
+
+ case 0x58: /* Set TimeSignature */
+ if ((sdTotalTicks == 0) &&
+ (pMt->pbBase[pMt->dOffset] == 1) &&
+ (pMt->pbBase[pMt->dOffset + 1] == 2)) dSetup |= 0x01;
break;
default:
break;
+ }
+ pMt->dOffset += dSize;
+ break;
+ default:
+ break;
}
}
UINT8 *fp = src_fp;
/* debug_msg(DEBUG, "input param: %p, %d\n", fp, dFsize); */
while (dFsize >= 22) {
- dTemp = ((UINT32)fp[0] << 24) + ((UINT32)fp[1] << 16) +
- ((UINT32)fp[2] << 8) + (UINT32)fp[3];
+ dTemp = ((UINT32)fp[0] << 24) + ((UINT32)fp[1] << 16) + ((UINT32)fp[2] << 8) + (UINT32)fp[3];
if (dTemp == 0x4D546864) break; /* 'MThd' */
fp++;
dFsize--;
dFsize -= 4;
/*--- Check size ----------------------------------------------------*/
- dTemp = ((UINT32)fp[0] << 24) + ((UINT32)fp[1] << 16) +
- ((UINT32)fp[2] << 8) + (UINT32)fp[3];
+ dTemp = ((UINT32)fp[0] << 24) + ((UINT32)fp[1] << 16) + ((UINT32)fp[2] << 8) + (UINT32)fp[3];
if (dTemp != 6) {
debug_error(DEBUG, "__AvCheckSizeOfMidFile Error / Size != 6\n");
for (i = 0; i < dNumOfTracks; i++) {
/*--- Check chunk name --------------------------------------------*/
while (dFsize >= 8) {
- dTemp = ((UINT32)fp[0] << 24) + ((UINT32)fp[1] << 16) +
- ((UINT32)fp[2] << 8) + (UINT32)fp[3];
+ dTemp = ((UINT32)fp[0] << 24) + ((UINT32)fp[1] << 16) + ((UINT32)fp[2] << 8) + (UINT32)fp[3];
if (dTemp == 0x4D54726B) break; /* 'MTrk' */
fp++;
dFsize--;
}
/*--- Check size ----------------------------------------------------*/
- dSize = ((UINT32)fp[4] << 24) + ((UINT32)fp[5] << 16) +
- ((UINT32)fp[6] << 8) + (UINT32)fp[7];
+ dSize = ((UINT32)fp[4] << 24) + ((UINT32)fp[5] << 16) + ((UINT32)fp[6] << 8) + (UINT32)fp[7];
if (dFsize < (dSize + 8)) {
debug_error(DEBUG, "__AvCheckSizeOfMidFile Error/ Bad size [%ld] vs [%ld]\n", dFsize, dSize + 22);
#define AV_MMF_CONTENTS_TYPE_5 0x50
-#define AVMASMW_SUCCESS (0) /* success */
+#define AVMASMW_SUCCESS (0) /* success */
#define AVMASMW_ERROR (-1) /* error */
#define AVMASMW_ERROR_ARGUMENT (-2) /* error of arguments */
#define AVMASMW_ERROR_RESOURCE_OVER (-3) /* over specified resources */
-#define AVMASMW_ERROR_ID (-4) /* error id number */
-#define AVMASMW_ERROR_TIMEOUT (-5) /* timeout */
+#define AVMASMW_ERROR_ID (-4) /* error id number */
+#define AVMASMW_ERROR_TIMEOUT (-5) /* timeout */
#define AVMASMW_ERROR_SOFTRESET (-6) /* error of soft reset for MA-5 */
#define AVMASMW_ERROR_FILE (-16) /* file error */
#define AVMASMW_ERROR_CONTENTS_TYPE (-18) /* SAVMAF Contents Type shows can't play */
#define AVMASMW_ERROR_CHUNK_SIZE (-19) /* illegal SMAF Chunk Size value */
#define AVMASMW_ERROR_CHUNK (-20) /* illegal SMAF Track Chunk value */
-#define AVMASMW_ERROR_UNMATCHED_TAG (-21) /* unmathced specified TAG */
-#define AVMASMW_ERROR_SHORT_LENGTH (-22) /* short sequence */
-#define AVMASMW_ERROR_LONG_LENGTH (-23) /* long sequence */
+#define AVMASMW_ERROR_UNMATCHED_TAG (-21) /* unmathced specified TAG */
+#define AVMASMW_ERROR_SHORT_LENGTH (-22) /* short sequence */
+#define AVMASMW_ERROR_LONG_LENGTH (-23) /* long sequence */
#define AVMASMW_ERROR_UNSUPPORTED (-24) /* unsupported format */
#define AVMASMW_ERROR_NO_INFORMATION (-25) /* no specified information */
#define AVMASMW_ERROR_HV_CONFLICT (-26) /* conflict about HV resource */
#define AVMALIB_MAKEDWORD(a, b, c, d) (unsigned int)(((unsigned int)(a) << 24) | \
- ((unsigned int)(b) << 16) | ((unsigned int)(c) << 8) | (unsigned int)(d))
+ ((unsigned int)(b) << 16) | ((unsigned int)(c) << 8) | (unsigned int)(d))
/****************************************************************************
* define
typedef struct AvTagHuffmanInfo {
unsigned int dMtsqSize; /* size of Mtsq(Atsq) Body */
unsigned int dSeqSize; /* size of sequence data */
- unsigned int dReadSize; /* read data size */
+ unsigned int dReadSize; /* read data size */
short swLeft[512]; /* Huffman Tree (Left) */
short swRight[512]; /* Huffman Tree (Right) */
unsigned char *psBuffer; /* pointer to reference area */
unsigned char *pbSeq; /* pointer to next event data */
unsigned int dIndex; /* index of next event */
unsigned int dTrackNo; /* track no. */
- void *pvNext; /* pointer to next event block */
+ void *pvNext; /* pointer to next event block */
} EVENTBLOCK, *PEVENTBLOCK;
/* Note OFF information structure */
unsigned int dCmd; /* command ID (sound driver) */
unsigned int dCh; /* channel no. */
unsigned int dKey; /* key no. */
- void *pvNext; /* pointer to next note off block */
+ void *pvNext; /* pointer to next note off block */
} OFFBLOCK, *POFFBLOCK;
/* Playback information structure */
_mmf_Get4Byte(unsigned char *pbBuf)
{
return (unsigned int)((((unsigned int)pbBuf[0]) << 24) +
- (((unsigned int)pbBuf[1]) << 16) +
- (((unsigned int)pbBuf[2]) << 8) +
- ((unsigned int)pbBuf[3]));
+ (((unsigned int)pbBuf[1]) << 16) +
+ (((unsigned int)pbBuf[2]) << 8) +
+ ((unsigned int)pbBuf[3]));
}
_mmf_GetTimebase(unsigned char bData)
{
switch (bData) {
- case 0x02:
- return 4; /* 4[msec/tick] */
- case 0x03:
- return 5; /* 5[msec/tick] */
- case 0x10:
- return 10; /* 10[msec/tick] */
- case 0x11:
- return 20; /* 20[msec/tick] */
- case 0x12:
- return 40; /* 40[msec/tick] */
- case 0x13:
- return 50; /* 50[msec/tick] */
- default:
- return AV_MMF_FUNC_ERROR; /* Time Base Error */
+ case 0x02:
+ return 4; /* 4[msec/tick] */
+ case 0x03:
+ return 5; /* 5[msec/tick] */
+ case 0x10:
+ return 10; /* 10[msec/tick] */
+ case 0x11:
+ return 20; /* 20[msec/tick] */
+ case 0x12:
+ return 40; /* 40[msec/tick] */
+ case 0x13:
+ return 50; /* 50[msec/tick] */
+ default:
+ return AV_MMF_FUNC_ERROR; /* Time Base Error */
}
}
dChunkSize = AVMALIB_MAKEDWORD(pbFile[4], pbFile[5], pbFile[6], pbFile[7]);
switch (dChunkID) {
- case AVMALIB_CHUNKID_MMMD:
- *pdChunkID = AVMALIB_CHUNKCODE_MMMD;
- if (dState != AVMALIB_CHUNK_PHASE_MMMD)
- return AVMALIB_CHUNK_ID_ERROR;
- break;
- case AVMALIB_CHUNKID_CNTI:
- *pdChunkID = AVMALIB_CHUNKCODE_CNTI;
- if (dState != AVMALIB_CHUNK_PHASE_CNTI)
- return AVMALIB_CHUNK_ID_ERROR;
- break;
- case AVMALIB_CHUNKID_OPDA:
- *pdChunkID = AVMALIB_CHUNKCODE_OPDA;
+ case AVMALIB_CHUNKID_MMMD:
+ *pdChunkID = AVMALIB_CHUNKCODE_MMMD;
+ if (dState != AVMALIB_CHUNK_PHASE_MMMD)
+ return AVMALIB_CHUNK_ID_ERROR;
+ break;
+ case AVMALIB_CHUNKID_CNTI:
+ *pdChunkID = AVMALIB_CHUNKCODE_CNTI;
+ if (dState != AVMALIB_CHUNK_PHASE_CNTI)
+ return AVMALIB_CHUNK_ID_ERROR;
+ break;
+ case AVMALIB_CHUNKID_OPDA:
+ *pdChunkID = AVMALIB_CHUNKCODE_OPDA;
+ if (dState != AVMALIB_CHUNK_PHASE_MMMDSUB)
+ return AVMALIB_CHUNK_ID_ERROR;
+ break;
+ case AVMALIB_CHUNKID_MSPI:
+ *pdChunkID = AVMALIB_CHUNKCODE_MSPI;
+ if (dState != AVMALIB_CHUNK_PHASE_MTRSUB)
+ return AVMALIB_CHUNK_ID_ERROR;
+ break;
+ case AVMALIB_CHUNKID_MTSU:
+ *pdChunkID = AVMALIB_CHUNKCODE_MTSU;
+ if (dState != AVMALIB_CHUNK_PHASE_MTRSUB)
+ return AVMALIB_CHUNK_ID_ERROR;
+ break;
+ case AVMALIB_CHUNKID_MTSQ:
+ *pdChunkID = AVMALIB_CHUNKCODE_MTSQ;
+ if (dState != AVMALIB_CHUNK_PHASE_MTRSUB)
+ return AVMALIB_CHUNK_ID_ERROR;
+ break;
+ case AVMALIB_CHUNKID_MTSP:
+ *pdChunkID = AVMALIB_CHUNKCODE_MTSP;
+ if (dState != AVMALIB_CHUNK_PHASE_MTRSUB)
+ return AVMALIB_CHUNK_ID_ERROR;
+ break;
+ case AVMALIB_CHUNKID_ASPI:
+ *pdChunkID = AVMALIB_CHUNKCODE_ASPI;
+ if (dState != AVMALIB_CHUNK_PHASE_ATRSUB)
+ return AVMALIB_CHUNK_ID_ERROR;
+ break;
+ case AVMALIB_CHUNKID_ATSU:
+ *pdChunkID = AVMALIB_CHUNKCODE_ATSU;
+ if (dState != AVMALIB_CHUNK_PHASE_ATRSUB)
+ return AVMALIB_CHUNK_ID_ERROR;
+ break;
+ case AVMALIB_CHUNKID_ATSQ:
+ *pdChunkID = AVMALIB_CHUNKCODE_ATSQ;
+ if (dState != AVMALIB_CHUNK_PHASE_ATRSUB)
+ return AVMALIB_CHUNK_ID_ERROR;
+ break;
+
+ case AVMALIB_CHUNKID_MTHV:
+ *pdChunkID = AVMALIB_CHUNKCODE_MTHV;
+ if (dState != AVMALIB_CHUNK_PHASE_MTRSUB)
+ return AVMALIB_CHUNK_ID_ERROR;
+ break;
+ case AVMALIB_CHUNKID_MHVS:
+ *pdChunkID = AVMALIB_CHUNKCODE_MHVS;
+ if (dState != AVMALIB_CHUNK_PHASE_MTHVSUB)
+ return AVMALIB_CHUNK_ID_ERROR;
+ break;
+ case AVMALIB_CHUNKID_MHSC:
+ *pdChunkID = AVMALIB_CHUNKCODE_MHSC;
+ if (dState != AVMALIB_CHUNK_PHASE_MTHVSUB)
+ return AVMALIB_CHUNK_ID_ERROR;
+ break;
+
+ default:
+ *pdChunkNo = (unsigned char)(dChunkID & 0x000000FF);
+ switch (dChunkID & 0xFFFFFF00) {
+ case AVMALIB_CHUNKID_MTR:
+ *pdChunkID = AVMALIB_CHUNKCODE_MTR;
if (dState != AVMALIB_CHUNK_PHASE_MMMDSUB)
return AVMALIB_CHUNK_ID_ERROR;
break;
- case AVMALIB_CHUNKID_MSPI:
- *pdChunkID = AVMALIB_CHUNKCODE_MSPI;
- if (dState != AVMALIB_CHUNK_PHASE_MTRSUB)
- return AVMALIB_CHUNK_ID_ERROR;
- break;
- case AVMALIB_CHUNKID_MTSU:
- *pdChunkID = AVMALIB_CHUNKCODE_MTSU;
- if (dState != AVMALIB_CHUNK_PHASE_MTRSUB)
- return AVMALIB_CHUNK_ID_ERROR;
- break;
- case AVMALIB_CHUNKID_MTSQ:
- *pdChunkID = AVMALIB_CHUNKCODE_MTSQ;
- if (dState != AVMALIB_CHUNK_PHASE_MTRSUB)
+ case AVMALIB_CHUNKID_ATR:
+ *pdChunkID = AVMALIB_CHUNKCODE_ATR;
+ if (dState != AVMALIB_CHUNK_PHASE_MMMDSUB)
return AVMALIB_CHUNK_ID_ERROR;
break;
- case AVMALIB_CHUNKID_MTSP:
- *pdChunkID = AVMALIB_CHUNKCODE_MTSP;
- if (dState != AVMALIB_CHUNK_PHASE_MTRSUB)
+
+ case AVMALIB_CHUNKID_DCH:
+ *pdChunkID = AVMALIB_CHUNKCODE_DCH;
+ if (dState != AVMALIB_CHUNK_PHASE_OPDASUB)
return AVMALIB_CHUNK_ID_ERROR;
break;
- case AVMALIB_CHUNKID_ASPI:
- *pdChunkID = AVMALIB_CHUNKCODE_ASPI;
- if (dState != AVMALIB_CHUNK_PHASE_ATRSUB)
+ case AVMALIB_CHUNKID_M5P:
+ *pdChunkID = AVMALIB_CHUNKCODE_M5P;
+ if (dState != AVMALIB_CHUNK_PHASE_OPDASUB)
return AVMALIB_CHUNK_ID_ERROR;
break;
- case AVMALIB_CHUNKID_ATSU:
- *pdChunkID = AVMALIB_CHUNKCODE_ATSU;
- if (dState != AVMALIB_CHUNK_PHASE_ATRSUB)
+
+ case AVMALIB_CHUNKID_MWA:
+ *pdChunkID = AVMALIB_CHUNKCODE_MWA;
+ if (dState != AVMALIB_CHUNK_PHASE_MTSPSUB)
return AVMALIB_CHUNK_ID_ERROR;
break;
- case AVMALIB_CHUNKID_ATSQ:
- *pdChunkID = AVMALIB_CHUNKCODE_ATSQ;
+
+ case AVMALIB_CHUNKID_AWA:
+ *pdChunkID = AVMALIB_CHUNKCODE_AWA;
if (dState != AVMALIB_CHUNK_PHASE_ATRSUB)
return AVMALIB_CHUNK_ID_ERROR;
break;
- case AVMALIB_CHUNKID_MTHV:
- *pdChunkID = AVMALIB_CHUNKCODE_MTHV;
- if (dState != AVMALIB_CHUNK_PHASE_MTRSUB)
- return AVMALIB_CHUNK_ID_ERROR;
- break;
- case AVMALIB_CHUNKID_MHVS:
- *pdChunkID = AVMALIB_CHUNKCODE_MHVS;
- if (dState != AVMALIB_CHUNK_PHASE_MTHVSUB)
- return AVMALIB_CHUNK_ID_ERROR;
- break;
- case AVMALIB_CHUNKID_MHSC:
- *pdChunkID = AVMALIB_CHUNKCODE_MHSC;
+ case AVMALIB_CHUNKID_HVP:
+ *pdChunkID = AVMALIB_CHUNKCODE_HVP;
if (dState != AVMALIB_CHUNK_PHASE_MTHVSUB)
return AVMALIB_CHUNK_ID_ERROR;
break;
default:
- *pdChunkNo = (unsigned char)(dChunkID & 0x000000FF);
- switch (dChunkID & 0xFFFFFF00) {
- case AVMALIB_CHUNKID_MTR:
- *pdChunkID = AVMALIB_CHUNKCODE_MTR;
- if (dState != AVMALIB_CHUNK_PHASE_MMMDSUB)
- return AVMALIB_CHUNK_ID_ERROR;
- break;
- case AVMALIB_CHUNKID_ATR:
- *pdChunkID = AVMALIB_CHUNKCODE_ATR;
- if (dState != AVMALIB_CHUNK_PHASE_MMMDSUB)
- return AVMALIB_CHUNK_ID_ERROR;
- break;
-
- case AVMALIB_CHUNKID_DCH:
- *pdChunkID = AVMALIB_CHUNKCODE_DCH;
- if (dState != AVMALIB_CHUNK_PHASE_OPDASUB)
- return AVMALIB_CHUNK_ID_ERROR;
- break;
- case AVMALIB_CHUNKID_M5P:
- *pdChunkID = AVMALIB_CHUNKCODE_M5P;
- if (dState != AVMALIB_CHUNK_PHASE_OPDASUB)
- return AVMALIB_CHUNK_ID_ERROR;
- break;
-
- case AVMALIB_CHUNKID_MWA:
- *pdChunkID = AVMALIB_CHUNKCODE_MWA;
- if (dState != AVMALIB_CHUNK_PHASE_MTSPSUB)
- return AVMALIB_CHUNK_ID_ERROR;
- break;
-
- case AVMALIB_CHUNKID_AWA:
- *pdChunkID = AVMALIB_CHUNKCODE_AWA;
- if (dState != AVMALIB_CHUNK_PHASE_ATRSUB)
- return AVMALIB_CHUNK_ID_ERROR;
- break;
-
- case AVMALIB_CHUNKID_HVP:
- *pdChunkID = AVMALIB_CHUNKCODE_HVP;
- if (dState != AVMALIB_CHUNK_PHASE_MTHVSUB)
- return AVMALIB_CHUNK_ID_ERROR;
- break;
-
- default:
- *pdChunkID = AVMALIB_CHUNKCODE_UNKNOWN;
- break;
- }
+ *pdChunkID = AVMALIB_CHUNKCODE_UNKNOWN;
break;
+ }
+ break;
}
if (dChunkSize > (dSize - AVMALIB_SIZE_OF_CHUNKHEADER))
/* Check Format Type */
switch (bSmafType) {
- case AV_MMF_SMAF_TYPE_MA1:
- case AV_MMF_SMAF_TYPE_MA2:
- if (psTrack->pbMtr[0] != 0x00) {
- return AV_MMF_ERR_CHUNK;
- }
- break;
- case AV_MMF_SMAF_TYPE_MA3:
- if ((psTrack->pbMtr[0] != 0x01) && (psTrack->pbMtr[0] != 0x02)) {
- return AV_MMF_ERR_CHUNK;
- }
- break;
- case AV_MMF_SMAF_TYPE_MA5:
- if (psTrack->pbMtr[0] != 0x02) {
- return AV_MMF_ERR_CHUNK;
- }
- break;
- default:
- break;
+ case AV_MMF_SMAF_TYPE_MA1:
+ case AV_MMF_SMAF_TYPE_MA2:
+ if (psTrack->pbMtr[0] != 0x00) {
+ return AV_MMF_ERR_CHUNK;
+ }
+ break;
+ case AV_MMF_SMAF_TYPE_MA3:
+ if ((psTrack->pbMtr[0] != 0x01) && (psTrack->pbMtr[0] != 0x02)) {
+ return AV_MMF_ERR_CHUNK;
+ }
+ break;
+ case AV_MMF_SMAF_TYPE_MA5:
+ if (psTrack->pbMtr[0] != 0x02) {
+ return AV_MMF_ERR_CHUNK;
+ }
+ break;
+ default:
+ break;
}
/* Check Sequence Type */
pbBuf = psTrack->pbMtr;
dSize = psTrack->dMtrSize;
while (dSize > (dIndex + AV_MMF_CHUNK_HEADER_SIZE)) {
- sdChunkSize = _mmf_MalibNextChunk(&pbBuf[dIndex], (dSize - dIndex),
- AVMALIB_CHUNK_PHASE_MTRSUB, &dChunkID, &dChunkNo);
+ sdChunkSize = _mmf_MalibNextChunk(&pbBuf[dIndex], (dSize - dIndex), AVMALIB_CHUNK_PHASE_MTRSUB, &dChunkID, &dChunkNo);
if (sdChunkSize < 0) {
return AV_MMF_ERR_CHUNK;
}
dIndex += AV_MMF_CHUNK_HEADER_SIZE;
switch (dChunkID) {
- case AVMALIB_CHUNKCODE_MSPI:
- psTrack->pbMspi = &(pbBuf[dIndex]);
- psTrack->dMspiSize = sdChunkSize;
- break;
- case AVMALIB_CHUNKCODE_MTSU:
- psTrack->pbMtsu = &(pbBuf[dIndex]);
- psTrack->dMtsuSize = sdChunkSize;
- break;
- case AVMALIB_CHUNKCODE_MTSQ:
- psTrack->pbMtsq = &(pbBuf[dIndex]);
- psTrack->dMtsqSize = sdChunkSize;
- break;
- case AVMALIB_CHUNKCODE_MTSP:
- psTrack->pbMtsp = &(pbBuf[dIndex]);
- psTrack->dMtspSize = sdChunkSize;
- break;
- case AVMALIB_CHUNKCODE_MTHV:
- psTrack->pbMthv = &(pbBuf[dIndex]);
- psTrack->dMthvSize = sdChunkSize;
- break;
- default:
- break;
+ case AVMALIB_CHUNKCODE_MSPI:
+ psTrack->pbMspi = &(pbBuf[dIndex]);
+ psTrack->dMspiSize = sdChunkSize;
+ break;
+ case AVMALIB_CHUNKCODE_MTSU:
+ psTrack->pbMtsu = &(pbBuf[dIndex]);
+ psTrack->dMtsuSize = sdChunkSize;
+ break;
+ case AVMALIB_CHUNKCODE_MTSQ:
+ psTrack->pbMtsq = &(pbBuf[dIndex]);
+ psTrack->dMtsqSize = sdChunkSize;
+ break;
+ case AVMALIB_CHUNKCODE_MTSP:
+ psTrack->pbMtsp = &(pbBuf[dIndex]);
+ psTrack->dMtspSize = sdChunkSize;
+ break;
+ case AVMALIB_CHUNKCODE_MTHV:
+ psTrack->pbMthv = &(pbBuf[dIndex]);
+ psTrack->dMthvSize = sdChunkSize;
+ break;
+ default:
+ break;
}
dIndex += sdChunkSize;
}
}
/* Check Wave Type */
- if (((psTrack->pbMtr[2] != 0x10) && (psTrack->pbMtr[2] != 0x11)) ||
- ((psTrack->pbMtr[3] & 0xF0) != 0x00)) {
+ if (((psTrack->pbMtr[2] != 0x10) && (psTrack->pbMtr[2] != 0x11)) || ((psTrack->pbMtr[3] & 0xF0) != 0x00)) {
return AV_MMF_ERR_CHUNK;
}
/* Check sub chunk disposition */
while (dSize > (dIndex + AV_MMF_CHUNK_HEADER_SIZE)) {
- sdChunkSize = _mmf_MalibNextChunk(&pbBuf[dIndex], (dSize - dIndex),
- AVMALIB_CHUNK_PHASE_ATRSUB, &dChunkID, &dChunkNo);
+ sdChunkSize = _mmf_MalibNextChunk(&pbBuf[dIndex], (dSize - dIndex), AVMALIB_CHUNK_PHASE_ATRSUB, &dChunkID, &dChunkNo);
if (sdChunkSize < 0) {
return AV_MMF_ERR_CHUNK;
}
dIndex += AV_MMF_CHUNK_HEADER_SIZE;
switch (dChunkID) {
- case AVMALIB_CHUNKCODE_ASPI:
- psTrack->pbMspi = &(pbBuf[dIndex]);
- psTrack->dMspiSize = sdChunkSize;
- break;
- case AVMALIB_CHUNKCODE_ATSQ:
- psTrack->pbMtsq = &(pbBuf[dIndex]);
- psTrack->dMtsqSize = sdChunkSize;
- break;
- case AVMALIB_CHUNKCODE_AWA:
- if ((0x01 <= dChunkNo) && (dChunkNo <= 0x3E))
- fbWave = AV_MMF_MA2_VOICE_FOUND;
- break;
- default:
- break;
+ case AVMALIB_CHUNKCODE_ASPI:
+ psTrack->pbMspi = &(pbBuf[dIndex]);
+ psTrack->dMspiSize = sdChunkSize;
+ break;
+ case AVMALIB_CHUNKCODE_ATSQ:
+ psTrack->pbMtsq = &(pbBuf[dIndex]);
+ psTrack->dMtsqSize = sdChunkSize;
+ break;
+ case AVMALIB_CHUNKCODE_AWA:
+ if ((0x01 <= dChunkNo) && (dChunkNo <= 0x3E))
+ fbWave = AV_MMF_MA2_VOICE_FOUND;
+ break;
+ default:
+ break;
}
dIndex += sdChunkSize;
}
while (dSize >= dIndex + AV_MMF_PHRAZE_SIZE_A) {
wTag = (unsigned short)((((unsigned short)pbBuf[dIndex]) << 8) + (unsigned short)pbBuf[dIndex + 1]);
switch (wTag) {
- case AV_MMF_TAG_STARTPOINT: /* start point */
- psTrack->dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
- dIndex += AV_MMF_PHRAZE_SIZE_A;
- break;
- case AV_MMF_TAG_STOPPOINT: /* stop point */
- psTrack->dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
- dIndex += AV_MMF_PHRAZE_SIZE_A;
- break;
- case AV_MMF_TAG_PHRASE_A: /* A melody */
- if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B)
- return;
- psPhrase[0].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
- psPhrase[0].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7]));
- dIndex += AV_MMF_PHRAZE_SIZE_B;
- break;
- case AV_MMF_TAG_PHRASE_B: /* B melody */
- if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B)
- return;
- psPhrase[1].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
- psPhrase[1].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7]));
- dIndex += AV_MMF_PHRAZE_SIZE_B;
- break;
- case AV_MMF_TAG_PHRASE_E: /* Ending */
- if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B)
- return;
- psPhrase[2].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
- psPhrase[2].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7]));
- dIndex += AV_MMF_PHRAZE_SIZE_B;
- break;
- case AV_MMF_TAG_PHRASE_I: /* Intro */
- if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B)
- return;
- psPhrase[3].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
- psPhrase[3].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7]));
- dIndex += AV_MMF_PHRAZE_SIZE_B;
- break;
- case AV_MMF_TAG_PHRASE_K: /* Interlude */
- if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B)
- return;
- psPhrase[4].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
- psPhrase[4].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7]));
- dIndex += AV_MMF_PHRAZE_SIZE_B;
- break;
- case AV_MMF_TAG_PHRASE_R: /* Refrain */
- if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B)
- return;
- psPhrase[5].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
- psPhrase[5].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7]));
- dIndex += AV_MMF_PHRAZE_SIZE_B;
- break;
- case AV_MMF_TAG_PHRASE_S: /* Bridge */
- if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B)
- return;
- psPhrase[6].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
- psPhrase[6].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7]));
- dIndex += AV_MMF_PHRAZE_SIZE_B;
- break;
- default:
+ case AV_MMF_TAG_STARTPOINT: /* start point */
+ psTrack->dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
+ dIndex += AV_MMF_PHRAZE_SIZE_A;
+ break;
+ case AV_MMF_TAG_STOPPOINT: /* stop point */
+ psTrack->dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
+ dIndex += AV_MMF_PHRAZE_SIZE_A;
+ break;
+ case AV_MMF_TAG_PHRASE_A: /* A melody */
+ if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B)
+ return;
+ psPhrase[0].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
+ psPhrase[0].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7]));
+ dIndex += AV_MMF_PHRAZE_SIZE_B;
+ break;
+ case AV_MMF_TAG_PHRASE_B: /* B melody */
+ if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B)
return;
+ psPhrase[1].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
+ psPhrase[1].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7]));
+ dIndex += AV_MMF_PHRAZE_SIZE_B;
+ break;
+ case AV_MMF_TAG_PHRASE_E: /* Ending */
+ if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B)
+ return;
+ psPhrase[2].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
+ psPhrase[2].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7]));
+ dIndex += AV_MMF_PHRAZE_SIZE_B;
+ break;
+ case AV_MMF_TAG_PHRASE_I: /* Intro */
+ if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B)
+ return;
+ psPhrase[3].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
+ psPhrase[3].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7]));
+ dIndex += AV_MMF_PHRAZE_SIZE_B;
+ break;
+ case AV_MMF_TAG_PHRASE_K: /* Interlude */
+ if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B)
+ return;
+ psPhrase[4].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
+ psPhrase[4].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7]));
+ dIndex += AV_MMF_PHRAZE_SIZE_B;
+ break;
+ case AV_MMF_TAG_PHRASE_R: /* Refrain */
+ if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B)
+ return;
+ psPhrase[5].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
+ psPhrase[5].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7]));
+ dIndex += AV_MMF_PHRAZE_SIZE_B;
+ break;
+ case AV_MMF_TAG_PHRASE_S: /* Bridge */
+ if (dSize < dIndex + AV_MMF_PHRAZE_SIZE_B)
+ return;
+ psPhrase[6].dStartPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 3]));
+ psPhrase[6].dStopPoint = _mmf_Get4Byte(&(pbBuf[dIndex + 7]));
+ dIndex += AV_MMF_PHRAZE_SIZE_B;
+ break;
+ default:
+ return;
}
}
return;
return AV_MMF_FUNC_ERROR;
}
if (pbBuf[0] >= 0x80) {
- sdTemp = (int)((((int)(pbBuf[0] & 0x7F)) << 7) +
- ((int)(pbBuf[1] & 0x7F)) + 128);
+ sdTemp = (int)((((int)(pbBuf[0] & 0x7F)) << 7) + ((int)(pbBuf[1] & 0x7F)) + 128);
*pbRead = 2;
} else {
sdTemp = (int)(pbBuf[0] & 0x7F);
}
switch (pbBuf[dIndex]) {
+ case 0x00:
+ if ((pbBuf[dIndex + 1] & 0x30) != 0x30)
+ dIndex += 2;
+ else
+ dIndex += 3;
+ break;
+ case 0xFF:
+ switch (pbBuf[dIndex + 1]) {
case 0x00:
- if ((pbBuf[dIndex + 1] & 0x30) != 0x30)
- dIndex += 2;
- else
- dIndex += 3;
+ dIndex += 2;
break;
- case 0xFF:
- switch (pbBuf[dIndex + 1]) {
- case 0x00:
- dIndex += 2;
- break;
- case 0xF0:
- if (dSize < dIndex + 3) {
- return AV_MMF_ERR_CHUNK;
- }
- dIndex += (pbBuf[dIndex + 2] + 3);
- if (dSize < dIndex) {
- return AV_MMF_ERR_CHUNK;
- }
- if (pbBuf[dIndex - 1] != 0xF7) {
- return AV_MMF_ERR_CHUNK;
- }
- break;
- default:
- return AV_MMF_ERR_CHUNK;
+ case 0xF0:
+ if (dSize < dIndex + 3) {
+ return AV_MMF_ERR_CHUNK;
}
- break;
- default:
- sdTemp = _mmf_GetFlex2L(&pbBuf[dIndex + 1], (dSize - dIndex - 1), &dFlexSize);
- if (sdTemp < 0) {
+ dIndex += (pbBuf[dIndex + 2] + 3);
+ if (dSize < dIndex) {
+ return AV_MMF_ERR_CHUNK;
+ }
+ if (pbBuf[dIndex - 1] != 0xF7) {
return AV_MMF_ERR_CHUNK;
}
- if (dGate < (unsigned int)sdTemp)
- dGate = (unsigned int)sdTemp;
- dIndex += (1 + dFlexSize);
break;
+ default:
+ return AV_MMF_ERR_CHUNK;
+ }
+ break;
+ default:
+ sdTemp = _mmf_GetFlex2L(&pbBuf[dIndex + 1], (dSize - dIndex - 1), &dFlexSize);
+ if (sdTemp < 0) {
+ return AV_MMF_ERR_CHUNK;
+ }
+ if (dGate < (unsigned int)sdTemp)
+ dGate = (unsigned int)sdTemp;
+ dIndex += (1 + dFlexSize);
+ break;
}
if (dSize < dIndex) {
return AV_MMF_ERR_CHUNK;
dIndex++;
switch (bTemp & 0xF0) {
- case 0x90:
- psLoad->pfnGetByte(psHuf); /*Note number*/
- dIndex++;
- psLoad->pfnGetByte(psHuf); /*Key Velocity*/
- dIndex++;
+ case 0x90:
+ psLoad->pfnGetByte(psHuf); /*Note number*/
+ dIndex++;
+ psLoad->pfnGetByte(psHuf); /*Key Velocity*/
+ dIndex++;
+ sdTemp = _mmf_GetFlex3L(psLoad, &dReadSize);
+ if (sdTemp < 0) {
+ return AV_MMF_ERR_CHUNK;
+ }
+ dIndex += dReadSize;
+ if ((unsigned int)sdTemp > dGate)
+ dGate = sdTemp;
+ break;
+ case 0x80:
+ psLoad->pfnGetByte(psHuf); /*Note number*/
+ dIndex++;
+ sdTemp = _mmf_GetFlex3L(psLoad, &dReadSize);
+ if (sdTemp < 0) {
+ return AV_MMF_ERR_CHUNK;
+ }
+ dIndex += dReadSize;
+ if ((unsigned int)sdTemp > dGate)
+ dGate = sdTemp;
+ break;
+ case 0xA0:
+ case 0xB0:
+ case 0xE0:
+ bTemp = psLoad->pfnGetByte(psHuf); /*B0: Conrol number, E0:Pitch Bend Change LSB*/
+ dIndex++;
+ bTemp = psLoad->pfnGetByte(psHuf); /*B0: Conrol value, E0:Pitch Bend Change MSB*/
+ dIndex++;
+ break;
+ case 0xC0:
+ case 0xD0:
+ bTemp = psLoad->pfnGetByte(psHuf);
+ dIndex++;
+ break;
+ default:
+ switch (bTemp) {
+ case 0xF0:
sdTemp = _mmf_GetFlex3L(psLoad, &dReadSize);
if (sdTemp < 0) {
return AV_MMF_ERR_CHUNK;
}
- dIndex += dReadSize;
- if ((unsigned int)sdTemp > dGate)
- dGate = sdTemp;
- break;
- case 0x80:
- psLoad->pfnGetByte(psHuf); /*Note number*/
- dIndex++;
- sdTemp = _mmf_GetFlex3L(psLoad, &dReadSize);
- if (sdTemp < 0) {
+ for (i = 0; i < (unsigned int)sdTemp; i++)
+ bTemp = psLoad->pfnGetByte(psHuf);
+ if (bTemp != 0xF7) {
return AV_MMF_ERR_CHUNK;
}
- dIndex += dReadSize;
- if ((unsigned int)sdTemp > dGate)
- dGate = sdTemp;
+ dIndex += (unsigned int)sdTemp + dReadSize;
break;
- case 0xA0:
- case 0xB0:
- case 0xE0:
- bTemp = psLoad->pfnGetByte(psHuf); /*B0: Conrol number, E0:Pitch Bend Change LSB*/
- dIndex++;
- bTemp = psLoad->pfnGetByte(psHuf); /*B0: Conrol value, E0:Pitch Bend Change MSB*/
- dIndex++;
- break;
- case 0xC0:
- case 0xD0:
+ case 0xFF:
bTemp = psLoad->pfnGetByte(psHuf);
dIndex++;
- break;
- default:
switch (bTemp) {
- case 0xF0:
- sdTemp = _mmf_GetFlex3L(psLoad, &dReadSize);
- if (sdTemp < 0) {
- return AV_MMF_ERR_CHUNK;
- }
- for (i = 0; i < (unsigned int)sdTemp; i++)
- bTemp = psLoad->pfnGetByte(psHuf);
- if (bTemp != 0xF7) {
- return AV_MMF_ERR_CHUNK;
- }
- dIndex += (unsigned int)sdTemp + dReadSize;
- break;
- case 0xFF:
- bTemp = psLoad->pfnGetByte(psHuf);
- dIndex++;
- switch (bTemp) {
- case 0x00:
- break;
- case 0x2F:
- bTemp = psLoad->pfnGetByte(psHuf);
- dIndex++;
- if (bTemp != 0x00) {
- return AV_MMF_ERR_CHUNK;
- }
- dGate = 0;
- psTrk->dStopTick = dPast;
- dIndex = dSize;
- break;
- default:
- return AV_MMF_ERR_CHUNK;
- }
- break;
- default:
+ case 0x00:
+ break;
+ case 0x2F:
+ bTemp = psLoad->pfnGetByte(psHuf);
+ dIndex++;
+ if (bTemp != 0x00) {
return AV_MMF_ERR_CHUNK;
+ }
+ dGate = 0;
+ psTrk->dStopTick = dPast;
+ dIndex = dSize;
+ break;
+ default:
+ return AV_MMF_ERR_CHUNK;
}
break;
+ default:
+ return AV_MMF_ERR_CHUNK;
+ }
+ break;
}
if ((dSize < dIndex) || (psHuf->dReadSize > psHuf->dMtsqSize)) {
return AV_MMF_ERR_CHUNK;
/* search Pro5 Chunk */
while (dOSize > (dIndex + AV_MMF_CHUNK_HEADER_SIZE)) {
- sdChunkSize = _mmf_MalibNextChunk(&pbOpda[dIndex], (dOSize - dIndex),
- AVMALIB_CHUNK_PHASE_OPDASUB, &dChunkID, &dChunkNo);
+ sdChunkSize = _mmf_MalibNextChunk(&pbOpda[dIndex], (dOSize - dIndex), AVMALIB_CHUNK_PHASE_OPDASUB, &dChunkID, &dChunkNo);
if (sdChunkSize < AVMASMW_SUCCESS) return AVMASMW_ERROR;
dIndex += AV_MMF_CHUNK_HEADER_SIZE;
if ((dChunkID == AVMALIB_CHUNKCODE_M5P) && (dChunkNo == 0x05)) {
dIndex = 0;
while (dHvDataSize > (dIndex + AV_MMF_CHUNK_HEADER_SIZE)) {
- sdChunkSize = _mmf_MalibNextChunk(&(pbHvData[dIndex]), (dHvDataSize - dIndex),
- AVMALIB_CHUNK_PHASE_MTHVSUB, &dChunkID, &dChunkNo);
+ sdChunkSize = _mmf_MalibNextChunk(&(pbHvData[dIndex]), (dHvDataSize - dIndex), AVMALIB_CHUNK_PHASE_MTHVSUB, &dChunkID, &dChunkNo);
if (sdChunkSize < 0) return;
dIndex += AV_MMF_CHUNK_HEADER_SIZE;
switch (dChunkID) {
- case AVMALIB_CHUNKCODE_MHVS:
- pbSetup = &(pbHvData[dIndex]);
- dSetupSize = (unsigned int)sdChunkSize;
- break;
- case AVMALIB_CHUNKCODE_HVP:
- if (dChunkNo != 0) break;
- pbVoice = &(pbHvData[dIndex - AV_MMF_CHUNK_HEADER_SIZE]);
- dVoiceSize = (unsigned int)(sdChunkSize + AV_MMF_CHUNK_HEADER_SIZE);
- break;
- case AVMALIB_CHUNKCODE_MHSC:
- pbScript = &(pbHvData[dIndex]);
- dScriptSize = (unsigned int)sdChunkSize;
- break;
- default:
- break;
+ case AVMALIB_CHUNKCODE_MHVS:
+ pbSetup = &(pbHvData[dIndex]);
+ dSetupSize = (unsigned int)sdChunkSize;
+ break;
+ case AVMALIB_CHUNKCODE_HVP:
+ if (dChunkNo != 0) break;
+ pbVoice = &(pbHvData[dIndex - AV_MMF_CHUNK_HEADER_SIZE]);
+ dVoiceSize = (unsigned int)(sdChunkSize + AV_MMF_CHUNK_HEADER_SIZE);
+ break;
+ case AVMALIB_CHUNKCODE_MHSC:
+ pbScript = &(pbHvData[dIndex]);
+ dScriptSize = (unsigned int)sdChunkSize;
+ break;
+ default:
+ break;
}
dIndex += sdChunkSize;
}
_mmf_CheckInitial(psLoad_Info);
/* check File Chunk(ID/Size) */
- sdChunkSize = _mmf_MalibNextChunk(pbBuf, dSize, AVMALIB_CHUNK_PHASE_MMMD,
- &dChunkID, &dChunkNo);
+ sdChunkSize = _mmf_MalibNextChunk(pbBuf, dSize, AVMALIB_CHUNK_PHASE_MMMD, &dChunkID, &dChunkNo);
if ((sdChunkSize < 0) || (dChunkID != AVMALIB_CHUNKCODE_MMMD)) {
return AV_MMF_ERR_FILE;
}
/* check Contents Info Chunk */
dIndex = AV_MMF_CHUNK_HEADER_SIZE;
- sdChunkSize = _mmf_MalibNextChunk(&pbBuf[dIndex], (dSize - dIndex),
- AVMALIB_CHUNK_PHASE_CNTI, &dChunkID, &dChunkNo);
+ sdChunkSize = _mmf_MalibNextChunk(&pbBuf[dIndex], (dSize - dIndex), AVMALIB_CHUNK_PHASE_CNTI, &dChunkID, &dChunkNo);
if ((sdChunkSize < 5) || (dChunkID != AVMALIB_CHUNKCODE_CNTI)) {
return AV_MMF_ERR_FILE;
}
/* check Contents Class */
if ((pbBuf[AV_MMF_POSITION_OF_CCLASS] != AV_MMF_CONTENTS_CLASS_0) &&
- (pbBuf[AV_MMF_POSITION_OF_CCLASS] != AV_MMF_CONTENTS_CLASS_1) &&
- (pbBuf[AV_MMF_POSITION_OF_CCLASS] != AV_MMF_CONTENTS_CLASS_2)) {
+ (pbBuf[AV_MMF_POSITION_OF_CCLASS] != AV_MMF_CONTENTS_CLASS_1) &&
+ (pbBuf[AV_MMF_POSITION_OF_CCLASS] != AV_MMF_CONTENTS_CLASS_2)) {
return AV_MMF_ERR_CLASS;
}
/* check Contents Type */
dIndex += AV_MMF_CHUNK_HEADER_SIZE;
if (((pbBuf[AV_MMF_POSITION_OF_CTYPE] & 0xF0) == AV_MMF_CONTENTS_TYPE_0) ||
- ((pbBuf[AV_MMF_POSITION_OF_CTYPE] & 0xF0) == AV_MMF_CONTENTS_TYPE_1) ||
- ((pbBuf[AV_MMF_POSITION_OF_CTYPE] & 0xF0) == AV_MMF_CONTENTS_TYPE_2)) {
+ ((pbBuf[AV_MMF_POSITION_OF_CTYPE] & 0xF0) == AV_MMF_CONTENTS_TYPE_1) ||
+ ((pbBuf[AV_MMF_POSITION_OF_CTYPE] & 0xF0) == AV_MMF_CONTENTS_TYPE_2)) {
psLoad_Info->dSmafType = AV_MMF_SMAF_TYPE_MA2;
} else if (((pbBuf[AV_MMF_POSITION_OF_CTYPE] & 0xF0) == AV_MMF_CONTENTS_TYPE_3) ||
- ((pbBuf[AV_MMF_POSITION_OF_CTYPE] & 0xF0) == AV_MMF_CONTENTS_TYPE_4) ||
- ((pbBuf[AV_MMF_POSITION_OF_CTYPE] & 0xF0) == AV_MMF_CONTENTS_TYPE_5)) {
+ ((pbBuf[AV_MMF_POSITION_OF_CTYPE] & 0xF0) == AV_MMF_CONTENTS_TYPE_4) ||
+ ((pbBuf[AV_MMF_POSITION_OF_CTYPE] & 0xF0) == AV_MMF_CONTENTS_TYPE_5)) {
switch (pbBuf[AV_MMF_POSITION_OF_CTYPE] & 0x0F) {
- case 0x00:
- case 0x01:
- psLoad_Info->dSmafType = AV_MMF_SMAF_TYPE_MA2;
- break;
- case 0x02:
- case 0x03:
- psLoad_Info->dSmafType = AV_MMF_SMAF_TYPE_MA3;
- break;
- case 0x04:
- case 0x05:
- case 0x06:
- case 0x07:
- case 0x08:
- psLoad_Info->dSmafType = AV_MMF_SMAF_TYPE_MA5;
- break;
- default:
- return AV_MMF_ERR_TYPE;
+ case 0x00:
+ case 0x01:
+ psLoad_Info->dSmafType = AV_MMF_SMAF_TYPE_MA2;
+ break;
+ case 0x02:
+ case 0x03:
+ psLoad_Info->dSmafType = AV_MMF_SMAF_TYPE_MA3;
+ break;
+ case 0x04:
+ case 0x05:
+ case 0x06:
+ case 0x07:
+ case 0x08:
+ psLoad_Info->dSmafType = AV_MMF_SMAF_TYPE_MA5;
+ break;
+ default:
+ return AV_MMF_ERR_TYPE;
}
} else {
return AV_MMF_ERR_TYPE;
dIndex += sdChunkSize;
if (pbBuf[AV_MMF_POSITION_OF_CTYPE] >= 0x30) {
- sdChunkSize = _mmf_MalibNextChunk(&pbBuf[dIndex], (dSize - dIndex),
- AVMALIB_CHUNK_PHASE_MMMDSUB, &dChunkID, &dChunkNo);
+ sdChunkSize = _mmf_MalibNextChunk(&pbBuf[dIndex], (dSize - dIndex), AVMALIB_CHUNK_PHASE_MMMDSUB, &dChunkID, &dChunkNo);
if ((sdChunkSize >= 12) && (dChunkID == AVMALIB_CHUNKCODE_OPDA)) {
dIndex += AV_MMF_CHUNK_HEADER_SIZE;
psLoad_Info->sOption_Info.pbOpda = &pbBuf[dIndex];
/* get Track Chunk information */
while (dSize > (dIndex + AV_MMF_CHUNK_HEADER_SIZE + AV_MMF_FILE_CRC_SIZE)) {
- sdChunkSize = _mmf_MalibNextChunk(&pbBuf[dIndex], (dSize - dIndex),
- AVMALIB_CHUNK_PHASE_MMMDSUB, &dChunkID, &dChunkNo);
+ sdChunkSize = _mmf_MalibNextChunk(&pbBuf[dIndex], (dSize - dIndex), AVMALIB_CHUNK_PHASE_MMMDSUB, &dChunkID, &dChunkNo);
if (sdChunkSize < 0) {
if (sdChunkSize == AVMALIB_CHUNK_ID_ERROR) {
return AV_MMF_ERR_FILE;
}
dIndex += AV_MMF_CHUNK_HEADER_SIZE;
switch (dChunkID) {
- case AVMALIB_CHUNKCODE_MTR:
- if (dChunkNo > 6)
- break;
- psLoad_Info->sTrack_Info[dChunkNo].pbMtr = &(pbBuf[dIndex]);
- psLoad_Info->sTrack_Info[dChunkNo].dMtrSize = (unsigned int)sdChunkSize;
+ case AVMALIB_CHUNKCODE_MTR:
+ if (dChunkNo > 6)
break;
- case AVMALIB_CHUNKCODE_ATR:
- if (dChunkNo != 0)
- break;
- psLoad_Info->sTrack_Info[AV_MMF_ATR_TRACK_NO].pbMtr = &(pbBuf[dIndex]);
- psLoad_Info->sTrack_Info[AV_MMF_ATR_TRACK_NO].dMtrSize = (unsigned int)sdChunkSize;
- break;
- default:
+ psLoad_Info->sTrack_Info[dChunkNo].pbMtr = &(pbBuf[dIndex]);
+ psLoad_Info->sTrack_Info[dChunkNo].dMtrSize = (unsigned int)sdChunkSize;
+ break;
+ case AVMALIB_CHUNKCODE_ATR:
+ if (dChunkNo != 0)
break;
+ psLoad_Info->sTrack_Info[AV_MMF_ATR_TRACK_NO].pbMtr = &(pbBuf[dIndex]);
+ psLoad_Info->sTrack_Info[AV_MMF_ATR_TRACK_NO].dMtrSize = (unsigned int)sdChunkSize;
+ break;
+ default:
+ break;
}
dIndex += sdChunkSize;
}
/* Error Check of Track Chunk */
switch (psLoad_Info->dSmafType) {
- case AV_MMF_SMAF_TYPE_MA2:
- sdResult = _mmf_TrackChunkCheck2(psLoad_Info);
- break;
- case AV_MMF_SMAF_TYPE_MA3:
- sdResult = _mmf_TrackChunkCheck3(psLoad_Info);
- break;
- default:
- if (_mmf_CheckM5P(psLoad_Info) != AV_MMF_FUNC_SUCCESS) return AV_MMF_ERR_CHUNK;
- sdResult = _mmf_TrackChunkCheck5(psLoad_Info);
- break;
+ case AV_MMF_SMAF_TYPE_MA2:
+ sdResult = _mmf_TrackChunkCheck2(psLoad_Info);
+ break;
+ case AV_MMF_SMAF_TYPE_MA3:
+ sdResult = _mmf_TrackChunkCheck3(psLoad_Info);
+ break;
+ default:
+ if (_mmf_CheckM5P(psLoad_Info) != AV_MMF_FUNC_SUCCESS) return AV_MMF_ERR_CHUNK;
+ sdResult = _mmf_TrackChunkCheck5(psLoad_Info);
+ break;
}
/* check playback time */
#define IS_VALID_FRAME_MP3(x) \
((((x)[0] & mp3FrameMasking[0]) == mp3FrameDataValid[0]) && \
- (((x)[1] & mp3FrameMasking[1]) == mp3FrameDataValid[1]) && \
- (((x)[2] & mp3FrameMasking[2]) == mp3FrameDataValid[2]) && \
- (((x)[3] & mp3FrameMasking[3]) == mp3FrameDataValid[3]))
+ (((x)[1] & mp3FrameMasking[1]) == mp3FrameDataValid[1]) && \
+ (((x)[2] & mp3FrameMasking[2]) == mp3FrameDataValid[2]) && \
+ (((x)[3] & mp3FrameMasking[3]) == mp3FrameDataValid[3]))
}
debug_msg(RELEASE, "Xing header: sampling-rate:%d, stream-size:%d, frame-number:%d\n",
- headData->sampRate, headData->bytes, headData->frames);
+ headData->sampRate, headData->bytes, headData->frames);
return 1; /* success */
}
buf += 2;
headData->framesPerTable = __AvExtractI2(buf);
- debug_msg(RELEASE, "Vbri header: sampling-rate:%d, stream-size:%d, frame-number:%d\n",
- headData->sampRate, headData->bytes, headData->frames);
+ debug_msg(RELEASE, "Vbri header: sampling-rate:%d, stream-size:%d, frame-number:%d\n", headData->sampRate, headData->bytes, headData->frames);
return true; /* success */
}
if (VALID_SYNC(buf)) {
mp3FrameDataValid[0] = (0xFF) & (mp3FrameMasking[0]);
- mp3FrameDataValid[1] = (0xE0 | (buf[AV_MP3HDR_VERSION_OFS] & AV_MP3HDR_VERSION_M)
- | (buf[AV_MP3HDR_LAYER_OFS] & AV_MP3HDR_LAYER_M)) & (mp3FrameMasking[1]);
- mp3FrameDataValid[2] = (buf[AV_MP3HDR_SAMPLERATE_OFS] & AV_MP3HDR_SAMPLERATE_M) &
- (mp3FrameMasking[2]);
- mp3FrameDataValid[3] = (buf[AV_MP3HDR_CHANNEL_OFS] & AV_MP3HDR_CHANNEL_M) &
- (mp3FrameMasking[3]);
+ mp3FrameDataValid[1] = (0xE0 | (buf[AV_MP3HDR_VERSION_OFS] & AV_MP3HDR_VERSION_M) | (buf[AV_MP3HDR_LAYER_OFS] & AV_MP3HDR_LAYER_M)) & (mp3FrameMasking[1]);
+ mp3FrameDataValid[2] = (buf[AV_MP3HDR_SAMPLERATE_OFS] & AV_MP3HDR_SAMPLERATE_M) & (mp3FrameMasking[2]);
+ mp3FrameDataValid[3] = (buf[AV_MP3HDR_CHANNEL_OFS] & AV_MP3HDR_CHANNEL_M) & (mp3FrameMasking[3]);
- debug_msg(RELEASE, "*** [%02x][%02x][%02x][%02x] : [%02x][%02x][%02x][%02x]",
- buf[0], buf[1], buf[2], buf[3],
- mp3FrameDataValid[0], mp3FrameDataValid[1], mp3FrameDataValid[2], mp3FrameDataValid[3]);
+ debug_msg(RELEASE, "*** [%02x][%02x][%02x][%02x] : [%02x][%02x][%02x][%02x]", buf[0], buf[1], buf[2], buf[3], mp3FrameDataValid[0], mp3FrameDataValid[1], mp3FrameDataValid[2], mp3FrameDataValid[3]);
/*
- * MPEG Audio Layer I/II/III frame header
- * from : http://www.mp3-tech.org/programmer/frame_header.html *
- *
- * AAAAAAAA AAABBCCD EEEEFFGH IIJJKLMM
- *
- * A 11 (31-21) Frame sync (all bits must be set)
- * B 2 (20,19) MPEG Audio version ID
- * C 2 (18,17) Layer description
- * D 1 (16) Protection bit
- * E 4 (15,12) Bitrate index
- * F 2 (11,10) Sampling rate frequency index
- * G 1 (9) Padding bit
- * H 1 (8) Private bit. This one is only informative.
- * I 2 (7,6) Channel Mode
- * J 2 (5,4) Mode extension (Only used in Joint stereo)
- * K 1 (3) Copyright
- * L 1 (2) Original
- * M 2 (1,0) Emphasis
- *
- */
+ * MPEG Audio Layer I/II/III frame header
+ * from : http://www.mp3-tech.org/programmer/frame_header.html *
+ *
+ * AAAAAAAA AAABBCCD EEEEFFGH IIJJKLMM
+ *
+ * A 11 (31-21) Frame sync (all bits must be set)
+ * B 2 (20,19) MPEG Audio version ID
+ * C 2 (18,17) Layer description
+ * D 1 (16) Protection bit
+ * E 4 (15,12) Bitrate index
+ * F 2 (11,10) Sampling rate frequency index
+ * G 1 (9) Padding bit
+ * H 1 (8) Private bit. This one is only informative.
+ * I 2 (7,6) Channel Mode
+ * J 2 (5,4) Mode extension (Only used in Joint stereo)
+ * K 1 (3) Copyright
+ * L 1 (2) Original
+ * M 2 (1,0) Emphasis
+ *
+ */
/* Simple check for version, layer, bitrate, samplerate */
if ((buf[1] & 0x18) != 0x08 && /* 000XX000 : MPEG Audio version ID, XX=01 - reserved => 00001000(0x08) */
- (buf[1] & 0x06) != 0x00 && /* 00000XX0 : Layer description, XX=00 - reserved => 00000000(0x00) */
- (buf[2] & 0xF0) != 0xF0 && /* XXXX0000 : Bitrate index, XX=1111 - bad => 11110000(0xF0) */
- (buf[2] & 0x0C) != 0x0C) { /* 0000XX00 : Sampling rate frequency index, XX=11 -reserved => 00001100(0x0C) */
+ (buf[1] & 0x06) != 0x00 && /* 00000XX0 : Layer description, XX=00 - reserved => 00000000(0x00) */
+ (buf[2] & 0xF0) != 0xF0 && /* XXXX0000 : Bitrate index, XX=1111 - bad => 11110000(0xF0) */
+ (buf[2] & 0x0C) != 0x0C) { /* 0000XX00 : Sampling rate frequency index, XX=11 -reserved => 00001100(0x0C) */
bSync = true;
}
debug_msg(RELEASE, "=> %s\n", bSync ? "Good!" : "Bad...");
/* 1. Check the version of mp3 */
result = header[1] & MASK_MPEG;
switch (result) {
- case MASK_MPEG_1:
- pInfo->mpegVersion = AV_MPEG_VER_1;
- break;
- case MASK_MPEG_2:
- pInfo->mpegVersion = AV_MPEG_VER_2;
- break;
- case MASK_MPEG_25:
- pInfo->mpegVersion = AV_MPEG_VER_25;
- break;
- default:
- return false;
+ case MASK_MPEG_1:
+ pInfo->mpegVersion = AV_MPEG_VER_1;
+ break;
+ case MASK_MPEG_2:
+ pInfo->mpegVersion = AV_MPEG_VER_2;
+ break;
+ case MASK_MPEG_25:
+ pInfo->mpegVersion = AV_MPEG_VER_25;
+ break;
+ default:
+ return false;
}
/* 2. Get a layer */
result = header[1] & MASK_LAYER;
switch (result) {
- case MASK_LAYER_1:
- pInfo->layer = AV_MP3_LAYER_1;
- break;
- case MASK_LAYER_2:
- pInfo->layer = AV_MP3_LAYER_2;
- break;
- case MASK_LAYER_3:
- pInfo->layer = AV_MP3_LAYER_3;
- break;
- default:
- return false;
+ case MASK_LAYER_1:
+ pInfo->layer = AV_MP3_LAYER_1;
+ break;
+ case MASK_LAYER_2:
+ pInfo->layer = AV_MP3_LAYER_2;
+ break;
+ case MASK_LAYER_3:
+ pInfo->layer = AV_MP3_LAYER_3;
+ break;
+ default:
+ return false;
}
/* 3. bitrate */
/* 5. channel */
result = header[3] & MASK_CHANNEL;
switch (result) {
- case MASK_CHANNEL_ST:
- pInfo->channelIndex = 0;
- pInfo->channels = 2;
- break;
- case MASK_CHANNEL_JS:
- pInfo->channelIndex = 1;
- pInfo->channels = 2;
- break;
- case MASK_CHANNEL_DC:
- pInfo->channelIndex = 2;
- pInfo->channels = 2;
- break;
- case MASK_CHANNEL_MN:
- pInfo->channelIndex = 3;;
- pInfo->channels = 1;
- break;
- default:
- return false;
+ case MASK_CHANNEL_ST:
+ pInfo->channelIndex = 0;
+ pInfo->channels = 2;
+ break;
+ case MASK_CHANNEL_JS:
+ pInfo->channelIndex = 1;
+ pInfo->channels = 2;
+ break;
+ case MASK_CHANNEL_DC:
+ pInfo->channelIndex = 2;
+ pInfo->channels = 2;
+ break;
+ case MASK_CHANNEL_MN:
+ pInfo->channelIndex = 3;;
+ pInfo->channels = 1;
+ break;
+ default:
+ return false;
}
/* 6. padding */
else
pInfo->bPadding = false;
- debug_msg(RELEASE, "=> samplerate=%d, bitrate=%d, layer=%d, version=%d, channel=%d, padding=%d",
- pInfo->sampleRate, pInfo->bitRate, pInfo->layer, pInfo->mpegVersion, pInfo->channels, pInfo->bPadding);
+ debug_msg(RELEASE, "=> samplerate=%d, bitrate=%d, layer=%d, version=%d, channel=%d, padding=%d", pInfo->sampleRate, pInfo->bitRate, pInfo->layer, pInfo->mpegVersion, pInfo->channels, pInfo->bPadding);
return true;
}
pInfo->bitRate = frameSize * pInfo->sampleRate / 48000;
} else {
frameSize += 0/* FIXME: possible_free_framelen*/;
- pInfo->bitRate = frameSize * pInfo->sampleRate /
- ((pInfo->layer == AV_MP3_LAYER_3 && pInfo->mpegVersion != AV_MPEG_VER_1) ? 72000 : 144000);
+ pInfo->bitRate = frameSize * pInfo->sampleRate / ((pInfo->layer == AV_MP3_LAYER_3 && pInfo->mpegVersion != AV_MPEG_VER_1) ? 72000 : 144000);
}
} else {
/* calculating */
if (pInfo->layer == 1) {
frameSize = ((12000 * pInfo->bitRate / pInfo->sampleRate) + frameSize) * 4;
} else {
- frameSize += ((pInfo->layer == AV_MP3_LAYER_3
- && pInfo->mpegVersion != AV_MPEG_VER_1) ? 72000 : 144000) * pInfo->bitRate / pInfo->sampleRate;
+ frameSize += ((pInfo->layer == AV_MP3_LAYER_3 && pInfo->mpegVersion != AV_MPEG_VER_1) ? 72000 : 144000) * pInfo->bitRate / pInfo->sampleRate;
}
}
/**@note weak id3v2 tag checking*/
if (tagHeader[3] != 0xFF && tagHeader[4] != 0xFF &&
- (tagHeader[6] & 0x80) == 0 && (tagHeader[7] & 0x80) == 0 &&
- (tagHeader[8] & 0x80) == 0 && (tagHeader[9] & 0x80) == 0) {
+ (tagHeader[6] & 0x80) == 0 && (tagHeader[7] & 0x80) == 0 &&
+ (tagHeader[8] & 0x80) == 0 && (tagHeader[9] & 0x80) == 0) {
debug_msg(RELEASE, "good ID3V2 tag.\n");
} else {
debug_warning(DEBUG, "It's bad ID3V2 tag.\n");
unsigned long frameSamples = 0;
unsigned char *buf = NULL;
unsigned char *v2TagExistCheck = NULL;
- int readAmount = 0, readedDataLen = 0;
+ int readAmount = 0, readedDataLen = 0;
unsigned char TagBuff[MP3TAGINFO_SIZE + TAGV1_SEEK_GAP];
unsigned char TagV1ID[4] = { 0x54, 0x41, 0x47}; /*TAG */
int tagHeaderPos = 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 ((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);
debug_msg(RELEASE, "Reading buf readedDataLen(%d) readAmount (%d)\n", readedDataLen, readAmount);
}
} else {
- if ((readedDataLen <= _AV_MP3_HEADER_POSITION_MAX + pInfo->tagV2Info.tagLen)
- && (mmfile_read(hFile, buf + readedDataLen, readAmount) <= 0)) {
+ if ((readedDataLen <= _AV_MP3_HEADER_POSITION_MAX + pInfo->tagV2Info.tagLen) && (mmfile_read(hFile, buf + readedDataLen, readAmount) <= 0)) {
if (buf)
_FREE_EX(buf);
#if 0
unsigned long numOfFrames = 0;
- unsigned long long tempduration = 0;
- unsigned int tempNumFrames = 0;
+ unsigned long long tempduration = 0;
+ unsigned int tempNumFrames = 0;
if (pInfo->bVbr)
numOfFrames = pInfo->frameNum * 10;
else {
- numOfFrames = ((pInfo->fileLen
- - (pInfo->headerPos + (pInfo->bV1tagFound ? MP3TAGINFO_SIZE : 0))) * 10) / pInfo->frameSize;
+ numOfFrames = ((pInfo->fileLen - (pInfo->headerPos + (pInfo->bV1tagFound ? MP3TAGINFO_SIZE : 0))) * 10) / pInfo->frameSize;
}
tempNumFrames = (unsigned int)(numOfFrames / 10);
/*version check */
switch (header[index]) {
- case 0:
- out->version = MMFILE_ID3TAG_V2_0;
- break;
- case 2:
- out->version = MMFILE_ID3TAG_V2_2;
- break;
- case 3:
- out->version = MMFILE_ID3TAG_V2_3;
- break;
- case 4:
- out->version = MMFILE_ID3TAG_V2_4;
- break;
- default:
- debug_warning(DEBUG, "unknown version of id3v2\n");
- break;
+ case 0:
+ out->version = MMFILE_ID3TAG_V2_0;
+ break;
+ case 2:
+ out->version = MMFILE_ID3TAG_V2_2;
+ break;
+ case 3:
+ out->version = MMFILE_ID3TAG_V2_3;
+ break;
+ case 4:
+ out->version = MMFILE_ID3TAG_V2_4;
+ break;
+ default:
+ debug_warning(DEBUG, "unknown version of id3v2\n");
+ break;
}
index += 2;
formatContext->streams[MMFILE_AUDIO_STREAM]->streamType = MMFILE_AUDIO_STREAM;
switch (waveinfo->format) {
- case 0x0001:
- formatContext->streams[MMFILE_AUDIO_STREAM]->codecId = MM_AUDIO_CODEC_PCM;
- break;
- case 0x0002:
- formatContext->streams[MMFILE_AUDIO_STREAM]->codecId = MM_AUDIO_CODEC_MS_ADPCM;
- break;
- case 0x0006:
- formatContext->streams[MMFILE_AUDIO_STREAM]->codecId = MM_AUDIO_CODEC_ALAW;
- break;
- case 0x0007:
- formatContext->streams[MMFILE_AUDIO_STREAM]->codecId = MM_AUDIO_CODEC_MULAW;
- break;
- case 0x0011:
- formatContext->streams[MMFILE_AUDIO_STREAM]->codecId = MM_AUDIO_CODEC_ADPCM;
- break;
- default:
- formatContext->streams[MMFILE_AUDIO_STREAM]->codecId = MM_AUDIO_CODEC_INVALID;
- break;
+ case 0x0001:
+ formatContext->streams[MMFILE_AUDIO_STREAM]->codecId = MM_AUDIO_CODEC_PCM;
+ break;
+ case 0x0002:
+ formatContext->streams[MMFILE_AUDIO_STREAM]->codecId = MM_AUDIO_CODEC_MS_ADPCM;
+ break;
+ case 0x0006:
+ formatContext->streams[MMFILE_AUDIO_STREAM]->codecId = MM_AUDIO_CODEC_ALAW;
+ break;
+ case 0x0007:
+ formatContext->streams[MMFILE_AUDIO_STREAM]->codecId = MM_AUDIO_CODEC_MULAW;
+ break;
+ case 0x0011:
+ formatContext->streams[MMFILE_AUDIO_STREAM]->codecId = MM_AUDIO_CODEC_ADPCM;
+ break;
+ default:
+ formatContext->streams[MMFILE_AUDIO_STREAM]->codecId = MM_AUDIO_CODEC_INVALID;
+ break;
}
formatContext->streams[MMFILE_AUDIO_STREAM]->bitRate = waveinfo->byte_rate * 8;
int fileExtToFormatType(unsigned long long fileExt)
{
- switch(fileExt) {
- case MMFILE_EXT_MP4:
- case MMFILE_EXT_MPEG4:
- case MMFILE_EXT_M4A:
- case MMFILE_EXT_MPG:
- case MMFILE_EXT_MPG4:
- case MMFILE_EXT_M4V:
- case MMFILE_EXT_TTS:
- case MMFILE_EXT_TRP:
- case MMFILE_EXT_3M:
- case MMFILE_EXT_26L:
- case MMFILE_EXT_264:
- return MM_FILE_FORMAT_MP4;
+ switch (fileExt) {
+ case MMFILE_EXT_MP4:
+ case MMFILE_EXT_MPEG4:
+ case MMFILE_EXT_M4A:
+ case MMFILE_EXT_MPG:
+ case MMFILE_EXT_MPG4:
+ case MMFILE_EXT_M4V:
+ case MMFILE_EXT_TTS:
+ case MMFILE_EXT_TRP:
+ case MMFILE_EXT_3M:
+ case MMFILE_EXT_26L:
+ case MMFILE_EXT_264:
+ return MM_FILE_FORMAT_MP4;
- case MMFILE_EXT_3GP:
- return MM_FILE_FORMAT_3GP;
+ case MMFILE_EXT_3GP:
+ return MM_FILE_FORMAT_3GP;
- case MMFILE_EXT_AMR:
- case MMFILE_EXT_AWB:
- return MM_FILE_FORMAT_AMR;
+ case MMFILE_EXT_AMR:
+ case MMFILE_EXT_AWB:
+ return MM_FILE_FORMAT_AMR;
- case MMFILE_EXT_WAV:
- return MM_FILE_FORMAT_WAV;
+ case MMFILE_EXT_WAV:
+ return MM_FILE_FORMAT_WAV;
- case MMFILE_EXT_MID:
- case MMFILE_EXT_MIDI:
- case MMFILE_EXT_SPM:
- return MM_FILE_FORMAT_MID;
+ case MMFILE_EXT_MID:
+ case MMFILE_EXT_MIDI:
+ case MMFILE_EXT_SPM:
+ return MM_FILE_FORMAT_MID;
- case MMFILE_EXT_MP3:
- return MM_FILE_FORMAT_MP3;
+ case MMFILE_EXT_MP3:
+ return MM_FILE_FORMAT_MP3;
- case MMFILE_EXT_AAC:
- return MM_FILE_FORMAT_AAC;
+ case MMFILE_EXT_AAC:
+ return MM_FILE_FORMAT_AAC;
- case MMFILE_EXT_XMF:
- case MMFILE_EXT_MXMF:
- return MM_FILE_FORMAT_MID;
+ case MMFILE_EXT_XMF:
+ case MMFILE_EXT_MXMF:
+ return MM_FILE_FORMAT_MID;
- case MMFILE_EXT_MMF:
- case MMFILE_EXT_MA2:
- return MM_FILE_FORMAT_MMF;
+ case MMFILE_EXT_MMF:
+ case MMFILE_EXT_MA2:
+ return MM_FILE_FORMAT_MMF;
- case MMFILE_EXT_IMY:
- return MM_FILE_FORMAT_IMELODY;
+ case MMFILE_EXT_IMY:
+ return MM_FILE_FORMAT_IMELODY;
- case MMFILE_EXT_AVI:
- return MM_FILE_FORMAT_AVI;
+ case MMFILE_EXT_AVI:
+ return MM_FILE_FORMAT_AVI;
- case MMFILE_EXT_DIVX:
- return MM_FILE_FORMAT_DIVX;
+ case MMFILE_EXT_DIVX:
+ return MM_FILE_FORMAT_DIVX;
- case MMFILE_EXT_ASF:
- case MMFILE_EXT_ASX:
- return MM_FILE_FORMAT_ASF;
+ case MMFILE_EXT_ASF:
+ case MMFILE_EXT_ASX:
+ return MM_FILE_FORMAT_ASF;
- case MMFILE_EXT_WMA:
- return MM_FILE_FORMAT_WMA;
+ case MMFILE_EXT_WMA:
+ return MM_FILE_FORMAT_WMA;
- case MMFILE_EXT_WMV:
- return MM_FILE_FORMAT_WMV;
+ case MMFILE_EXT_WMV:
+ return MM_FILE_FORMAT_WMV;
- case MMFILE_EXT_OGG:
- return MM_FILE_FORMAT_OGG;
+ case MMFILE_EXT_OGG:
+ return MM_FILE_FORMAT_OGG;
- case MMFILE_EXT_MKV:
- case MMFILE_EXT_MKA:
- case MMFILE_EXT_WEBM:
- return MM_FILE_FORMAT_MATROSKA;
+ case MMFILE_EXT_MKV:
+ case MMFILE_EXT_MKA:
+ case MMFILE_EXT_WEBM:
+ return MM_FILE_FORMAT_MATROSKA;
- case MMFILE_EXT_MOV:
- return MM_FILE_FORMAT_QT;
+ case MMFILE_EXT_MOV:
+ return MM_FILE_FORMAT_QT;
- case MMFILE_EXT_FLAC:
- return MM_FILE_FORMAT_FLAC;
+ case MMFILE_EXT_FLAC:
+ return MM_FILE_FORMAT_FLAC;
- case MMFILE_EXT_FLV:
- return MM_FILE_FORMAT_FLV;
+ case MMFILE_EXT_FLV:
+ return MM_FILE_FORMAT_FLV;
- case MMFILE_EXT_RM:
- case MMFILE_EXT_RMVB:
- return MM_FILE_FORMAT_REAL;
+ case MMFILE_EXT_RM:
+ case MMFILE_EXT_RMVB:
+ return MM_FILE_FORMAT_REAL;
- case MMFILE_EXT_M2TS:
- case MMFILE_EXT_MTS:
- case MMFILE_EXT_TP:
- case MMFILE_EXT_TS:
- return MM_FILE_FORMAT_M2TS;
+ case MMFILE_EXT_M2TS:
+ case MMFILE_EXT_MTS:
+ case MMFILE_EXT_TP:
+ case MMFILE_EXT_TS:
+ return MM_FILE_FORMAT_M2TS;
- case MMFILE_EXT_MPEG:
- return MM_FILE_FORMAT_M2PS;
+ case MMFILE_EXT_MPEG:
+ return MM_FILE_FORMAT_M2PS;
- case MMFILE_EXT_AIF:
- case MMFILE_EXT_AIFF:
- return MM_FILE_FORMAT_AIFF;
+ case MMFILE_EXT_AIF:
+ case MMFILE_EXT_AIFF:
+ return MM_FILE_FORMAT_AIFF;
- default:
- return MM_FILE_FORMAT_NUM;
+ default:
+ return MM_FILE_FORMAT_NUM;
}
}
goto FILE_FORMAT_FAIL;
}
- if(MMFileFunc[skip_index].Valid!= NULL && MMFileFunc[skip_index].Valid(fp, NULL, 5)) { // 3rd argument only mp3
+ if (MMFileFunc[skip_index].Valid != NULL && MMFileFunc[skip_index].Valid(fp, NULL, 5)) { // 3rd argument only mp3
*formatEnum = skip_index;
goto FILE_FORMAT_SUCCESS;
} else {
debug_msg(RELEASE, "search index = [%d]\n", index);
switch (index) {
- case MM_FILE_FORMAT_QT:
- case MM_FILE_FORMAT_3GP:
- case MM_FILE_FORMAT_MP4:
- *formatEnum = (skip_index == MM_FILE_FORMAT_QT || skip_index == MM_FILE_FORMAT_3GP || skip_index == MM_FILE_FORMAT_MP4) ? MM_FILE_FORMAT_NUM : MM_FILE_FORMAT_3GP;
- break;
-
- case MM_FILE_FORMAT_ASF:
- case MM_FILE_FORMAT_WMA:
- case MM_FILE_FORMAT_WMV:
- *formatEnum = (skip_index == MM_FILE_FORMAT_ASF || skip_index == MM_FILE_FORMAT_WMA || skip_index == MM_FILE_FORMAT_WMV) ? MM_FILE_FORMAT_NUM : MM_FILE_FORMAT_ASF;
- break;
-
- case MM_FILE_FORMAT_DIVX:
- case MM_FILE_FORMAT_AVI:
- *formatEnum = (skip_index == MM_FILE_FORMAT_DIVX || skip_index == MM_FILE_FORMAT_AVI) ? MM_FILE_FORMAT_NUM : MM_FILE_FORMAT_AVI;
- break;
-
- /* not supported file */
- case MM_FILE_FORMAT_NUT:
- case MM_FILE_FORMAT_AIFF:
- case MM_FILE_FORMAT_AU:
- case MM_FILE_FORMAT_VOB:
- case MM_FILE_FORMAT_JPG:
- *formatEnum = MM_FILE_FORMAT_NUM;
- break;
+ case MM_FILE_FORMAT_QT:
+ case MM_FILE_FORMAT_3GP:
+ case MM_FILE_FORMAT_MP4:
+ *formatEnum = (skip_index == MM_FILE_FORMAT_QT || skip_index == MM_FILE_FORMAT_3GP || skip_index == MM_FILE_FORMAT_MP4) ? MM_FILE_FORMAT_NUM : MM_FILE_FORMAT_3GP;
+ break;
+
+ case MM_FILE_FORMAT_ASF:
+ case MM_FILE_FORMAT_WMA:
+ case MM_FILE_FORMAT_WMV:
+ *formatEnum = (skip_index == MM_FILE_FORMAT_ASF || skip_index == MM_FILE_FORMAT_WMA || skip_index == MM_FILE_FORMAT_WMV) ? MM_FILE_FORMAT_NUM : MM_FILE_FORMAT_ASF;
+ break;
+
+ case MM_FILE_FORMAT_DIVX:
+ case MM_FILE_FORMAT_AVI:
+ *formatEnum = (skip_index == MM_FILE_FORMAT_DIVX || skip_index == MM_FILE_FORMAT_AVI) ? MM_FILE_FORMAT_NUM : MM_FILE_FORMAT_AVI;
+ break;
+
+ /* not supported file */
+ case MM_FILE_FORMAT_NUT:
+ case MM_FILE_FORMAT_AIFF:
+ case MM_FILE_FORMAT_AU:
+ case MM_FILE_FORMAT_VOB:
+ case MM_FILE_FORMAT_JPG:
+ *formatEnum = MM_FILE_FORMAT_NUM;
+ break;
- default:
- *formatEnum = index;
- //debug_error(RELEASE, "error: invaild format enum[%d]\n", index);
- break;
+ default:
+ *formatEnum = index;
+ //debug_error(RELEASE, "error: invaild format enum[%d]\n", index);
+ break;
}
- if (MMFileFunc[*formatEnum].Valid!= NULL && MMFileFunc[*formatEnum].Valid(fp, NULL, 50)) {
+ if (MMFileFunc[*formatEnum].Valid != NULL && MMFileFunc[*formatEnum].Valid(fp, NULL, 50)) {
if (fileSrc->type == MM_FILE_SRC_TYPE_MEMORY) fileSrc->memory.format = *formatEnum;
goto FILE_FORMAT_SUCCESS;
}
*
* @file mm_file.h
* @author
- * @version 1.0
+ * @version 1.0
* @brief This file declares data structures and functions of flie
* library.
*/
/**
* content attributes.
*/
-#define MM_FILE_CONTENT_DURATION "content-duration" /**< Duration of media */
+#define MM_FILE_CONTENT_DURATION "content-duration" /**< Duration of media */
#define MM_FILE_CONTENT_VIDEO_CODEC "content-video-codec" /**< Used video codec */
#define MM_FILE_CONTENT_VIDEO_FORMAT "content-video-format" /**< Used video format */
#define MM_FILE_CONTENT_VIDEO_BITRATE "content-video-bitrate" /**< Bitrate of video stream */
-#define MM_FILE_CONTENT_VIDEO_FPS "content-video-fps" /**< Frames per second of video stream */
-#define MM_FILE_CONTENT_VIDEO_WIDTH "content-video-width" /**< Width of video stream */
+#define MM_FILE_CONTENT_VIDEO_FPS "content-video-fps" /**< Frames per second of video stream */
+#define MM_FILE_CONTENT_VIDEO_WIDTH "content-video-width" /**< Width of video stream */
#define MM_FILE_CONTENT_VIDEO_HEIGHT "content-video-height" /**< Height of video stream */
#define MM_FILE_CONTENT_VIDEO_THUMBNAIL "content-video-thumbnail" /**< Thumbnail of video stream */
#define MM_FILE_CONTENT_VIDEO_TRACK_INDEX "content-video-track-index" /**< Current stream of video */
#define MM_FILE_CONTENT_VIDEO_TRACK_COUNT "content-video-track-count"/**< Number of video streams */
#define MM_FILE_CONTENT_AUDIO_CODEC "content-audio-codec" /**< Used audio codec */
-#define MM_FILE_CONTENT_AUDIO_BITRATE "content-audio-bitrate" /**< Bitrate of audio stream */
-#define MM_FILE_CONTENT_AUDIO_CHANNELS "content-audio-channels" /**< Channels of audio stream */
+#define MM_FILE_CONTENT_AUDIO_BITRATE "content-audio-bitrate" /**< Bitrate of audio stream */
+#define MM_FILE_CONTENT_AUDIO_CHANNELS "content-audio-channels" /**< Channels of audio stream */
#define MM_FILE_CONTENT_AUDIO_SAMPLERATE "content-audio-samplerate" /**< Sampling rate of audio stream */
#define MM_FILE_CONTENT_AUDIO_TRACK_INDEX "content-audio-track-index" /**< Current stream of audio */
#define MM_FILE_CONTENT_AUDIO_TRACK_COUNT "content-audio-track-count"/**< Number of audio streams */
/**
* tag attributes.
*/
-#define MM_FILE_TAG_ARTIST "tag-artist" /**< Artist */
+#define MM_FILE_TAG_ARTIST "tag-artist" /**< Artist */
#define MM_FILE_TAG_TITLE "tag-title" /**< Title */
#define MM_FILE_TAG_ALBUM "tag-album" /**< Album */
#define MM_FILE_TAG_ALBUM_ARTIST "tag-album-artist" /**< Album_Artist */
#define MM_FILE_TAG_LONGITUDE "tag-longitude" /**< location Information*/
#define MM_FILE_TAG_LATIDUE "tag-latitude" /**< location Information*/
#define MM_FILE_TAG_ALTIDUE "tag-altitude" /**< location Information*/
-#define MM_FILE_TAG_CONDUCTOR "tag-conductor" /**< Conductor Information*/
-#define MM_FILE_TAG_UNSYNCLYRICS "tag-unsynclyrics" /**< Unsynchronized Lyrics Information*/
-#define MM_FILE_TAG_SYNCLYRICS_NUM "tag-synclyrics-num" /**< Synchronized Lyrics Information*/
+#define MM_FILE_TAG_CONDUCTOR "tag-conductor" /**< Conductor Information*/
+#define MM_FILE_TAG_UNSYNCLYRICS "tag-unsynclyrics" /**< Unsynchronized Lyrics Information*/
+#define MM_FILE_TAG_SYNCLYRICS_NUM "tag-synclyrics-num" /**< Synchronized Lyrics Information*/
#define MM_FILE_TAG_RECDATE "tag-recdate" /**< Recoding date */
#define MM_FILE_TAG_ROTATE "tag-rotate" /**< Rotate(Orientation) Information*/
#define MM_FILE_TAG_CDIS "tag-cdis" /**< CDIS in User Data Information*/
*
* @pre File should be exists.
* @post Handle is ready to use.
- * @see mm_file_destroy_tag_attrs, mm_file_get_attrs
+ * @see mm_file_destroy_tag_attrs, mm_file_get_attrs
* @par Example:
* @code
#include <mm_file.h>
* @remark None.
* @pre Handle should be valid.
* @post Handle is not valid any more.
- * @see mm_file_create_tag_attrs, mm_file_get_attrs
+ * @see mm_file_create_tag_attrs, mm_file_get_attrs
* @par Example:
* @code
#include <mm_file.h>
*
* @pre File should be exists.
* @post Handle is ready to use.
- * @see mm_file_destroy_content_attrs, mm_file_get_attrs
+ * @see mm_file_destroy_content_attrs, mm_file_get_attrs
* @par Example:
* @code
#include <mm_file.h>
*
* @pre Handle should be valid.
* @post Handle is not valid anymore.
- * @see mm_file_create_content_attrs, mm_file_get_attrs
+ * @see mm_file_create_content_attrs, mm_file_get_attrs
* @par Example:
* @code
#include <mm_file.h>
*
* @param attrs [in] tag or content attribute handle.
* @param err_attr_name [out] Name of attribute which is failed to get
- * @param first_attribute_name [in] Name of the first attribute to get
- * @param ... [in] Value for the first attribute, followed optionally by more name/value pairs, terminated by NULL.
- * But, in the case of data or string type, it should be name/value/size.
+ * @param first_attribute_name [in] Name of the first attribute to get
+ * @param ... [in] Value for the first attribute, followed optionally by more name/value pairs, terminated by NULL.
+ * But, in the case of data or string type, it should be name/value/size.
*
* @return This function returns MM_ERROR_NONE on success, or negative value with error code.
*
* And, if this function is failed, err_attr_name param must be free.
* @pre Handle should be valid.
* @post Every input parameters are set by each information attributes.
- * @see mm_file_create_content_attrs, mm_file_create_tag_attrs
+ * @see mm_file_create_content_attrs, mm_file_create_tag_attrs
* @par Example:
* @code
#include <mm_file.h>
*
* @pre Input data pointer and input size should be valid. format should be matched with actual data.
* @post Tag attribute handle is ready to use.
- * @see mm_file_destroy_tag_attrs
+ * @see mm_file_destroy_tag_attrs
* @code
#include <mm_file.h>
*
* @pre Input data pointer and input size should be valid. format should be matched with actual data.
* @post Content attribute handle is ready to use.
- * @see mm_file_destroy_content_attrs
+ * @see mm_file_destroy_content_attrs
* @par Example::
* @code
#include <mm_file.h>
*
* @pre File should be exists.
* @post Handle is ready to use.
- * @see mm_file_destroy_content_attrs, mm_file_get_attrs
+ * @see mm_file_destroy_content_attrs, mm_file_get_attrs
* @par Example::
* @code
#include <mm_file.h>
#define FONT_COLOR_GRAY "\033[37m"
#define debug_log(mode, fmt, arg...) do { \
- if(mode == DEBUG) { \
+ if (mode == DEBUG) { \
LOGD(FONT_COLOR_RESET fmt, ##arg); \
- } else if(mode == RELEASE) { \
- if(DEBUG_MODE == 1) \
+ } else if (mode == RELEASE) { \
+ if (DEBUG_MODE == 1) \
LOGD(FONT_COLOR_RESET fmt, ##arg); \
} \
} while (0)
#define debug_msg(mode, fmt, arg...) do { \
- if(mode == DEBUG) { \
+ if (mode == DEBUG) { \
LOGD(FONT_COLOR_RESET fmt, ##arg); \
- } else if(mode == RELEASE) { \
- if(DEBUG_MODE == 1) \
+ } else if (mode == RELEASE) { \
+ if (DEBUG_MODE == 1) \
LOGD(FONT_COLOR_RESET fmt, ##arg); \
} \
} while (0)
#define debug_warning(mode, fmt, arg...) do { \
- if(mode == DEBUG) { \
+ if (mode == DEBUG) { \
LOGW(FONT_COLOR_GREEN fmt, ##arg); \
- } else if(mode == RELEASE) { \
- if(DEBUG_MODE == 1) \
+ } else if (mode == RELEASE) { \
+ if (DEBUG_MODE == 1) \
LOGW(FONT_COLOR_GREEN fmt, ##arg); \
} \
} while (0)
#define debug_error(mode, fmt, arg...) do { \
- if(mode == DEBUG) { \
+ if (mode == DEBUG) { \
LOGE(FONT_COLOR_RED fmt, ##arg); \
- } else if(mode == RELEASE) { \
- if(DEBUG_MODE == 1) \
+ } else if (mode == RELEASE) { \
+ if (DEBUG_MODE == 1) \
LOGE(FONT_COLOR_RED fmt, ##arg); \
} \
} while (0)
#define debug_fenter(mode) do { \
- if(mode == DEBUG) { \
+ if (mode == DEBUG) { \
LOGE(FONT_COLOR_RESET "<ENTER> \n"); \
- } else if(mode == RELEASE) { \
- if(DEBUG_MODE == 1) \
+ } else if (mode == RELEASE) { \
+ if (DEBUG_MODE == 1) \
LOGE(FONT_COLOR_RESET "<ENTER> \n"); \
} \
} while (0)
#define debug_fleave(mode) do { \
- if(mode == DEBUG) { \
+ if (mode == DEBUG) { \
LOGE(FONT_COLOR_RESET "<LEAVE> \n"); \
- } else if(mode == RELEASE) { \
- if(DEBUG_MODE == 1) \
+ } else if (mode == RELEASE) { \
+ if (DEBUG_MODE == 1) \
LOGE(FONT_COLOR_RESET "<LEAVE> \n"); \
} \
} while (0)
#else
#define debug_log(mode, fmt, arg...) do { \
- if(mode == DEBUG) { \
+ if (mode == DEBUG) { \
LOGD(" "fmt"", ##arg); \
- } else if(mode == RELEASE) { \
- if(DEBUG_MODE == 1) \
+ } else if (mode == RELEASE) { \
+ if (DEBUG_MODE == 1) \
LOGD(" "fmt"", ##arg); \
} \
} while (0)
#define debug_msg(mode, fmt, arg...) do { \
- if(mode == DEBUG) { \
+ if (mode == DEBUG) { \
LOGD(" "fmt"", ##arg); \
- } else if(mode == RELEASE) { \
- if(DEBUG_MODE == 1) \
+ } else if (mode == RELEASE) { \
+ if (DEBUG_MODE == 1) \
LOGD(" "fmt"", ##arg); \
} \
} while (0)
#define debug_warning(mode, fmt, arg...) do { \
- if(mode == DEBUG) { \
+ if (mode == DEBUG) { \
LOGW(" "fmt"", ##arg); \
- } else if(mode == RELEASE) { \
- if(DEBUG_MODE == 1) \
+ } else if (mode == RELEASE) { \
+ if (DEBUG_MODE == 1) \
LOGW(" "fmt"", ##arg); \
} \
} while (0)
#define debug_error(mode, fmt, arg...) do { \
- if(mode == DEBUG) { \
+ if (mode == DEBUG) { \
LOGE(" "fmt"", ##arg); \
- } else if(mode == RELEASE) { \
- if(DEBUG_MODE == 1) \
+ } else if (mode == RELEASE) { \
+ if (DEBUG_MODE == 1) \
LOGE(" "fmt"", ##arg); \
} \
} while (0)
#define debug_fenter(mode) do { \
- if(mode == DEBUG) { \
+ if (mode == DEBUG) { \
LOGE("<ENTER> \n"); \
- } else if(mode == RELEASE) { \
- if(DEBUG_MODE == 1) \
+ } else if (mode == RELEASE) { \
+ if (DEBUG_MODE == 1) \
LOGE("<ENTER> \n"); \
} \
} while (0)
#define debug_fleave(mode) do { \
- if(mode == DEBUG) { \
+ if (mode == DEBUG) { \
LOGE("<LEAVE> \n"); \
- } else if(mode == RELEASE) { \
- if(DEBUG_MODE == 1) \
+ } else if (mode == RELEASE) { \
+ if (DEBUG_MODE == 1) \
LOGE("<LEAVE> \n"); \
} \
} while (0)
#define MM_FILE_SET_MEDIA_FILE_SRC(Media, Filename) do { \
(Media).type = MM_FILE_SRC_TYPE_FILE; \
- (Media).file.path = ((strstr(Filename, "file://")!=NULL) ? Filename+7:Filename); \
+ (Media).file.path = ((strstr(Filename, "file://") != NULL) ? Filename+7 : Filename); \
} while (0);
#define MM_FILE_SET_MEDIA_MEM_SRC(Media, Memory, Size, Format) do { \
int height;
int nbChannel;
int samplePerSec;
- int bitPerSample;
+ int bitPerSample;
bool is_uhqa;
} MMFileFormatStream;
debug_fleave(RELEASE);
return ret;
-}
\ No newline at end of file
+}
SAFE_STRLCPY(accurate_mode, (char *)accurate, sizeof(accurate_mode));
if (strlen(accurate_mode) > 0) {
- if (strncmp (accurate_mode, "1", 1) == 0)
+ if (strncmp(accurate_mode, "1", 1) == 0)
is_accurate = TRUE;
}
#define CAST_MM_HANDLE(x) (MMHandleType)(x)
#ifndef TRUE
-#define TRUE (1==1)
+#define TRUE (1 == 1)
#endif
#ifndef FALSE
#define FALSE (!TRUE)
int mmfile_util_wstrlen(unsigned short *wText);
short *mmfile_swap_2byte_string(short *mszOutput, short *mszInput, int length);
char *mmfile_get_charset(const char *str);
-char *mmfile_string_convert(const char *str, unsigned int len,
- const char *to_codeset, const char *from_codeset,
- gsize *bytes_read,
- unsigned int *bytes_written);
+char *mmfile_string_convert(const char *str, unsigned int len, const char *to_codeset, const char *from_codeset, gsize *bytes_read, unsigned int *bytes_written);
char *mmfile_strdup(const char *str);
MMFILE_PIXEL_FORMAT_MAX,
} eMMFilePixelFormat;
-int mmfile_util_image_convert(unsigned char *src, eMMFilePixelFormat src_fmt, int src_width, int src_height,
- unsigned char *dst, eMMFilePixelFormat dst_fmt, int dst_width, int dst_height);
+int mmfile_util_image_convert(unsigned char *src, eMMFilePixelFormat src_fmt, int src_width, int src_height, unsigned char *dst, eMMFilePixelFormat dst_fmt, int dst_width, int dst_height);
/* MEMORY API // */
/*////////////////////////////////////////////////////////////////////// */
void *mmfile_malloc(unsigned int size);
-#define mmfile_free(ptr) do { if((ptr)) { mmfile_free_r((ptr)); (ptr) = NULL;} } while (0)
+#define mmfile_free(ptr) do { if ((ptr)) { mmfile_free_r((ptr)); (ptr) = NULL; } } while (0)
void mmfile_free_r(void *ptr);
void *mmfile_realloc(void *ptr, unsigned int size);
void *mmfile_memset(void *s, int c, unsigned int n);
void *mmfile_realloc_debug(void *ptr, unsigned int size, const char *func, unsigned int line);
void *mmfile_memset_debug(void *s, int c, unsigned int n, const char *func, unsigned int line);
void *mmfile_memcpy_debug(void *dest, const void *src, unsigned int n, const char *func, unsigned int line);
-
-char *mmfile_string_convert_debug(const char *str, unsigned int len,
- const char *to_codeset, const char *from_codeset,
- int *bytes_read,
- int *bytes_written,
- const char *func,
- unsigned int line);
+char *mmfile_string_convert_debug(const char *str, unsigned int len, const char *to_codeset, const char *from_codeset,
+ int *bytes_read,
+ int *bytes_written,
+ const char *func,
+ unsigned int line);
char *mmfile_strdup_debug(const char *str, const char *func, unsigned int line);
#define mmfile_malloc(size) mmfile_malloc_debug((size), __func__, __LINE__)
#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';}}
+#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)
{
int pictureType;
int imageLen;
int imgDesLen;
- int imgMimetypeLen;
+ int imgMimetypeLen;
bool bURLInfo;
} AvTagVer2ImageInfo;
int album_artistLen;
/* for PC Studio Podcast */
- int contentGroupLen;
+ int contentGroupLen;
/* for ID3V2 Tag */
int encbyLen;
int urlLen;
int originartistLen;
int composerLen;
- int unsynclyricsLen;
- int syncLyricsNum;
+ int unsynclyricsLen;
+ int syncLyricsNum;
/* To send resolution info to appl from OEM */
- int width;
- int height;
+ int width;
+ int height;
unsigned int bitRate;
unsigned int sampleRate;
char *pYear;
char *pGenre;
char *pTrackNum; /*Track number/Position in set */
- char *pRecDate; /*Recording dates */
+ char *pRecDate; /*Recording dates */
char *pConductor; /*[#TPE3 Conductor/performer refinement], ADDED: 2010-01-xx*/
typedef struct {
int videocodec;
int audiocodec;
- int width;
- int height;
+ int width;
+ int height;
} AvExtraInfo;
typedef struct {
- unsigned long time_info;
- char *lyric_info;
+ unsigned long time_info;
+ char *lyric_info;
} AvSynclyricsInfo;
void mm_file_free_synclyrics_list(GList *synclyrics_list);
memHandle = h->privateData;
switch (whence) {
- case MMFILE_SEEK_SET:
- tmp_offset = 0 + pos;
- break;
- case MMFILE_SEEK_CUR:
- tmp_offset = memHandle->offset + pos;
- break;
- case MMFILE_SEEK_END:
- tmp_offset = memHandle->size + pos;
- break;
- default:
- return MMFILE_IO_FAILED;
+ case MMFILE_SEEK_SET:
+ tmp_offset = 0 + pos;
+ break;
+ case MMFILE_SEEK_CUR:
+ tmp_offset = memHandle->offset + pos;
+ break;
+ case MMFILE_SEEK_END:
+ tmp_offset = memHandle->size + pos;
+ break;
+ default:
+ return MMFILE_IO_FAILED;
}
/*check validation*/
mmapHandle = h->privateData;
switch (whence) {
- case SEEK_SET:
- tmp_offset = 0 + pos;
- break;
- case SEEK_CUR:
- tmp_offset = mmapHandle->offset + pos;
- break;
- case SEEK_END:
- tmp_offset = mmapHandle->size + pos;
- break;
- default:
- return MMFILE_IO_FAILED;
+ case SEEK_SET:
+ tmp_offset = 0 + pos;
+ break;
+ case SEEK_CUR:
+ tmp_offset = mmapHandle->offset + pos;
+ break;
+ case SEEK_END:
+ tmp_offset = mmapHandle->size + pos;
+ break;
+ default:
+ return MMFILE_IO_FAILED;
}
/*check validation*/
if ((j + frameSize) >= (readed - _MMFILE_MP3_HEADER_LENGTH)) {
debug_msg(RELEASE, "MP3 coner hit %d %d\n", j, frameSize);
- break;
+ break;
}
frameSize = _MMFileIsMP3Header(buffer + j + frameSize);
if (count == frameCnt) {
ret = 1;
debug_msg(RELEASE, "Header Detected at %d\n", i + j);
- goto exit;
+ goto exit;
}
} else {
offset = 1;
}
failMP3:
- debug_msg(RELEASE, "Header Not Detected at: %d\n", i + j);
+ debug_msg(RELEASE, "Header Not Detected at: %d\n", i + j);
exit:
if (pFileIO == NULL && fp != NULL)
mmfile_close(fp);
break;
}
- debug_msg(RELEASE, "read error. size = %d. i = %d\n", readed, i);
+ debug_msg(RELEASE, "read error. size = %d. i = %d\n", readed, i);
- for (j = 0; (j < readed - _MMFILE_AAC_HEADER_LENGTH); j++) {
+ for (j = 0; (j < readed - _MMFILE_AAC_HEADER_LENGTH); j++) {
sync = ((buffer[j] << 8) | (buffer[j + 1]));
}
if ((j + frameSize) >= (readed - 2)) {
debug_msg(RELEASE, "AAC coner hit %d %d\n", j, frameSize);
- break;
+ break;
}
sync = ((buffer[j + frameSize] << 8) | (buffer[j + frameSize + 1]));
if ((sync & 0xFFF6) == 0xFFF0) {
ret = 1;
debug_msg(RELEASE, "AAC ADTS Header Detected at %d\n", i + j);
- goto exit;
+ goto exit;
}
} else if (!memcmp((buffer + j), "ADIF", 4)) {
ret = 1;
debug_msg(RELEASE, "AAC ADIF Header Detected at %d\n", i + j);
- goto exit;
+ goto exit;
}
}
/*If j is zero, this loop is infinite */
fail:
- debug_msg(RELEASE, "Header Detected Failed\n");
+ debug_msg(RELEASE, "Header Detected Failed\n");
exit:
if (pFileIO == NULL && fp != NULL)
mmfile_close(fp);
for (j = 0; (j <= readed - _MMFILE_OGG_HEADER_LENGTH); j++) {
if (1 == _MMFileIsOGGHeader(buffer + j)) {
ret = 1;
- debug_msg(RELEASE, "Header Detected at %d\n", i + j);
- goto exit;
+ debug_msg(RELEASE, "Header Detected at %d\n", i + j);
+ goto exit;
}
}