Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Retrieving album artwork is not working: (4 Items)
   
Retrieving album artwork is not working  
Hi,

I am using following code and I am not getting MME_EVENT_METADATA_IMAGE event. 

           case MME_EVENT_TRACKCHANGE:  // 2 - A track change occured while playing.
			{
				MM_INFO("Ply status thread received MME_EVENT_TRACKCHANGE event");

				pWorkerPly->m_mmestatus.uiFID         = ((mme_trackchange_t*)&mme_event->data)->fid;
				pWorkerPly->m_mmestatus.fid_requested = ((mme_trackchange_t*)&mme_event->data)->fid_requested;
				pWorkerPly->m_mmestatus.offset        = ((mme_trackchange_t*)&mme_event->data)->offset;

#if 1      // FIXME ****

				// To create a metadata session and reserve	the required system resouces.
				rc = mme_metadata_create_session(pWorkerPly->m_mmestatus.hMME, &pWorkerPly->m_mmestatus.sessionID) ;
				if (-1 == rc) {
					MM_ERROR("Fail to create a new meta-data session.");
				} else {

					const char* groups = "audio/common:image/format";  // "*" or NULL

					// Para-2: Setting the 'metadata_groups' argument to NULL, or the group to "*" instructs the function to return all
 avaialble metadata for the file.
					// Para-3: mdinfo_rid 0 Success: mdinfo_rid is set.	-1 An error occurred (errno is set).
					// Para-4: Setting the 'metadata' argument to NULL for asynchronously.

					// to retrieve the required	metadata for a the currently playing track and place it in the mme_metadata_info_t data
 structure.
					rc = mme_metadata_getinfo_current(pWorkerPly->m_mmestatus.sessionID, groups, &pWorkerPly->m_mmestatus.mdinfo_rid, NULL);
					if (-1 == rc) {
						MM_INFO ("Fail to get metadata information.");
					} else {
						if( 0 != pWorkerPly->m_mmestatus.mdinfo_rid) {
							MM_ERROR("Fail to get metadata info.");
						}
					}

				}  // end-if
#endif
                break;
			}




			case MME_EVENT_METADATA_IMAGE:  // 54 - load an image from metadata is issued via the
											// mme_metadata_image_load() API function call a metadata image request id is returned to the client.
			{
				MM_INFO("Metadata received MME_EVENT_METADATA_IMAGE event");

				//1. If an image is available and required, call mme_metadata_image_load() to load the image into the image cache.
				//2. Call mme_metadata_free_session() to close the metadata session and free the system resources it was using.

				if (pWorkerMetadata->m_mmestatus.sessionID)
				{
					//End a metadata session
					rc = mme_metadata_free_session(pWorkerMetadata->m_mmestatus.sessionID);
				}

				break;
			}

Regards,
Vadivel
Re: Retrieving album artwork is not working  
On 10-06-30 12:25 PM, "Vadivel Palanisamy" <community-noreply@qnx.com>
wrote:
> // Para-4: Setting the 'metadata' argument to NULL for asynchronously.
> 
> // to retrieve the required metadata for a the currently playing track and
> place it in the mme_metadata_info_t data structure.
> rc = mme_metadata_getinfo_current(pWorkerPly->m_mmestatus.sessionID, groups,
> &pWorkerPly->m_mmestatus.mdinfo_rid, NULL);

Hi Vadivel,

As in your comment above, setting metadata to NULL makes the function return
an async event MME_EVENT_METADATA_INFO will be delivered. This event
includes the XML description saying how many images there are, and a
description of each message.

You are not catching that event. You would need to add a new case statement
for MME_EVENT_METADATA_INFO and then parse the XML and then invoke
mme_metadata_load_image(). That would in turn generate the
MME_EVENT_METADATA_IMGAGE you are looking for but not receiving.

BTW, instead of parsing the XML, if you want a shortcut (for testing), you
could instead each time you receive the MME_EVENT_METADATA_INFO just call
mme_metadata_load_image() with an index of 0.

As well, I'd say that adds complexity to use a NULL metadata pointer. You
might want to just get the XML immediately instead of use it in an async
manner.


Regards,
Gilles
Re: Retrieving album artwork is not working  
Hi Gilles,

I have all the switch..case to print the received event.  But none of them got received except 
'MME_EVENT_SHUTDOWN_COMPLETED' . 

Like below code,

switch (mme_event->type)
	    {
		    /// ***** CLASS_METADATA *****
            case MME_EVENT_NONE:  // 0 - Indicates that no 'single' type events are in the clients queue.
			{
				//  MM_INFO("Ply status thread received MME_EVENT_NONE event.");
                break;  // Queue is flushed
			}
			case MME_EVENT_METADATA_INFO: // 53 - mme_event_metadata_info_t
			{
				// mme_event_metadata_info_t . EOK is the data valid.
				MM_INFO("Metadata received MME_EVENT_METADATA_INFO event");


				break;
			}
			case MME_EVENT_METADATA_IMAGE:  // 54 - load an image from metadata is issued via the
											// mme_metadata_image_load() API function call a metadata image request id is returned to the client.
			{
				MM_INFO("Metadata received MME_EVENT_METADATA_IMAGE event");

				//1. If an image is available and required, call mme_metadata_image_load() to load the image into the image cache.
				//2. Call mme_metadata_free_session() to close the metadata session and free the system resources it was using.

				if (pWorkerMetadata->m_mmestatus.sessionID)
				{
					//End a metadata session
					rc = mme_metadata_free_session(pWorkerMetadata->m_mmestatus.sessionID);
				}

				break;
			}
			/// ***** CLASS_GENERAL *****
			case MME_EVENT_USERMSG: // 7 - An MME user event.
			{
				MM_INFO("General - received MME_EVENT_USERMSG event.");
				break;
			}
			case MME_EVENT_SHUTDOWN: // 15 - mme can be requested to shutdown by any client.
			{
				MM_INFO("General - received MME_EVENT_SHUTDOWN event.");
				break;
			}
			case MME_EVENT_SHUTDOWN_COMPLETED: // 16 - The shutdown process is complete.  Playback and sync have stopped.
			{
				MM_INFO("General - received MME_EVENT_SHUTDOWN_COMPLETED event.");

				//  Start a database backup
				qdb_backup(pWorkerMetadata->m_mmestatus.hQDB, QDB_ATTACH_DEFAULT);

				//qdb_Backup
				break;
			}
			case MME_EVENT_BUFFER_TOO_SMALL:  // 55 - A client when the event buffer on the client side is
						// too small to fetch any events from the MME.
			{
				MM_INFO("General - received MME_EVENT_BUFFER_TOO_SMALL event.");
				break;
			}
			case MME_EVENT_DEFAULT_LANGUAGE: // 59 - default language has been set
			{
				MM_INFO("General - received MME_EVENT_DEFAULT_LANGUAGE event.");
				break;
			}
			default:
			{
				printf(" Metadata received unhandled event(%d)\n", mme_event->type);
                break;
			}

		} //end-switch


Regards,
Vadivel
Re: Retrieving album artwork is not working  
On 10-06-30 2:08 PM, "Vadivel Palanisamy" <community-noreply@qnx.com> wrote:
> Hi Gilles,
> 
> I have all the switch..case to print the received event.  But none of them got
> received except 'MME_EVENT_SHUTDOWN_COMPLETED' .

Hi Vadivel,

I think you may have connected synchronously. When I look at the code, it
seems we won't send you the MME_EVENT_METADATA_INFO if you specified O_SYNC
when you called mme_connect(). If you really want a syncrhonous call, you
should pass in a buffer instead of passing NULL when you call
mme_metadata_getinfo_*() API calls.

Regards,
Gilles