コード例 #1
0
ファイル: FAAD.cpp プロジェクト: TravisKraatz/cinelerra
int AacPcm::processData(MediaInfo *infos, ChunkList *chunk_list, bool *killswitch)
{
DWORD			BytesDecoded=0;
char			*bufout=0;
ChunkInfosI		*ci=0;
svc_fileReader	*reader=0;

	if(!FindBitrate && !chunk_list)
		ERROR_processData("chunk_list==NULL"); // is this case possible?

	if(!(reader=infos->getReader()))
		ERROR_processData("File doesn\'t exists");

	if(chunk_list)
	{
		if(!(ci=new ChunkInfosI()))
			ERROR_processData("Memory allocation error: ci");

		ci->addInfo("srate", Samplerate);
		ci->addInfo("bps", bps);
		ci->addInfo("nch", Channels);
	}

	if(!IsAAC) // MP4 file --------------------------------------------------------------------------
	{   
	unsigned __int32 buffer_size=0;
    int rc;

		if(newpos_ms>-1)
		{
		MP4Duration duration=MP4ConvertToTrackDuration(mp4File,track,newpos_ms,MP4_MSECS_TIME_SCALE);
            sampleId=MP4GetSampleIdFromTime(mp4File,track,duration,0);
			bytes_read=(DWORD)(((float)newpos_ms*file_info.bitrate)/(8*1000));
			reader->seek(bytes_read);  // updates slider
			newpos_ms=-1;
		}
		do
		{
			buffer=NULL;
			if(sampleId>=numSamples)
				ERROR_processData(0);

			rc=MP4ReadSample(mp4File, track, sampleId++, (unsigned __int8 **)&buffer, &buffer_size, NULL, NULL, NULL, NULL);
			if(rc==0 || buffer==NULL)
			{
				FREE_ARRAY(buffer);
				ERROR_processData("MP4ReadSample")
			}

			bufout=(char *)faacDecDecode(hDecoder,&frameInfo,buffer,buffer_size);
			BytesDecoded=frameInfo.samples*sizeof(short);
			FREE_ARRAY(buffer);
			// to update the slider
			bytes_read+=buffer_size;
			reader->seek(bytes_read);
		}while(!BytesDecoded && !frameInfo.error);
コード例 #2
0
ファイル: FAAD.cpp プロジェクト: TravisKraatz/cinelerra
AacPcm::~AacPcm()
{
	if(mp4File)
		MP4Close(mp4File);
	if(aacFile)
		fclose(aacFile);
	if(hDecoder)
		faacDecClose(hDecoder);
	FREE_ARRAY(buffer);
	FREE_ARRAY(seek_table);
}
コード例 #3
0
ファイル: excelplugins.c プロジェクト: UIKit0/gnumeric
static void
destruct_xloper (XLOPER*x)
{
	if (NULL != x) {
		switch (x->xltype & xltypeType) {
		case xltypeNum:
			break;
		case xltypeStr:
			delete_string (&x->val.str);
			break;
		case xltypeBool:
			break;
		case xltypeRef:
			if (NULL != x->val.mref.lpmref &&
			    x->val.mref.lpmref->count != 1) {
				unsupported_xloper_type (x);
			} else {
				if (NULL != x->val.mref.lpmref)
					FREE_ARRAY (x->val.mref.lpmref, 1);
				x->val.mref.lpmref = NULL;
			}
			break;
		case xltypeErr:
			break;
		case xltypeFlow:
			unsupported_xloper_type (x);
			break;
		case xltypeMulti: {
			int n = x->val.array.rows*x->val.array.columns;
			int i;
			for (i = 0; i < n; ++i) {
				destruct_xloper (x->val.array.lparray+i);
			}
			FREE_ARRAY (x->val.array.lparray,n);
			break;
		}
		case xltypeMissing:
			break;
		case xltypeNil:
			break;
		case xltypeSRef:
			unsupported_xloper_type (x);
			break;
		case xltypeInt:
			break;
		default:
			unsupported_xloper_type (x);
		}
		x->xltype = xltypeNil;
	}
}
コード例 #4
0
ファイル: CTag.cpp プロジェクト: VideoTec/video-doc
int CMP4Tag::WriteMP4Tag(MP4FileHandle MP4File)
{
char	buf[512], *faac_id_string, *faac_copyright_string;

	if(MP4File==NULL)
	{
		MessageBox(NULL,"WriteMp4Tag: can't open file!",NULL,MB_OK);
		return 1;
	}

	sprintf(buf, "FAAC v%s", (faacEncGetVersion(&faac_id_string, &faac_copyright_string)==FAAC_CFG_VERSION) ? faac_id_string : " wrong libfaac version");
	MP4SetMetadataTool(MP4File, buf);

	if(artist) MP4SetMetadataArtist(MP4File, artist);
	if(writer) MP4SetMetadataWriter(MP4File, writer);
	if(title) MP4SetMetadataName(MP4File, title);
	if(album) MP4SetMetadataAlbum(MP4File, album);
	if(trackno>0) MP4SetMetadataTrack(MP4File, trackno, ntracks);
	if(discno>0) MP4SetMetadataDisk(MP4File, discno, ndiscs);
	if(compilation) MP4SetMetadataCompilation(MP4File, compilation);
	if(year) MP4SetMetadataYear(MP4File, year);
	if(genre) MP4SetMetadataGenre(MP4File, genre);
	if(comment) MP4SetMetadataComment(MP4File, comment);
	if(art.size=ReadCoverArtFile(artFilename,&art.data))
	{
		MP4SetMetadataCoverArt(MP4File, (unsigned __int8 *)art.data, art.size);
		FREE_ARRAY(art.data);
	}
	return 0;
}
コード例 #5
0
static void destruct_xloper(XLOPER*x){
	int i,n;
	if (NULL!=x){
		switch(x->xltype & xltypeType){
		case xltypeNum:							break;
		case xltypeStr:		g_free(x->val.str); x->val.str=0;	break;
		case xltypeBool:						break;
		case xltypeRef:		unsupported_xloper_type(x);		break;
		case xltypeErr:							break;
		case xltypeFlow:	unsupported_xloper_type(x);		break;
		case xltypeMulti:
			n=x->val.array.rows*x->val.array.columns;
			for (i=0;i<n;++i){
				destruct_xloper(x->val.array.lparray+i);
			}
			FREE_ARRAY(x->val.array.lparray,n);
			break;
		case xltypeMissing:						break;
		case xltypeNil:							break;
		case xltypeSRef:	unsupported_xloper_type(x);		break;
		case xltypeInt:							break;
		default:		unsupported_xloper_type(x);
		}
	}
	x->xltype=xltypeNil;
}
コード例 #6
0
ファイル: Out_faac.cpp プロジェクト: BOTCrusher/sagetv
int Open(int lSamprate, int wChannels, int wBitsPerSample, int bufferlenms, int prebufferms)
{
CMyEncCfg	cfg;
char		OutFilename[MAX_PATH],
			*srcFilename=NULL;
//			buf[MAX_PATH],
//			*tsrcFilename;

	w_offset = writtentime = 0;
	numchan = wChannels;
	srate = lSamprate;
	bps = wBitsPerSample;

	strcpy(config_AACoutdir,cfg.OutDir);
	GetNewFileName(OutFilename);

	Cpcmaac=new Cfaac();
#ifdef USE_IMPORT_TAG
/*	GetWindowText(out.hMainWindow,buf,sizeof(buf));
	tsrcFilename=getWASourceName(buf);
	srcFilename=Cpcmaac->getSourceFilename(cfg.TagSrcPath,tsrcFilename,cfg.TagSrcExt);
	FREE_ARRAY(tsrcFilename);*/
	srcFilename=getSourceName(out.hMainWindow);
#endif
	if(!Cpcmaac->Init(srcFilename,OutFilename,lSamprate,wBitsPerSample,wChannels,-1))
		ERROR_O(0);

	FREE_ARRAY(srcFilename);
	return 0;
}
コード例 #7
0
ファイル: CTag.cpp プロジェクト: VideoTec/video-doc
int CMP4Tag::ReadAacTag(char *Filename)
{
char	*buf=NULL;
ID3_Tag id3Tag;
ID3_Frame *Frame;

	if(!id3Tag.Link(Filename))
	{
	char buf[25+MAX_PATH+1];
		sprintf(buf,"ReadAacTag: can't open \"%s\"",Filename);
		MessageBox(NULL,buf,NULL,MB_OK);
		return 1;
	}

	GET_FIELD_STR(id3Tag,ID3FID_ENCODEDBY,ID3FN_TEXT,copyright);

	GET_FIELD_STR(id3Tag,ID3FID_LEADARTIST,ID3FN_TEXT,artist);
	GET_FIELD_STR(id3Tag,ID3FID_COMPOSER,ID3FN_TEXT,writer);
	GET_FIELD_STR(id3Tag,ID3FID_TITLE,ID3FN_TEXT,title);
	GET_FIELD_STR(id3Tag,ID3FID_ALBUM,ID3FN_TEXT,album);

	GET_FIELD_STR(id3Tag,ID3FID_TRACKNUM,ID3FN_TEXT,buf);
	if(buf)
		trackno=atoi(buf);
	FREE_ARRAY(buf);
	GET_FIELD_STR(id3Tag,ID3FID_YEAR,ID3FN_TEXT,year);
	GET_FIELD_STR(id3Tag,ID3FID_CONTENTTYPE,ID3FN_TEXT,genre);
	GET_FIELD_STR(id3Tag,ID3FID_COMMENT,ID3FN_TEXT,comment);

	if(Frame=id3Tag.Find(ID3FID_PICTURE))
	{
		art.size=Frame->Field(ID3FN_DATA).Size();
		FREE_ARRAY(art.data);
		if(art.data=(char *)malloc(art.size))
			memcpy(art.data,Frame->Field(ID3FN_DATA).GetBinary(),art.size);

		GET_FIELD_STR(id3Tag,ID3FID_PICTURE,ID3FN_MIMETYPE,art.mimeType);
		GET_FIELD_STR(id3Tag,ID3FID_PICTURE,ID3FN_DESCRIPTION,art.description);
		GET_FIELD_STR(id3Tag,ID3FID_PICTURE,ID3FN_IMAGEFORMAT,art.format);
		art.pictureType=Frame->Field(ID3FN_PICTURETYPE).Get();
/*
	FILE *f=fopen("D:\\prova.jpg","wb");
		fwrite(artFile,1,artSize,f);
		fclose(f);*/
	}
	return 0;
}
コード例 #8
0
ファイル: CTag.cpp プロジェクト: VideoTec/video-doc
int CMP4Tag::WriteAacTag(char *Filename)
{
char	buf[512], *faac_id_string, *faac_copyright_string;
ID3_Tag id3Tag;
FILE *file;

	if((file=fopen(Filename,"r"))==NULL)
	{
	char buf[25+MAX_PATH+1];
		sprintf(buf,"WriteAacTag: can't open \"%s\"",Filename);
		MessageBox(NULL,buf,NULL,MB_OK);
		return 1;
	}
	else
		fclose(file);
	id3Tag.Link(Filename);

	sprintf(buf, "FAAC v%s", (faacEncGetVersion(&faac_id_string, &faac_copyright_string)==FAAC_CFG_VERSION) ? faac_id_string : " wrong libfaac version");
	ADD_FIELD(id3Tag,ID3FID_ENCODEDBY,ID3FN_TEXT,buf);

	ADD_FIELD(id3Tag,ID3FID_LEADARTIST,ID3FN_TEXT,artist);
	ADD_FIELD(id3Tag,ID3FID_COMPOSER,ID3FN_TEXT,writer);
	ADD_FIELD(id3Tag,ID3FID_TITLE,ID3FN_TEXT,title);
	ADD_FIELD(id3Tag,ID3FID_ALBUM,ID3FN_TEXT,album);
	sprintf(buf,"%d",trackno);
	ADD_FIELD(id3Tag,ID3FID_TRACKNUM,ID3FN_TEXT,buf);
	ADD_FIELD(id3Tag,ID3FID_YEAR,ID3FN_TEXT,year);
	ADD_FIELD(id3Tag,ID3FID_CONTENTTYPE,ID3FN_TEXT,genre);
	ADD_FIELD(id3Tag,ID3FID_COMMENT,ID3FN_TEXT,comment);
	art.size=ReadCoverArtFile(artFilename,&art.data);
	if(art.size)
	{
	ID3_Frame *NewFrame=new ID3_Frame(ID3FID_PICTURE);
	char name[_MAX_FNAME], ext[_MAX_EXT];
		_splitpath(artFilename,NULL,NULL,name,ext);

		NewFrame->Field(ID3FN_DESCRIPTION)=name;
	char buf[15];
		sprintf(buf,"image/%s",check_image_header(art.data)==2 ? "jpeg" : strlwr(ext+1));
		NewFrame->Field(ID3FN_MIMETYPE)=buf;
//		NewFrame->Field(ID3FN_IMAGEFORMAT)=;
		NewFrame->Field(ID3FN_PICTURETYPE)=(DWORD)art.pictureType;
		NewFrame->Field(ID3FN_DATA).Set((BYTE *)art.data,art.size);
		id3Tag.AttachFrame(NewFrame);
	}

	// setup all our rendering parameters
    id3Tag.SetUnsync(false);
    id3Tag.SetExtendedHeader(true);
    id3Tag.SetCompression(true);
    id3Tag.SetPadding(true);
 
	// write any changes to the file
    id3Tag.Update();

	FREE_ARRAY(art.data);
	return 0;
}
コード例 #9
0
ファイル: dataset.cpp プロジェクト: Brzous/WindFOAM
/**
 * Cleanout the contents of the zone spec item but leaves the zone spec item.
 * This effectively leaves the zone spec structure in the same state as calling
 * ZoneSpecAlloc initially.
 *
 * param ZoneSpec
 *     Zone spec item to cleanup.
 */
void CleanoutZoneSpec(ZoneSpec_s *ZoneSpec)
{
    REQUIRE(VALID_REF(ZoneSpec));

    if (ZoneSpec->Name != NULL)
        FREE_ARRAY(ZoneSpec->Name, "ZoneSpec name");
    if (ZoneSpec->AuxData != NULL)
        AuxDataDealloc(&ZoneSpec->AuxData);
    SetZoneSpecDefaults(ZoneSpec);
}
コード例 #10
0
ファイル: buscache.c プロジェクト: Kevin-Jin/CDS
/*
***************************************************************************
** Deletes a THoliday pointer. Possibly needs to be exported since it will
** be used as a call-back function.
***************************************************************************
*/
void JpmcdsFreeHoliday
(THoliday *holiday)
{
    if (holiday != NULL)
    {
        JpmcdsHolidayListDelete(holiday->hl);
        FREE_ARRAY(holiday->name);
        FREE(holiday);
        holiday = NULL;
    }
}
コード例 #11
0
ファイル: CTag.cpp プロジェクト: VideoTec/video-doc
int CMP4Tag::ReadCoverArtFile(char *pCoverArtFile, char **artData)
{
FILE *artFile;

	if(!pCoverArtFile || !*pCoverArtFile)
		return 0;

	if(!(artFile=fopen(pCoverArtFile, "rb")))
	{
	char buf[25+MAX_PATH+1];
		sprintf(buf,"ReadCoverArtFile: can't open \"%s\"",pCoverArtFile);
		MessageBox(NULL,buf,NULL,MB_OK);
		return 0;
	}

int r;
char *art;
int	artSize=0;

	fseek(artFile, 0, SEEK_END);
	artSize=ftell(artFile);
	fseek(artFile, 0, SEEK_SET);

	if(!(art=(char *)malloc(artSize)))
	{
		fclose(artFile);
		MessageBox(NULL,"ReadCoverArtFile: Memory allocation error!", NULL, MB_OK);
		return 0;
	}

	r=fread(art, 1, artSize, artFile);
	if(r!=artSize)
	{
		free(art);
		fclose(artFile);
		MessageBox(NULL,"ReadCoverArtFile: Error reading cover art file!", NULL, MB_OK);
		return 0;
	}
	else
		if(artSize<12 || !check_image_header(art))
		{
			// the above expression checks the image signature
			free(art);
			fclose(artFile);
			MessageBox(NULL,"ReadCoverArtFile: Unsupported cover image file format!", NULL, MB_OK);
			return 0;
		}

	FREE_ARRAY(*artData);
	*artData=art;
	fclose(artFile);
	return artSize;
}
コード例 #12
0
ファイル: CTag.cpp プロジェクト: VideoTec/video-doc
int CMP4Tag::ReadMp4Tag(char *Filename)						 
{
MP4FileHandle MP4File;

	if(!(MP4File=MP4Read(Filename, 0)))
	{
	char buf[25+MAX_PATH+1];
		sprintf(buf,"ReadMp4Tag: can't open \"%s\"",Filename);
		MessageBox(NULL,buf,NULL,MB_OK);
		return 1;
	}

	FREE_ARRAY(copyright);
	MP4GetMetadataTool(MP4File, &copyright);

	FREE_ARRAY(artist);
	MP4GetMetadataArtist(MP4File, &artist);
	FREE_ARRAY(writer);
	MP4GetMetadataWriter(MP4File, &writer);
	FREE_ARRAY(title);
	MP4GetMetadataName(MP4File, &title);
	FREE_ARRAY(album);
	MP4GetMetadataAlbum(MP4File, &album);
	MP4GetMetadataTrack(MP4File, (unsigned __int16 *)&trackno, (unsigned __int16 *)&ntracks);
	MP4GetMetadataDisk(MP4File, (unsigned __int16 *)&discno, (unsigned __int16 *)&ndiscs);
	MP4GetMetadataCompilation(MP4File, (unsigned __int8 *)&compilation);
	FREE_ARRAY(year);
	MP4GetMetadataYear(MP4File, &year);
	FREE_ARRAY(genre);
	MP4GetMetadataGenre(MP4File, &genre);
	FREE_ARRAY(comment);
	MP4GetMetadataComment(MP4File, &comment);
	FREE_ARRAY(art.data);
	MP4GetMetadataCoverArt(MP4File, (unsigned __int8 **)&art.data, (u_int32_t *)&art.size);

	MP4Close(MP4File);
/*
	FILE *f=fopen("D:\\prova.jpg","wb");
		fwrite(artFile,1,artSize,f);
		fclose(f);*/
	return 0;
}
コード例 #13
0
G_MODULE_EXPORT void xlAutoFree(XLOPER*p) {
  destruct_xloper(p);
  FREE_ARRAY(p,1);
  return;
}
コード例 #14
0
ファイル: JSONValue.cpp プロジェクト: kg4lod/Neuro-Sand-Cube
/**
 * Parses a JSON encoded value to a JSONValue object
 *
 * @access protected
 *
 * @param wchar_t** data Pointer to a wchar_t* that contains the data
 *
 * @return JSONValue* Returns a pointer to a JSONValue object on success, NULL on error
 */
JSONValue *JSONValue::Parse(const wchar_t **data)
{
    // Is it a string?
    if (**data == '"')
    {
        std::wstring str;
        if (!JSON::ExtractString(&(++(*data)), str))
            return NULL;
        else
            return new JSONValue(str);
    }

    // Is it a boolean?
    else if ((simplejson_wcsnlen(*data, 4) && wcsncasecmp(*data, L"true", 4) == 0) || (simplejson_wcsnlen(*data, 5) && wcsncasecmp(*data, L"false", 5) == 0))
    {
        bool value = wcsncasecmp(*data, L"true", 4) == 0;
        (*data) += value ? 4 : 5;
        return new JSONValue(value);
    }

    // Is it a null?
    else if (simplejson_wcsnlen(*data, 4) && wcsncasecmp(*data, L"null", 4) == 0)
    {
        (*data) += 4;
        return new JSONValue();
    }

    // Is it a number?
    else if (**data == L'-' || (**data >= L'0' && **data <= L'9'))
    {
        // Negative?
        bool neg = **data == L'-';
        if (neg) (*data)++;

        double number = 0.0;

        // Parse the whole part of the number - only if it wasn't 0
        if (**data == L'0')
            (*data)++;
        else if (**data >= L'1' && **data <= L'9')
            number = JSON::ParseInt(data);
        else
            return NULL;

        // Could be a decimal now...
        if (**data == '.')
        {
            (*data)++;

            // Not get any digits?
            if (!(**data >= L'0' && **data <= L'9'))
                return NULL;

            // Find the decimal and sort the decimal place out
            // Use ParseDecimal as ParseInt won't work with decimals less than 0.1
            // thanks to Javier Abadia for the report & fix
            double decimal = JSON::ParseDecimal(data);

            // Save the number
            number += decimal;
        }

        // Could be an exponent now...
        if (**data == L'E' || **data == L'e')
        {
            (*data)++;

            // Check signage of expo
            bool neg_expo = false;
            if (**data == L'-' || **data == L'+')
            {
                neg_expo = **data == L'-';
                (*data)++;
            }

            // Not get any digits?
            if (!(**data >= L'0' && **data <= L'9'))
                return NULL;

            // Sort the expo out
            double expo = JSON::ParseInt(data);
            for (double i = 0.0; i < expo; i++)
                number = neg_expo ? (number / 10.0) : (number * 10.0);
        }

        // Was it neg?
        if (neg) number *= -1;

        return new JSONValue(number);
    }

    // An object?
    else if (**data == L'{')
    {
        JSONObject object;

        (*data)++;

        while (**data != 0)
        {
            // Whitespace at the start?
            if (!JSON::SkipWhitespace(data))
            {
                FREE_OBJECT(object);
                return NULL;
            }

            // Special case - empty object
            if (object.size() == 0 && **data == L'}')
            {
                (*data)++;
                return new JSONValue(object);
            }

            // We want a string now...
            std::wstring name;
            if (!JSON::ExtractString(&(++(*data)), name))
            {
                FREE_OBJECT(object);
                return NULL;
            }

            // More whitespace?
            if (!JSON::SkipWhitespace(data))
            {
                FREE_OBJECT(object);
                return NULL;
            }

            // Need a : now
            if (*((*data)++) != L':')
            {
                FREE_OBJECT(object);
                return NULL;
            }

            // More whitespace?
            if (!JSON::SkipWhitespace(data))
            {
                FREE_OBJECT(object);
                return NULL;
            }

            // The value is here
            JSONValue *value = Parse(data);
            if (value == NULL)
            {
                FREE_OBJECT(object);
                return NULL;
            }

            // Add the name:value
            if (object.find(name) != object.end())
                delete object[name];
            object[name] = value;

            // More whitespace?
            if (!JSON::SkipWhitespace(data))
            {
                FREE_OBJECT(object);
                return NULL;
            }

            // End of object?
            if (**data == L'}')
            {
                (*data)++;
                return new JSONValue(object);
            }

            // Want a , now
            if (**data != L',')
            {
                FREE_OBJECT(object);
                return NULL;
            }

            (*data)++;
        }

        // Only here if we ran out of data
        FREE_OBJECT(object);
        return NULL;
    }

    // An array?
    else if (**data == L'[')
    {
        JSONArray array;

        (*data)++;

        while (**data != 0)
        {
            // Whitespace at the start?
            if (!JSON::SkipWhitespace(data))
            {
                FREE_ARRAY(array);
                return NULL;
            }

            // Special case - empty array
            if (array.size() == 0 && **data == L']')
            {
                (*data)++;
                return new JSONValue(array);
            }

            // Get the value
            JSONValue *value = Parse(data);
            if (value == NULL)
            {
                FREE_ARRAY(array);
                return NULL;
            }

            // Add the value
            array.push_back(value);

            // More whitespace?
            if (!JSON::SkipWhitespace(data))
            {
                FREE_ARRAY(array);
                return NULL;
            }

            // End of array?
            if (**data == L']')
            {
                (*data)++;
                return new JSONValue(array);
            }

            // Want a , now
            if (**data != L',')
            {
                FREE_ARRAY(array);
                return NULL;
            }

            (*data)++;
        }

        // Only here if we ran out of data
        FREE_ARRAY(array);
        return NULL;
    }

    // Ran out of possibilites, it's bad!
    else
    {
        return NULL;
    }
}
コード例 #15
0
ファイル: FAAD.cpp プロジェクト: TravisKraatz/cinelerra
int AacPcm::getInfos(MediaInfo *infos)
{
	if(!infos)
		return 1;

	if(hDecoder)
	{
		SHOW_INFO()
	    return 0;
	}

	IsAAC=strcmpi(infos->getFilename()+lstrlen(infos->getFilename())-4,".aac")==0;

	if(!IsAAC) // MP4 file ---------------------------------------------------------------------
	{
	MP4Duration			length;
	unsigned __int32	buffer_size;
    mp4AudioSpecificConfig mp4ASC;

		if(!(mp4File=MP4Read(infos->getFilename(), 0)))
			ERROR_getInfos("Error opening file");

		if((track=GetAACTrack(mp4File))<0)
			ERROR_getInfos(0); //"Unable to find correct AAC sound track");

		if(!(hDecoder=faacDecOpen()))
			ERROR_getInfos("Error initializing decoder library");

		MP4GetTrackESConfiguration(mp4File, track, (unsigned __int8 **)&buffer, &buffer_size);
		if(!buffer)
			ERROR_getInfos("MP4GetTrackESConfiguration");
		AudioSpecificConfig(buffer, buffer_size, &mp4ASC);
        Channels=mp4ASC.channelsConfiguration;

		if(faacDecInit2(hDecoder, buffer, buffer_size, &Samplerate, &Channels) < 0)
			ERROR_getInfos("Error initializing decoder library");
		FREE_ARRAY(buffer);

		length=MP4GetTrackDuration(mp4File, track);
		len_ms=(DWORD)MP4ConvertFromTrackDuration(mp4File, track, length, MP4_MSECS_TIME_SCALE);
		file_info.bitrate=MP4GetTrackBitRate(mp4File, track);
		file_info.version=MP4GetTrackAudioType(mp4File, track)==MP4_MPEG4_AUDIO_TYPE ? 4 : 2;
		numSamples=MP4GetTrackNumberOfSamples(mp4File, track);
		sampleId=1;
	}
	else // AAC file ------------------------------------------------------------------------------
	{   
	DWORD			read,
					tmp;
	BYTE			Channels4Raw=0;

		if(!(aacFile=fopen(infos->getFilename(),"rb")))
			ERROR_getInfos("Error opening file"); 

		// use bufferized stream
		setvbuf(aacFile,NULL,_IOFBF,32767);

		// get size of file
		fseek(aacFile, 0, SEEK_END);
		src_size=ftell(aacFile);
		fseek(aacFile, 0, SEEK_SET);

		if(!(buffer=(BYTE *)malloc(FAAD_STREAMSIZE)))
			ERROR_getInfos("Memory allocation error: buffer")

		tmp=src_size<FAAD_STREAMSIZE ? src_size : FAAD_STREAMSIZE;
		read=fread(buffer, 1, tmp, aacFile);
		if(read==tmp)
		{
			bytes_read=read;
			bytes_into_buffer=read;
		}
		else
			ERROR_getInfos("Read failed!")

		if(tagsize=id3v2_tag(buffer))
		{
			if(tagsize>(long)src_size)
				ERROR_getInfos("Corrupt stream!");
			if(tagsize<bytes_into_buffer)
			{
				bytes_into_buffer-=tagsize;
				memcpy(buffer,buffer+tagsize,bytes_into_buffer);
			}
			else
			{
				bytes_read=tagsize;
				bytes_into_buffer=0;
				if(tagsize>bytes_into_buffer)
					fseek(aacFile, tagsize, SEEK_SET);
			}
			if(src_size<bytes_read+FAAD_STREAMSIZE-bytes_into_buffer)
				tmp=src_size-bytes_read;
			else
				tmp=FAAD_STREAMSIZE-bytes_into_buffer;
			read=fread(buffer+bytes_into_buffer, 1, tmp, aacFile);
			if(read==tmp)
			{
				bytes_read+=read;
				bytes_into_buffer+=read;
			}
			else
				ERROR_getInfos("Read failed!");
		}

		if(get_AAC_format((char *)infos->getFilename(), &file_info, &seek_table, &seek_table_length, 0))
			ERROR_getInfos("get_AAC_format");
		IsSeekable=file_info.headertype==ADTS && seek_table && seek_table_length>0;
		BlockSeeking=!IsSeekable;

		if(!(hDecoder=faacDecOpen()))
			ERROR_getInfos("Can't open library");

		if(file_info.headertype==RAW)
		{
		faacDecConfiguration	config;

			config.defSampleRate=atoi(cfg_samplerate);
			switch(cfg_profile[1])
			{
			case 'a':
				config.defObjectType=MAIN;
				break;
			case 'o':
				config.defObjectType=LOW;
				break;
			case 'S':
				config.defObjectType=SSR;
				break;
			case 'T':
				config.defObjectType=LTP;
				break;
			}
			switch(cfg_bps[0])
			{
			case '1':
				config.outputFormat=FAAD_FMT_16BIT;
				break;
			case '2':
				config.outputFormat=FAAD_FMT_24BIT;
				break;
			case '3':
				config.outputFormat=FAAD_FMT_32BIT;
				break;
			case 'F':
				config.outputFormat=FAAD_FMT_24BIT;
				break;
			}
			faacDecSetConfiguration(hDecoder, &config);

			if(!FindBitrate)
			{
			AacPcm *NewInst;
				if(!(NewInst=new AacPcm()))
					ERROR_getInfos("Memory allocation error: NewInst");

				NewInst->FindBitrate=TRUE;
				if(NewInst->getInfos(infos))
					ERROR_getInfos(0);
				Channels4Raw=NewInst->frameInfo.channels;
				file_info.bitrate=NewInst->file_info.bitrate*Channels4Raw;
				delete NewInst;
			}
			else
			{
			DWORD	Samples,
					BytesConsumed;

				if((bytes_consumed=faacDecInit(hDecoder,buffer,bytes_into_buffer,&Samplerate,&Channels))<0)
					ERROR_getInfos("Can't init library");
				bytes_into_buffer-=bytes_consumed;
				if(!processData(infos,0,0))
					ERROR_getInfos(0);
				Samples=frameInfo.samples/sizeof(short);
				BytesConsumed=frameInfo.bytesconsumed;
				processData(infos,0,0);
				if(BytesConsumed<frameInfo.bytesconsumed)
					BytesConsumed=frameInfo.bytesconsumed;
				file_info.bitrate=(BytesConsumed*8*Samplerate)/Samples;
				if(!file_info.bitrate)
					file_info.bitrate=1000; // try to continue decoding
				return 0;
			}
		}

		if((bytes_consumed=faacDecInit(hDecoder, buffer, bytes_into_buffer, &Samplerate, &Channels))<0)
			ERROR_getInfos("faacDecInit failed!")
		bytes_into_buffer-=bytes_consumed;

		if(Channels4Raw)
			Channels=Channels4Raw;

		len_ms=(DWORD)((1000*((float)src_size*8))/file_info.bitrate);
	}

	SHOW_INFO();
    return 0;
}
コード例 #16
0
ファイル: c-port.c プロジェクト: kealist/ren-c
*/	void Shutdown_Ports(void)
/*
***********************************************************************/
{
	FREE_ARRAY(SCHEME_ACTIONS, MAX_SCHEMES, Scheme_Actions);
}
コード例 #17
0
ファイル: arith.c プロジェクト: gsmadhusudan/Balsa
/* DeleteMP_INT : Deallocate a NEWed MP_INT (clear it first) */
void DeleteMP_INT (PtrMP_INT integer)
{
    mpz_clear (integer);
    FREE_ARRAY (MP_INT, 1, integer);
}
コード例 #18
0
ファイル: EncDialog.cpp プロジェクト: BlackMael/DirectEncode
BOOL CALLBACK DIALOGMsgProcEnc(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam)
{
	switch(Message)
	{
	case WM_INITDIALOG:
		{
		char buf[50];
		char *Quality[]={"Default","10","20","30","40","50","60","70","80","90","100","110","120","130","140","150","200","300","400","500",0};
		char *BitRate[]={"Auto","8","18","20","24","32","40","48","56","64","96","112","128","160","192","224","256","320","384",0};
		char *BandWidth[]={"Auto","Full","4000","8000","11025","16000","22050","24000","32000","44100","48000",0};
		CMyEncCfg cfg(false);
			
			SetWindowPos(GetDlgItem(hWndDlg,IDC_CHK_TAG),GetDlgItem(hWndDlg,IDC_GRP_TAG),0,0,0,0,SWP_NOMOVE | SWP_NOSIZE);

			INIT_CB(hWndDlg,IDC_CB_QUALITY,Quality,0);
			INIT_CB(hWndDlg,IDC_CB_BITRATE,BitRate,0);
			INIT_CB(hWndDlg,IDC_CB_BANDWIDTH,BandWidth,0);

			INIT_CB_GENRES(hWndDlg,IDC_CB_GENRE,ID3Genres,0);

			SendMessage(GetDlgItem(hWndDlg, IDC_BTN_ARTFILE), BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBmBrowse);
#ifdef IDC_BTN_BROWSE			
			SendMessage(GetDlgItem(hWndDlg, IDC_BTN_BROWSE), BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBmBrowse);
			if(!cfg.OutDir || !*cfg.OutDir)
			{
				GetCurrentDirectory(MAX_PATH,config_AACoutdir);
				FREE_ARRAY(cfg.OutDir);
				cfg.OutDir=strdup(config_AACoutdir);
			}
			else
				strcpy(config_AACoutdir,cfg.OutDir);
			SetDlgItemText(hWndDlg, IDC_E_BROWSE, cfg.OutDir);			
#endif
			if(cfg.EncCfg.mpegVersion==MPEG4)
				CheckDlgButton(hWndDlg,IDC_RADIO_MPEG4,TRUE);
			else
				CheckDlgButton(hWndDlg,IDC_RADIO_MPEG2,TRUE);
			
			switch(cfg.EncCfg.aacObjectType)
			{
			case MAIN:
				CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE);
				break;
			case LOW:
				CheckDlgButton(hWndDlg,IDC_RADIO_LOW,TRUE);
				break;
			case SSR:
				CheckDlgButton(hWndDlg,IDC_RADIO_SSR,TRUE);
				break;
			case LTP:
				CheckDlgButton(hWndDlg,IDC_RADIO_LTP,TRUE);
				DISABLE_LTP
				break;
			}
			
			switch(cfg.EncCfg.outputFormat)
			{
			case RAW:
				CheckDlgButton(hWndDlg,IDC_RADIO_RAW,TRUE);
				break;
			case ADTS:
				CheckDlgButton(hWndDlg,IDC_RADIO_ADTS,TRUE);
				break;
			}
			
			CheckDlgButton(hWndDlg, IDC_CHK_ALLOWMIDSIDE, cfg.EncCfg.allowMidside);
			CheckDlgButton(hWndDlg, IDC_CHK_USETNS, cfg.EncCfg.useTns);
			CheckDlgButton(hWndDlg, IDC_CHK_USELFE, cfg.EncCfg.useLfe);

			if(cfg.UseQuality)
				CheckDlgButton(hWndDlg,IDC_RADIO_QUALITY,TRUE);
			else
				CheckDlgButton(hWndDlg,IDC_RADIO_BITRATE,TRUE);

			switch(cfg.EncCfg.quantqual)
			{
			case 100:
				SendMessage(GetDlgItem(hWndDlg, IDC_CB_QUALITY), CB_SETCURSEL, 0, 0);
				break;
			default:
				if(cfg.EncCfg.quantqual<10)
					cfg.EncCfg.quantqual=10;
				if(cfg.EncCfg.quantqual>500)
					cfg.EncCfg.quantqual=500;
				sprintf(buf,"%lu",cfg.EncCfg.quantqual);
				SetDlgItemText(hWndDlg, IDC_CB_QUALITY, buf);
				break;
			}
			switch(cfg.EncCfg.bitRate)
			{
			case 0:
				SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_SETCURSEL, 0, 0);
				break;
			default:
				sprintf(buf,"%lu",cfg.EncCfg.bitRate);
				SetDlgItemText(hWndDlg, IDC_CB_BITRATE, buf);
				break;
			}
			switch(cfg.EncCfg.bandWidth)
			{
			case 0:
				SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_SETCURSEL, 0, 0);
				break;
			case 0xffffffff:
				SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_SETCURSEL, 1, 0);
				break;
			default:
				sprintf(buf,"%lu",cfg.EncCfg.bandWidth);
				SetDlgItemText(hWndDlg, IDC_CB_BANDWIDTH, buf);
				break;
			}
			
			CheckDlgButton(hWndDlg, IDC_CHK_WRITEMP4, cfg.SaveMP4);

			CheckDlgButton(hWndDlg,IDC_CHK_AUTOCFG, cfg.AutoCfg);
			DISABLE_CTRLS_ENC(!cfg.AutoCfg);

			CheckDlgButton(hWndDlg,IDC_CHK_TAG, cfg.TagOn);
			ENABLE_TAG(cfg.TagOn);
			ENABLE_AACTAGS(cfg.SaveMP4);
			SetDlgItemText(hWndDlg, IDC_E_ARTIST, cfg.Tag.artist);
			SetDlgItemText(hWndDlg, IDC_E_TITLE, cfg.Tag.title);
			SetDlgItemText(hWndDlg, IDC_E_ALBUM, cfg.Tag.album);
			SetDlgItemText(hWndDlg, IDC_E_YEAR, cfg.Tag.year);
			SetDlgItemText(hWndDlg, IDC_CB_GENRE, cfg.Tag.genre);
			SetDlgItemText(hWndDlg, IDC_E_WRITER, cfg.Tag.writer);
			SetDlgItemText(hWndDlg, IDC_E_COMMENT, cfg.Tag.comment);
			SetDlgItemText(hWndDlg, IDC_E_ARTFILE, cfg.Tag.artFilename);
			SetDlgItemInt(hWndDlg, IDC_E_TRACK, cfg.Tag.trackno, FALSE);
			SetDlgItemInt(hWndDlg, IDC_E_NTRACKS, cfg.Tag.ntracks, FALSE);
			SetDlgItemInt(hWndDlg, IDC_E_DISK, cfg.Tag.discno, FALSE);
			SetDlgItemInt(hWndDlg, IDC_E_NDISKS, cfg.Tag.ndiscs, FALSE);
			SetDlgItemInt(hWndDlg, IDC_E_COMPILATION, cfg.Tag.compilation, FALSE);
			CheckDlgButton(hWndDlg, IDC_CHK_COMPILATION, cfg.Tag.compilation);
		}
		break; // End of WM_INITDIALOG                                 
		
	case WM_CLOSE:
		// Closing the Dialog behaves the same as Cancel               
		PostMessage(hWndDlg, WM_COMMAND, IDCANCEL, 0L);
		break; // End of WM_CLOSE                                      
		
	case WM_COMMAND:
		switch(LOWORD(wParam))
		{
		case IDOK:
			{
//			HANDLE hCfg=(HANDLE)lParam;
			char buf[50];
			CMyEncCfg cfg;

				cfg.AutoCfg=IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG) ? TRUE : FALSE;
				cfg.EncCfg.mpegVersion=IsDlgButtonChecked(hWndDlg,IDC_RADIO_MPEG4) ? MPEG4 : MPEG2;
				if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MAIN))
					cfg.EncCfg.aacObjectType=MAIN;
				if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LOW))
					cfg.EncCfg.aacObjectType=LOW;
				if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_SSR))
					cfg.EncCfg.aacObjectType=SSR;
				if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LTP))
					cfg.EncCfg.aacObjectType=LTP;
				cfg.EncCfg.allowMidside=IsDlgButtonChecked(hWndDlg, IDC_CHK_ALLOWMIDSIDE);
				cfg.EncCfg.useTns=IsDlgButtonChecked(hWndDlg, IDC_CHK_USETNS);
				cfg.EncCfg.useLfe=IsDlgButtonChecked(hWndDlg, IDC_CHK_USELFE);
				
				GetDlgItemText(hWndDlg, IDC_CB_BITRATE, buf, 50);
				switch(*buf)
				{
				case 'A': // Auto
					cfg.EncCfg.bitRate=0;
					break;
				default:
					cfg.EncCfg.bitRate=GetDlgItemInt(hWndDlg, IDC_CB_BITRATE, 0, FALSE);
				}
				GetDlgItemText(hWndDlg, IDC_CB_BANDWIDTH, buf, 50);
				switch(*buf)
				{
				case 'A': // Auto
					cfg.EncCfg.bandWidth=0;
					break;
				case 'F': // Full
					cfg.EncCfg.bandWidth=0xffffffff;
					break;
				default:
					cfg.EncCfg.bandWidth=GetDlgItemInt(hWndDlg, IDC_CB_BANDWIDTH, 0, FALSE);
				}
				cfg.UseQuality=IsDlgButtonChecked(hWndDlg,IDC_RADIO_QUALITY) ? TRUE : FALSE;
				GetDlgItemText(hWndDlg, IDC_CB_QUALITY, buf, 50);
				switch(*buf)
				{
				case 'D': // Default
					cfg.EncCfg.quantqual=100;
					break;
				default:
					cfg.EncCfg.quantqual=GetDlgItemInt(hWndDlg, IDC_CB_QUALITY, 0, FALSE);
				}
				cfg.EncCfg.outputFormat=IsDlgButtonChecked(hWndDlg,IDC_RADIO_RAW) ? RAW : ADTS;
#ifdef IDC_E_BROWSE
				GetDlgItemText(hWndDlg, IDC_E_BROWSE, config_AACoutdir, MAX_PATH);
				FREE_ARRAY(cfg.OutDir);
				cfg.OutDir=strdup(config_AACoutdir);
#endif
				cfg.SaveMP4=IsDlgButtonChecked(hWndDlg, IDC_CHK_WRITEMP4) ? TRUE : FALSE;

				cfg.TagOn=IsDlgButtonChecked(hWndDlg,IDC_CHK_TAG) ? 1 : 0;
			char buffer[MAX_PATH];
				GetDlgItemText(hWndDlg, IDC_E_ARTIST, buffer, MAX_PATH);
				cfg.Tag.artist=strdup(buffer);
				GetDlgItemText(hWndDlg, IDC_E_TITLE, buffer, MAX_PATH);
				cfg.Tag.title=strdup(buffer);
				GetDlgItemText(hWndDlg, IDC_E_ALBUM, buffer, MAX_PATH);
				cfg.Tag.album=strdup(buffer);
				GetDlgItemText(hWndDlg, IDC_E_YEAR, buffer, MAX_PATH);
				cfg.Tag.year=strdup(buffer);
				GetDlgItemText(hWndDlg, IDC_CB_GENRE, buffer, MAX_PATH);
				cfg.Tag.genre=strdup(buffer);
				GetDlgItemText(hWndDlg, IDC_E_WRITER, buffer, MAX_PATH);
				cfg.Tag.writer=strdup(buffer);
				GetDlgItemText(hWndDlg, IDC_E_COMMENT, buffer, MAX_PATH);
				cfg.Tag.comment=strdup(buffer);
				GetDlgItemText(hWndDlg, IDC_E_ARTFILE, buffer, MAX_PATH);
				cfg.Tag.artFilename=strdup(buffer);
				cfg.Tag.trackno=GetDlgItemInt(hWndDlg, IDC_E_TRACK, 0, FALSE);
				cfg.Tag.ntracks=GetDlgItemInt(hWndDlg, IDC_E_NTRACKS, 0, FALSE);
				cfg.Tag.discno=GetDlgItemInt(hWndDlg, IDC_E_DISK, 0, FALSE);
				cfg.Tag.ndiscs=GetDlgItemInt(hWndDlg, IDC_E_NDISKS, 0, FALSE);
				cfg.Tag.compilation=(BYTE)GetDlgItemInt(hWndDlg, IDC_E_COMPILATION, 0, FALSE);
				cfg.Tag.compilation=IsDlgButtonChecked(hWndDlg, IDC_CHK_COMPILATION) ? 1 : 0;

				EndDialog(hWndDlg, TRUE);//(DWORD)hCfg);
			}
			break;
			
        case IDCANCEL:
			// Ignore data values entered into the controls        
			// and dismiss the dialog window returning FALSE
			EndDialog(hWndDlg, FALSE);
			break;

		case IDC_BTN_ABOUT:
			DialogBox((HINSTANCE)hInstance,(LPCSTR)MAKEINTRESOURCE(IDD_ABOUT), (HWND)hWndDlg, (DLGPROC)DialogMsgProcAbout);
			break;

		case IDC_BTN_LICENSE:
			{
			char *license =
				"\nPlease note that the use of this software may require the payment of patent royalties.\n"
				"You need to consider this issue before you start building derivative works.\n"
				"We are not warranting or indemnifying you in any way for patent royalities!\n"
				"YOU ARE SOLELY RESPONSIBLE FOR YOUR OWN ACTIONS!\n"
				"\n"
				"FAAC is based on the ISO MPEG-4 reference code. For this code base the\n"
				"following license applies:\n"
				"\n"
/*				"This software module was originally developed by\n"
				"\n"
				"FirstName LastName (CompanyName)\n"
				"\n"
				"and edited by\n"
				"\n"
				"FirstName LastName (CompanyName)\n"
				"FirstName LastName (CompanyName)\n"
				"\n"
*/				"in the course of development of the MPEG-2 NBC/MPEG-4 Audio standard\n"
				"ISO/IEC 13818-7, 14496-1,2 and 3. This software module is an\n"
				"implementation of a part of one or more MPEG-2 NBC/MPEG-4 Audio tools\n"
				"as specified by the MPEG-2 NBC/MPEG-4 Audio standard. ISO/IEC gives\n"
				"users of the MPEG-2 NBC/MPEG-4 Audio standards free license to this\n"
				"software module or modifications thereof for use in hardware or\n"
				"software products claiming conformance to the MPEG-2 NBC/ MPEG-4 Audio\n"
				"standards. Those intending to use this software module in hardware or\n"
				"software products are advised that this use may infringe existing\n"
				"patents. The original developer of this software module and his/her\n"
				"company, the subsequent editors and their companies, and ISO/IEC have\n"
				"no liability for use of this software module or modifications thereof\n"
				"in an implementation. Copyright is not released for non MPEG-2\n"
				"NBC/MPEG-4 Audio conforming products. The original developer retains\n"
				"full right to use the code for his/her own purpose, assign or donate\n"
				"the code to a third party and to inhibit third party from using the\n"
				"code for non MPEG-2 NBC/MPEG-4 Audio conforming products. This\n"
				"copyright notice must be included in all copies or derivative works.\n"
				"\n"
				"Copyright (c) 1997.\n"
				"\n"
				"For the changes made for the FAAC project the GNU Lesser General Public\n"
				"License (LGPL), version 2 1991 applies:\n"
				"\n"
				"FAAC - Freeware Advanced Audio Coder\n"
				"Copyright (C) 2001-2004 The individual contributors\n"
				"\n"
				"This library is free software; you can redistribute it and/or modify it under the terms of\n"
				"the GNU Lesser General Public License as published by the Free Software Foundation;\n"
				"either version 2.1 of the License, or (at your option) any later version.\n"
				"\n"
				"This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\n"
				"without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
				"See the GNU Lesser General Public License for more details.\n"
				"\n"
				"You should have received a copy of the GNU Lesser General Public\n"
				"License along with this library; if not, write to the Free Software\n"
				"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n";

				MessageBox(hWndDlg,license,"FAAC libray License",MB_OK|MB_ICONINFORMATION);
			}
			break;

#ifdef IDC_BTN_BROWSE
		case IDC_BTN_BROWSE:
			{
			char name[MAX_PATH];
			BROWSEINFO bi;
			ITEMIDLIST *idlist;
				bi.hwndOwner = hWndDlg;
				bi.pidlRoot = 0;
				bi.pszDisplayName = name;
				bi.lpszTitle = "Select a directory for AAC-MPEG4 file output:";
				bi.ulFlags = BIF_RETURNONLYFSDIRS;
				bi.lpfn = BrowseCallbackProc;
				bi.lParam = 0;
				
				GetDlgItemText(hWndDlg, IDC_E_BROWSE, config_AACoutdir, MAX_PATH);
				idlist = SHBrowseForFolder( &bi );
				if(idlist)
				{
					SHGetPathFromIDList( idlist, config_AACoutdir);
					SetDlgItemText(hWndDlg, IDC_E_BROWSE, config_AACoutdir);
				}
			}
			break;
#endif			
		case IDC_BTN_ARTFILE:
			{
			OPENFILENAME ofn;
			char ArtFilename[MAX_PATH]="";

//				GetDlgItemText(hWndDlg, IDC_E_ARTFILE, ArtFilename, MAX_PATH);

				ofn.lStructSize			= sizeof(OPENFILENAME);
				ofn.hwndOwner			= (HWND)hWndDlg;
				ofn.lpstrFilter			= "Cover art files (*.gif,*jpg,*.png)\0*.gif;*.jpg;*.png\0";
				ofn.lpstrCustomFilter	= NULL;
				ofn.nFilterIndex		= 1;
				ofn.lpstrFile			= ArtFilename;
				ofn.nMaxFile			= MAX_PATH; //sizeof ArtFilename;
				ofn.lpstrFileTitle		= NULL;
				ofn.nMaxFileTitle		= 0;
				ofn.lpstrInitialDir		= NULL;
				ofn.lpstrTitle			= "Select cover art file";
				ofn.Flags				= OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ENABLESIZING;
				ofn.lpstrDefExt			= NULL;//"jpg";
				ofn.hInstance			= hInstance;

				if(GetOpenFileName(&ofn))
					SetDlgItemText(hWndDlg, IDC_E_ARTFILE, ArtFilename);
			}
			break;

		case IDC_RADIO_MPEG4:
			EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), !IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG));
			break;
			
		case IDC_RADIO_MPEG2:
			EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), FALSE);
			DISABLE_LTP
			break;

		case IDC_CHK_AUTOCFG:
			{
			char Enabled=!IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG);
				DISABLE_CTRLS_ENC(Enabled);
			}
			break;

		case IDC_CHK_TAG:
			{
			char Enabled=IsDlgButtonChecked(hWndDlg,IDC_CHK_TAG);
				ENABLE_TAG(Enabled);
			}
//			break;
		case IDC_CHK_WRITEMP4:
			{
			char Enabled=IsDlgButtonChecked(hWndDlg,IDC_CHK_WRITEMP4) && IsDlgButtonChecked(hWndDlg,IDC_CHK_TAG);
				ENABLE_AACTAGS(Enabled);
			}
			break;
		}
		break; // End of WM_COMMAND
	default: 
		return FALSE;
	}
	
	return TRUE;
} // End of DIALOGSMsgProc                                      
コード例 #19
0
ファイル: CTag.cpp プロジェクト: VideoTec/video-doc
void CMP4Tag::FreeTag()
{
	FREE_ARRAY(artist);
	FREE_ARRAY(title);
	FREE_ARRAY(album);
	FREE_ARRAY(year);
	FREE_ARRAY(genre);
	FREE_ARRAY(writer);
	FREE_ARRAY(comment);
	FREE_ARRAY(artFilename);
	FREE_ARRAY(art.data);
	FREE_ARRAY(art.description);
	FREE_ARRAY(art.mimeType);
	FREE_ARRAY(art.format);
}