Logo Search packages:      
Sourcecode: qlix version File versions  Download package

LIBMTP_filesampledata_t * MtpDevice::DefaultJPEGSample (  ) 

This function retreives the default JPEG sample parameters from the device This function assumes that libmtp is initialized

Returns:
a preallocated LIBMTP_filesampledata_t* with sane values it is up to the caller to call LIBMTP_delete_object to free up the memory

Definition at line 886 of file MtpDevice.cpp.

References processErrorStack().

{
  if (!_device)
    return NULL;
  LIBMTP_filesampledata_t* sample;
  int ret = LIBMTP_Get_Representative_Sample_Format(_device, 
                                                    LIBMTP_FILETYPE_JPEG,
                                                    &sample);
  if (ret != 0)
  { 
    processErrorStack();
    return NULL;
  }
  /*
  //device does not support JPEG samples..
  if (ret == 0 && sample == NULL)
  {
    cerr << "Device does not support JPEG (proper) file type, checking for" 
    <<" JPEG 2000 regular" << endl;
    ret = LIBMTP_Get_Representative_Sample_Format(_device, 
                                                         LIBMTP_FILETYPE_JP2,
                                                         &sample);
    if (ret != 0)
    { 
      processErrorStack();
      return NULL;
    }
  }

  //device does not support JPEG 2000 samples..
  if (ret == 0 && sample == NULL)
  {
    cerr << "Device does not support JPEG 2000 regular file type, checking" 
    " for JPEG 2000 extended" << endl;
    ret = LIBMTP_Get_Representative_Sample_Format(_device, 
                                                         LIBMTP_FILETYPE_JPX,
                                                         &sample);
    if (ret != 0)
    { 
      processErrorStack();
      return NULL;
    }
  }
  */

  if(ret !=0)
    cerr << "Problem getting JPEG information from device" << endl;
  else if (ret == 0 && sample == NULL)
    cerr << "Device does not support JPEG filetype" << endl;
  else if (ret == 0 && sample != NULL)
    cerr << "Device supports JPEG filetype" << endl;

  return sample;
}


Generated by  Doxygen 1.6.0   Back to index