Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

I trying to move an image from the phones' files system to a Trig's VFS. I'm attempting to do this using the IImage object interface in conjunction with IACTORCONTEXT_CreateInterface.

I started from the CircleActor example, but the phone crashes when calling IVFSNODE_SetData().

First off, is it even possible to use a IVfsCacheModel with IImage objects?

If so, does the interface pointer have to point to a validly created image object when IVFSNODE_SetData is called, or can the pointer be null at this point?

Here's my create child function:

static int ImageDownloadActor_CreateChild( IVfsCacheModel* pObj, IVfsCacheContainer* container, VfsPathElement name, IVfsNode** node)
{
ImageDownloadActor* self = OBJECTFROMINTERFACE(ImageDownloadActor,
pObj, IVfsCacheModel);

int error = SUCCESS;
IVfsNode* hsThumb = NULL;
//int index = wstring2int( name, &error );

IVfsStructContainer* myContainer = NULL;

DBGPRINTF("CreateChild 00\0");
DBGPRINTF("Name %S\0", name);
DBGPRINTF("CreateChild Error 00 = %d\0", error);

error = (error == SUCCESS) ? IACTORCONTEXT_CreateStructContainer(
self->m_context,
name,
1,
(IVfsContainer*)container,
0,
&myContainer ) : error;

DBGPRINTF("CreateChild Error 01 = %d\0", error);

error = (error == SUCCESS) ? IACTORCONTEXT_CreateInterface(
self->m_context,
HalfscreenThumb_VFSName,
AEEIID_IMAGE,
(IVfsContainer*)myContainer,
0,
&hsThumb) : error;

DBGPRINTF("CreateChild Error 02 = %d\0", error);

if ( error == SUCCESS )
{
DBGPRINTF("CreateChild 01\0");

error = (error == SUCCESS) ? IVFSSTRUCTCONTAINER_AddChild(
myContainer, hsThumb ) : error;

DBGPRINTF("CreateChild Error 03 = %d\0", error);

error = (error == SUCCESS) ? IVFSNODE_SetData(
hsThumb,
NULL,
AEEIID_IMAGE,
(void*)&self->m_image,
sizeof(IImage*) ) : error;

DBGPRINTF("CreateChild Error 04 = %d\0", error);

*node = (error == SUCCESS) ? (IVfsNode*)myContainer : NULL;
}

if(error != SUCCESS)
{
DBGPRINTF("CreateChild 02\0");
//if something went wrong then clean the container and set the node to null
if(myContainer != NULL)
{
IVFSSTRUCTCONTAINER_Release( myContainer );
}

*node = NULL;
}

if ( hsThumb != NULL )
{
IVFSNODE_Release( hsThumb );
}

DBGPRINTF("CreateChild 03\0");

return error;

Thanks!

Mobilis wrote:First off, is it even possible to use a IVfsCacheModel with IImage objects?Yes it is possible
Mobilis wrote:If so, does the interface pointer have to point to a validly created image object when IVFSNODE_SetData is called, or can the pointer be null at this point? It can be NULL also. If it is NULL, then no image would be shown in trig.
Mobilis wrote: error = (error == SUCCESS) ? IVFSNODE_SetData(
hsThumb,
NULL,
AEEIID_IMAGE,
(void*)&self->m_image,
sizeof(IImage*) ) : error;
Try with (void*)self->m_image, and check.

Mobilis wrote:First off, is it even possible to use a IVfsCacheModel with IImage objects?Yes it is possible
Mobilis wrote:If so, does the interface pointer have to point to a validly created image object when IVFSNODE_SetData is called, or can the pointer be null at this point? It can be NULL also. If it is NULL, then no image would be shown in trig.
Mobilis wrote: error = (error == SUCCESS) ? IVFSNODE_SetData(
hsThumb,
NULL,
AEEIID_IMAGE,
(void*)&self->m_image,
sizeof(IImage*) ) : error;
Try with (void*)self->m_image, and check.

I've viewed all the posts on this subject and I still get crashing.
I've tried accessing the image through a couple different paths:
1.)

static int ImageDownloadActor_CreateChild( IVfsCacheModel* pObj, IVfsCacheContainer* container, VfsPathElement name, IVfsNode** node)
{
ImageDownloadActor* self = OBJECTFROMINTERFACE(ImageDownloadActor, pObj, IVfsCacheModel);
int error = SUCCESS;
if(WSTRCMP(name, HalfscreenThumb) == 0)
{
//ACTORCONTEXT_CREATE_PRIVATE_VTABLE flag value
if(self->m_vfsNodeHalfscreenThumb == NULL)
{
error = (error == SUCCESS) ? IACTORCONTEXT_CreateInterface(
self->m_context,
name,
AEEIID_IMAGE,
(IVfsContainer*)container,
0,
&self->m_vfsNodeHalfscreenThumb) : error;
}
if ( error == SUCCESS && self->m_vfsNodeHalfscreenThumb != NULL)
{
error = (error == SUCCESS) ? IVFSCONTAINER_AddChild( (IVfsContainer*)container, self->m_vfsNodeHalfscreenThumb ) : error;
error = IVFSNODE_SetData(
self->m_vfsNodeHalfscreenThumb,
NULL,
AEEIID_IMAGE,
(void*)self->m_image,
sizeof(IImage*) );
*node = (error == SUCCESS) ? self->m_vfsNodeHalfscreenThumb : NULL;
}
}
if(error != SUCCESS)
{
//if something went wrong then clean the container and set the node to null
*node = NULL;
}
return error;

void HalfscreenThumb_ImageNotify(void *_self,
IImage *pIImage,
AEEImageInfo *pi,
int nErr)
{
ImageDownloadActor* self = (ImageDownloadActor*) _self;
DBGPRINTF("ImageNotify 00\0");
if (SUCCESS != nErr)
{
if(self->m_image != NULL)
{
IIMAGE_Release(self->m_image);
self->m_image = NULL;
}
}
else
{
int error = SUCCESS;
// pIImage is the image that has just finished loading
self->m_image = pIImage;
// Now the image has finished loading, set the notify to reload the page.
if(error == SUCCESS)
{
IVFSNODE_Notify(self->m_vfsNodeHalfscreenThumb);
}
}

2.)

static int ImageDownloadActor_CreateChild( IVfsCacheModel* pObj, IVfsCacheContainer* container, VfsPathElement name, IVfsNode** node)
{
ImageDownloadActor* self = OBJECTFROMINTERFACE(ImageDownloadActor, pObj, IVfsCacheModel);
int error = SUCCESS;
IVfsStructContainer* myContainer = NULL;
error = (error == SUCCESS) ? IACTORCONTEXT_CreateStructContainer(
self->m_context,
name,
1,
(IVfsContainer*)container,
0,
&myContainer ) : error;
if(self->m_vfsNodeHalfscreenThumb == NULL)
{
error = (error == SUCCESS) ? IACTORCONTEXT_CreateInterface(
self->m_context,
name,
AEEIID_IMAGE,
(IVfsContainer*)myContainer,
0,
&self->m_vfsNodeHalfscreenThumb) : error;
}
if ( error == SUCCESS && self->m_vfsNodeHalfscreenThumb != NULL)
{
error = (error == SUCCESS) ? IVFSSTRUCTCONTAINER_AddChild( myContainer, self->m_vfsNodeHalfscreenThumb ) : error;
error = IVFSNODE_SetData(
self->m_vfsNodeHalfscreenThumb,
NULL,
AEEIID_IMAGE,
(void*)self->m_image,
sizeof(IImage*) );
*node = (error == SUCCESS) ? (IVfsNode*)myContainer : NULL;
}

if(error != SUCCESS)
{
//if something went wrong then clean the container and set the node to null
if(myContainer != NULL)
{
IVFSSTRUCTCONTAINER_Release( myContainer );
}
*node = NULL;
}
return error;

void HalfscreenThumb_ImageNotify(void *_self,
IImage *pIImage,
AEEImageInfo *pi,
int nErr)
{
ImageDownloadActor* self = (ImageDownloadActor*) _self;
if (SUCCESS != nErr)
{
if(self->m_image != NULL)
{
IIMAGE_Release(self->m_image);
self->m_image = NULL;
}
}
else
{
int error = SUCCESS;
// pIImage is the image that has just finished loading
self->m_image = pIImage;
// Now the image has finished loading, set the notify to reload the page.
if(error == SUCCESS)
{
IVFSNODE_Notify(self->m_vfsNodeHalfscreenThumb);
}
}

I've viewed all the posts on this subject and I still get crashing.
I've tried accessing the image through a couple different paths:
1.)

static int ImageDownloadActor_CreateChild( IVfsCacheModel* pObj, IVfsCacheContainer* container, VfsPathElement name, IVfsNode** node)
{
ImageDownloadActor* self = OBJECTFROMINTERFACE(ImageDownloadActor, pObj, IVfsCacheModel);
int error = SUCCESS;
if(WSTRCMP(name, HalfscreenThumb) == 0)
{
//ACTORCONTEXT_CREATE_PRIVATE_VTABLE flag value
if(self->m_vfsNodeHalfscreenThumb == NULL)
{
error = (error == SUCCESS) ? IACTORCONTEXT_CreateInterface(
self->m_context,
name,
AEEIID_IMAGE,
(IVfsContainer*)container,
0,
&self->m_vfsNodeHalfscreenThumb) : error;
}
if ( error == SUCCESS && self->m_vfsNodeHalfscreenThumb != NULL)
{
error = (error == SUCCESS) ? IVFSCONTAINER_AddChild( (IVfsContainer*)container, self->m_vfsNodeHalfscreenThumb ) : error;
error = IVFSNODE_SetData(
self->m_vfsNodeHalfscreenThumb,
NULL,
AEEIID_IMAGE,
(void*)self->m_image,
sizeof(IImage*) );
*node = (error == SUCCESS) ? self->m_vfsNodeHalfscreenThumb : NULL;
}
}
if(error != SUCCESS)
{
//if something went wrong then clean the container and set the node to null
*node = NULL;
}
return error;

void HalfscreenThumb_ImageNotify(void *_self,
IImage *pIImage,
AEEImageInfo *pi,
int nErr)
{
ImageDownloadActor* self = (ImageDownloadActor*) _self;
DBGPRINTF("ImageNotify 00\0");
if (SUCCESS != nErr)
{
if(self->m_image != NULL)
{
IIMAGE_Release(self->m_image);
self->m_image = NULL;
}
}
else
{
int error = SUCCESS;
// pIImage is the image that has just finished loading
self->m_image = pIImage;
// Now the image has finished loading, set the notify to reload the page.
if(error == SUCCESS)
{
IVFSNODE_Notify(self->m_vfsNodeHalfscreenThumb);
}
}

2.)

static int ImageDownloadActor_CreateChild( IVfsCacheModel* pObj, IVfsCacheContainer* container, VfsPathElement name, IVfsNode** node)
{
ImageDownloadActor* self = OBJECTFROMINTERFACE(ImageDownloadActor, pObj, IVfsCacheModel);
int error = SUCCESS;
IVfsStructContainer* myContainer = NULL;
error = (error == SUCCESS) ? IACTORCONTEXT_CreateStructContainer(
self->m_context,
name,
1,
(IVfsContainer*)container,
0,
&myContainer ) : error;
if(self->m_vfsNodeHalfscreenThumb == NULL)
{
error = (error == SUCCESS) ? IACTORCONTEXT_CreateInterface(
self->m_context,
name,
AEEIID_IMAGE,
(IVfsContainer*)myContainer,
0,
&self->m_vfsNodeHalfscreenThumb) : error;
}
if ( error == SUCCESS && self->m_vfsNodeHalfscreenThumb != NULL)
{
error = (error == SUCCESS) ? IVFSSTRUCTCONTAINER_AddChild( myContainer, self->m_vfsNodeHalfscreenThumb ) : error;
error = IVFSNODE_SetData(
self->m_vfsNodeHalfscreenThumb,
NULL,
AEEIID_IMAGE,
(void*)self->m_image,
sizeof(IImage*) );
*node = (error == SUCCESS) ? (IVfsNode*)myContainer : NULL;
}

if(error != SUCCESS)
{
//if something went wrong then clean the container and set the node to null
if(myContainer != NULL)
{
IVFSSTRUCTCONTAINER_Release( myContainer );
}
*node = NULL;
}
return error;

void HalfscreenThumb_ImageNotify(void *_self,
IImage *pIImage,
AEEImageInfo *pi,
int nErr)
{
ImageDownloadActor* self = (ImageDownloadActor*) _self;
if (SUCCESS != nErr)
{
if(self->m_image != NULL)
{
IIMAGE_Release(self->m_image);
self->m_image = NULL;
}
}
else
{
int error = SUCCESS;
// pIImage is the image that has just finished loading
self->m_image = pIImage;
// Now the image has finished loading, set the notify to reload the page.
if(error == SUCCESS)
{
IVFSNODE_Notify(self->m_vfsNodeHalfscreenThumb);
}
}

Oceans eleven wrote:Try with (void*)self->m_image, and check.
Im sorry for my previous post :confused: :confused: .. It has to be what you had written (void*)&self->m_image,
Ill look into why it is crashing!!!
Again sorry for the confusion :confused:

Oceans eleven wrote:Try with (void*)self->m_image, and check.
Im sorry for my previous post :confused: :confused: .. It has to be what you had written (void*)&self->m_image,
Ill look into why it is crashing!!!
Again sorry for the confusion :confused:

What is the return value you get for IVFSNODE_SetData()??
I am getting return value of 16(EBADITEM) when I use the same code for setting node data..
Mobilis wrote:error = (error == SUCCESS) ? IVFSNODE_SetData(
hsThumb,
NULL,
AEEIID_IMAGE,
(void*)&self->m_image,
sizeof(IImage*) ) : error;
DBGPRINTF("CreateChild Error 04 = %d\0", error);

What is the return value you get for IVFSNODE_SetData()??
I am getting return value of 16(EBADITEM) when I use the same code for setting node data..
Mobilis wrote:error = (error == SUCCESS) ? IVFSNODE_SetData(
hsThumb,
NULL,
AEEIID_IMAGE,
(void*)&self->m_image,
sizeof(IImage*) ) : error;
DBGPRINTF("CreateChild Error 04 = %d\0", error);

When I attempt to use (void*)&pme->m_pImage the device immediately crashes.
Thus, no debug output can be captured.
I'm developing on a Moto V3A using uiOne 1.1.2 and BREW 3.1.2

When I attempt to use (void*)&pme->m_pImage the device immediately crashes.
Thus, no debug output can be captured.
I'm developing on a Moto V3A using uiOne 1.1.2 and BREW 3.1.2