AIMP Forum

AIMP for Windows => Дополнения / Addons => Разработка / Development => Topic started by: nomansland on October 01, 2014, 21:21:08

Title: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: nomansland on October 01, 2014, 21:21:08
Code: [Select]
fi->SetValueAsObject(AIMP_FILEINFO_PROPID_LYRICS, str)
the code above return s_ok,but the fileinfo is not updated.why?bug?

fi is IAIMPFileInfo object.and i get the object from player.getinfo function and clone the fileinfo object.
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: Artem on October 02, 2014, 22:17:51
Where information will updated? In current instance of IAIMPFileInfo? Or in playlist / etc?
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: nomansland on October 03, 2014, 18:51:16
the  instanse  of IAimpFileInfo is updated correctly. but  when  view from simple tag editor, the lyrics tag is still old value. is there  a problem of the sdk?
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: Artem on October 05, 2014, 00:04:56
the  instanse  of IAimpFileInfo is updated correctly. but  when  view from simple tag editor, the lyrics tag is still old value. is there  a problem of the sdk?

No, because Tag Editor works with tags of audio file. It will read information about the track from file, not from playlist.
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: nomansland on October 05, 2014, 03:38:12
you mean SetValueAsObject function of IAimpFileInfo instance is not exactly able to set tags of audio file??  if not, is there any method to do this job?
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: Artem on October 05, 2014, 10:20:53
you mean SetValueAsObject function of IAimpFileInfo instance is not exactly able to set tags of audio file??  if not, is there any method to do this job?

Of course no. No way to use built-in tag editor in current API.
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: nomansland on October 05, 2014, 12:05:35
what a pity to hear that. Is there any plan to add tag edit function for the sdk? I am updating a lyrics plugin for aimp3,writing lyrics to tag is wanted extremely.my software homepage is http://www.autolyric.com
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: Artem on October 05, 2014, 13:26:56
what a pity to hear that. Is there any plan to add tag edit function for the sdk? I am updating a lyrics plugin for aimp3,writing lyrics to tag is wanted extremely.my software homepage is http://www.autolyric.com

Ok, I will thinking about that.
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: nomansland on October 07, 2014, 06:45:12
thanks for your quick support.
but when i use aimp3 3.6 beta3 and sdk,the code "aimp3_core_unit_->QueryInterface(IID_IAIMPServiceFileTagEditor, (void**)(&fts))" return E_NOINTERFACE error result.
could you check that? thanks.
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: Artem on October 07, 2014, 08:31:09
Ok, I will check it today
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: Artem on October 07, 2014, 18:54:39
thanks for your quick support.
but when i use aimp3 3.6 beta3 and sdk,the code "aimp3_core_unit_->QueryInterface(IID_IAIMPServiceFileTagEditor, (void**)(&fts))" return E_NOINTERFACE error result.
could you check that? thanks.

Yes, this is my fault. I put wrong guids for the Cpp version of SDK. Please, replace them with following:

Code: [Select]
static const GUID IID_IAIMPFileTag        = {0x41494D50, 0x4669, 0x6C65, 0x54, 0x61, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00};
static const GUID IID_IAIMPFileTagEditor            = {0x41494D50, 0x4669, 0x6C65, 0x54, 0x61, 0x67, 0x45, 0x64, 0x69, 0x74, 0x00};
static const GUID IID_IAIMPServiceFileTagEditor = {0x41494D50, 0x5372, 0x7654, 0x61, 0x67, 0x45, 0x64. 0x69, 0x74, 0x00, 0x00};
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: nomansland on October 07, 2014, 22:22:46
the QueryInterface for IID_IAIMPServiceFileTagEditor works now.
but when i call EditFile or EditTag of IAIMPServiceFileTagEditor instance,runtime error showes up,
part of the error message is :
==============
Module: AIMP.Runtime.dll
Class: EAccessViolation
Message: Access violation at address 00866B05 in module 'AIMP.Runtime.dll'. Read of address 00000003
==============
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: Artem on October 08, 2014, 08:27:41
the QueryInterface for IID_IAIMPServiceFileTagEditor works now.
but when i call EditFile or EditTag of IAIMPServiceFileTagEditor instance,runtime error showes up,
part of the error message is :
==============
Module: AIMP.Runtime.dll
Class: EAccessViolation
Message: Access violation at address 00866B05 in module 'AIMP.Runtime.dll'. Read of address 00000003
==============

What you trying to edit - file or stream?
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: nomansland on October 08, 2014, 13:15:57
what I'm trying to edit is a file which is playing.i pass the file path as parameter to EditFile function.
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: Artem on October 09, 2014, 19:08:44
what I'm trying to edit is a file which is playing.i pass the file path as parameter to EditFile function.

Sorry, I forget to define calling conversion for this methods. Here is corrected code:

Code: [Select]

class IAIMPServiceFileTagEditor: public IUnknown
{
public:
virtual HRESULT WINAPI EditFile(IUnknown *Source, REFIID IID, void **Obj) = 0;
virtual HRESULT WINAPI EditTag(IUnknown *Source, int TagID, REFIID IID, void **Obj) = 0;
};

Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: nomansland on October 10, 2014, 09:48:49
now " fts->EditFile(str, IID_IAIMPFileTagEditor, (void**)&te); " return E_INVALIDARG error result.
str is IAIMPString* object, te is IAIMPFileTagEditor* object.

still something wrong?
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: Artem on October 10, 2014, 21:17:02
Is str file name to the existing file? Can you provide a small example?
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: nomansland on October 10, 2014, 21:58:10
the str File name is certainly an existing File.I get it from FileInfo object,but it's a playing File,is this the problem? my program is big, hard to make a sample.
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: Artem on October 12, 2014, 18:57:12
the str File name is certainly an existing File.I get it from FileInfo object,but it's a playing File,is this the problem? my program is big, hard to make a sample.

Can you send to me your binary of plugin? (you can do it via personal messages, if you want).
Title: Re: SetValueAsObject function problem of new sdk for 3.6 beta2
Post by: nomansland on October 13, 2014, 17:10:07
i doubt that binary of plugin is helpful.below is part of my code:
Code: [Select]
        HRESULT hr = S_OK;
IAIMPFileInfo* fi;
IAIMPString* str;
IAIMPServiceFileTagEditor* fts;
IAIMPFileTagEditor* te;

if (FAILED(pPlugin->aimp3_player->GetInfo(&fi)))
return 0;

if (FAILED(fi->GetValueAsObject(AIMP_FILEINFO_PROPID_FILENAME, IID_IAIMPString,(void**)&str)))
{
fi->Release();
return 0;
}
// AfxMessageBox(str->GetData());
hr = aimp3_core_unit_->QueryInterface(IID_IAIMPServiceFileTagEditor, (void**)(&fts));
if (S_OK != hr)
{
fi->Release();
str->Release();
return 0;
}
//AfxMessageBox(str->GetData());

hr = fts->EditFile(str, IID_IAIMPString, (void**)&te);//error
//hr = fts->EditTag(str, AIMP_FILETAG_ID_ID3v2,IID_IAIMPFileTagEditor, (void**)&te);
//AfxMessageBox(_T("hi"));
if (FAILED(hr)){
fi->Release();
fts->Release();
str->Release();
CString strmsg;
strmsg.Format(_T("queryinterface failed:%x"), hr);//E_NOINTERFACE//E_INVALIDARG
AfxMessageBox(strmsg);
return 0;
}

fi->Release();
str->Release();

if (FAILED(te->GetMixedInfo(&fi))){
te->Release();
fts->Release();
return 0;
}

the code show error msg:queryinterface failed:0x80070057L