언어 설정

Menu
Sites
Language
Bug ImageContentInfo Construct method

Hello

result Construct (const Tizen::Base::String *pContentPath)

This mothod does not work. It has compability issue in sdk 2.0

 

[E_INVALID_ARG] The contentPath should start with /Media or /Storagecard/Media(/opt/usr/media/Camera/20130629_204749.jpg).

So it only works with bada media path and does not work with tizen media path
Has it been solved in sdk 2.1 or upcoming 2.2?

 

The idea is to use the Camera appControl to capture image and then get the image content info for futher editing/moving/deleting..

 

void MyApp::OnAppControlCompleteResponseReceived(
        const AppId &appId, const Tizen::Base::String &operationId,
        const Tizen::App::AppCtrlResult appControlResult,
        const Tizen::Base::Collection::IMap* pResultList) {

    String *pImageSource = (String*) pResultList->GetValue(
                        String(L"path"));

    ImageContentInfo imageContentInfo;
    result r = imageContentInfo.Construct( pImageSource->GetPointer());
    //Here it will fail

}
Edited by: Brock Boland on 17 3월, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

15 댓글
john Smith
Hi, I have used below code snippet AppLog("Enter to ContentInfo "); result r = E_SUCCESS; ImageContentInfo pImagecontInfo; r = pImagecontInfo.Construct(filepath); AppLog(GetErrorMessage(r)); and for filepath i have used FileManager AppControl, its working for me.Kindly check with this.
Hi John Thanks but the code is returning the same error on SDK 2.0.0.. what SDK you are using? using AppControl OnAppControlCompleteResponseReceived String *pImageSource = (String*) pResultList->GetValue( String(L"path")); AppLog("Enter to ContentInfo "); String filePath=""; filePath.Append(*pImageSource); ImageContentInfo pImagecontInfo; r = pImagecontInfo.Construct(filePath); AppLog(GetErrorMessage(r));
Zoltan Puski
Hi Nour, why are you using 2.0? Slowly 2.1 becoming old too :)
Hi Zoltan, My internet connection is slow at the moment.. only 22kb /s download speed so downloading 1.3GB is too much for me Waiting for SDK 2.2 to be released
Hi Zoltan, My internet connection is slow at the moment.. only 22kb /s download speed so downloading 1.3GB is too much for me Waiting for SDK 2.2 to be released
john Smith
Hi, I am using 2.1 SDK. OnAppControlCompleteResponseReceived for (int i=0; iGetCount(); i++) { String* pValue = dynamic_cast(pValueList->GetAt(i)); AppLog("FilePath is %ls",pValue->GetPointer()); ContentInfo(pValue); } // Code for ContentInfo() ContentInfo(const Tizen::Base::String* filepath) { AppLog("Enter to ContentInfo "); result r = E_SUCCESS; ImageContentInfo pImagecontInfo; r = pImagecontInfo.Construct(filepath); AppLog(GetErrorMessage(r)); return r; }
Thanks John I think the bug is in SDK 2.0.0 only. I am waiting for SDK 2.2 to be released
OK took me 3 days to download 2.1 SDK to discover that it is not a bug related to sdk 2.0 !!! I don't know why I was call Construct method with String value and not POINTER to String String * pImageSource = ... ; //Get the path from appcontrol String path = pImageSource->GetPointer(); imageContentInfo.Construct( *pImageSource); //bug imageContentInfo.Construct( ImageSource->GetPointer()); //bug imageContentInfo.Construct( path); //bug imageContentInfo.Construct( pImageSource); //OK no bug Thanks for your help
john Smith
Hi, While you are constructing this method at that time you are passing a pointer ,imageContentInfo.Construct( *pImageSource); But the path which you are getting storing in pointer instance, again you are passing pointer in construct method, it is like double pointer for which it is not working. use only imageContentInfo.Construct( pImageSource);
You are right but this code does not work! String *pImageSource = (String*) pResultList->GetValue( String(L"path")); ImageContentInfo imageContentInfo; r = imageContentInfo.Construct(pImageSource); if (IsFailed(r)) { //OK does not fail } else { String name = imageContentInfo.GetContentName(); AppLog("content name %S", name.GetPointer()); // nothing ... empty string ContentManager contentManager; contentManager.Construct(); //ok does not fail ContentId contentId = imageContentInfo.GetContentId(); r = contentManager.DeleteContent(contentId); if (IsFailed(r)) { //FAILS .. invalid content ID }
john Smith
Hi, You are right, even i am also do this but i am not able to get Name of content. I have used some different code snippet. ContentSearch search; result r = search.Construct(CONTENT_TYPE_IMAGE); if (IsFailed(r)) { AppLog("~~~ Construct error: %s", GetErrorMessage(r)); } // Call SearchN() of ContentSearch as the first page int pageNo = 1; int countPerPage = 5; int totalPage = 0; int totalCount = 0; IList* pContentInfoList = search.SearchN(pageNo, countPerPage, totalPage, totalCount, L"", L"", SORT_ORDER_NONE); if (IsFailed(GetLastResult())) { AppLog("~~~ SearchN error: %s", GetErrorMessage(GetLastResult())); } for(int i = 0; i < pContentInfoList->GetCount(); i++) { ContentSearchResult *pRes = static_cast (pContentInfoList->GetAt(i)); ImageContentInfo *pContInf1 = static_cast(pRes->GetContentInfo()); // ContentInfo *pContInf =pRes->GetContentInfo(); UuId contentid = pContInf1 ->GetContentId(); String str = contentid.ToString(); AppLog("~~~ id: %ls", str.GetPointer()); AppLog("~~~ Name: %ls", pContInf1->GetContentName().GetPointer()); AppLog("~~~ Path: %ls", pContInf1->GetContentPath().GetPointer()); } In OnActionPerformed(), i am able to get the content Id and path name but name i am not getting.
john Smith
hi, Use below code snippet You have to create content first, after that only you can fetch the information String contentPath(Environment::GetMediaPath() + L"Sounds/test.mp3"); AudioContentInfo audioContentInfo; r = audioContentInfo.Construct(&contentPath); if (IsFailed(r)) { AppLog("Fail!!! Exception : %s", GetErrorMessage(r)); } r = audioContentInfo.SetContentName(L"Test Content Name"); if (IsFailed(r)) { AppLog("Fail!!! Exception : %s", GetErrorMessage(r)); } ContentManager contentManager; r = contentManager.Construct(); if (IsFailed(r)) { AppLog("Fail!!! Exception : %s", GetErrorMessage(r)); } ContentId tempId = contentManager.CreateContent(audioContentInfo); r = GetLastResult(); if (IsFailed(r)) { AppLog("Fail!!! Exception : %s", GetErrorMessage(r)); } AudioContentInfo* pContentInfo = (AudioContentInfo*)contentManager.GetContentInfoN(tempId); r = GetLastResult(); if (IsFailed(r)) { AppLog("Fail!!! Exception : %s", GetErrorMessage(r)); } String contentName = pContentInfo->GetContentName(); AppLog("contentName : %ls", contentName.GetPointer()); String mimeType = pContentInfo->GetMimeType(); AppLog("mimeType : %ls", mimeType.GetPointer()); ContentId contentId = pContentInfo->GetContentId(); AppLog("contentId : %ls", contentId.ToString().GetPointer()); String genre = pContentInfo->GetGenre(); AppLog("genre : %ls", genre.GetPointer()); String title = pContentInfo->GetTitle(); AppLog("title : %ls", title.GetPointer());
Yeah if you create content then you can delete it but that might not work on what I want to do I am lazy to create my own Camera user interface using Camera API .. I want to use Camera AppControl to capture images and then move the captured image to the App Folder for processing and delete the original captured image from MyFiles/Camera folder I don't think I am able to create content already created !! I think it will return an error ...
john Smith
Hi Nour, First of all when you have to copy the file from source path to dest path right. For this you need to create a content for this using CreateContent(). But the source path is always application project path, you can't select the path from opt/usr/media/Camera. Its either GetAppRootPath or ExternalStoragePath(). For more information https://developer.tizen.org/help/index.jsp?topic=%2Forg.tizen.native.apireference%2FclassTizen_1_1Content_1_1ContentManager.html The way you are approaching, i think its little bit complex. From content you are fetching the file and copying the file.
Thnaks John for your help. I have implemented the "Search and Delete" method... probably that's the easiest solution