"Translation" of the API for Qt

vbimport

#1

hi,
as the Qt “User” (Trolltech Qt 4.12) who I am, I want to “translate” the Nero API for Qt. This means using different Stringclasses etc. In addition to that I want not only to use the nero api but some more apis of "burner"s in a way so that it’s possible that the programmer must not care which API is used, but can “ask” to init and use whichever api works…

Everything works quit fine except one stupid little thing with nero… the burning of audiofiles as audio cd (with and without additional data on the same cd).

I can burn data disc, but it’s not possible to burn audio disc… (in fact I can burn some mp3s as data but I cannot burn those mp3s as audio)

Can anybody please read the following code and tell me whats wrong?

int main ( int f_argc, char **faa_argv )
{
// Qt stuff

// indirect calls; the whole thing results in:
   C_NeroApi p_api;   // is correct

   p_api->init ( ); // == true

// add some files (all existing on the drive and can be locked by nero)
   p_api->Burn ( ); // == false... :-(
}

bool C_NeroApi::Init
{
   NERO_SETTINGS NeroSettings =
   {
    "NeroFiles",// look for DLLs in sub directory
    NULL,
    NULL,
    "Nero.txt",
    { NeroCallback, &mp_neroPointer->m_neroSettings }, //IdleCallback
    { NeroDialog, &mp_neroPointer->m_neroSettings }    // UserDialog
   };

   switch ( NeroInit ( &mp_neroPointer->m_neroSettings, NULL ) )
   // error Messages etc.. .

   NERO_PROGRESS NeroProgress = 
   {          // All these functions are correkt
    ProgressCallback,
    AbortedCallback,
    AddLogLine,
    SetPhaseCallback,
    &mp_neroPointer->m_neroSettings,
    DisableAbortCallback,
    SetMajorPhaseCallback
   };

// This functions does work, the devices are correct
   mp_neroDeviceInfos = NeroGetAvailableDrivesEx ( MEDIA_CD, NULL );

// This functions does work, the device is correct
   mp_deviceInfo = ( NERO_SCSI_DEVICE_INFO* ) ChooseBurnDevice ( f_deviceName );

// This functions does work, the speed is supported by the device
   m_speed = ChooseBurnSpeed ( );
}


const char* AsCString ( const QString &f_string )
{
// "converter" between the diffrent string "types"
// works
}

bool C_NeroApi::Burn ( )
{
   int size = sizeof ( NERO_WRITE_CD ) + ( ml_audioFiles.size ( ) - 1 ) * sizeof ( NERO_AUDIO_TRACK );
   NERO_WRITE_CD *p_writeCD = ( NERO_WRITE_CD * ) malloc ( size );

   if ( p_writeCD == NULL )
      return false;

   memset ( p_writeCD, 0, size );

   p_writeCD->nwcdMediaType = MEDIA_CD;
   p_writeCD->nwcdArtist = AsCString ( m_artist );
   p_writeCD->nwcdTitle = AsCString ( m_cdName );
   p_writeCD->nwcdpCDStamp = NULL;
   p_writeCD->nwcdCDExtra = FALSE;

// This is a CNeroIsoTrack; works
   m_isoTrack.ReallocDVDVideoFiles ( false );

// ml_dataFiles are the entrys for "datadisc" part
// Add the data for the "datadisc part" of the disc... works
   foreach ( QString file, ml_dataFiles )
      mp_neroPointer->m_isoTrack.AddEntry ( file.toStdString ( ) );

   p_writeCD->nwcdIsoTrack = &( mp_neroPointer->m_isoTrack );

// seems to be the problamatic part:
// ml_audioFiles is a list of fullpaths of mp3s

   p_writeCD->nwcdNumTracks = ml_audioFiles.size ( );
   for ( int counter ( 0 ); counter < ml_audioFiles.size ( ); ++counter )
   {
      p_writeCD->nwcdTracks [ counter ].natIndex0ContainsData = false;
      p_writeCD->nwcdTracks [ counter ].natPauseInBlksBeforeThisTrack = 150;
      p_writeCD->nwcdTracks [ counter ].natSourceDataExchg.ndeType = NERO_ET_FILE_MP3;
      p_writeCD->nwcdTracks [ counter ].natSourceDataExchg.ndeData.ndeLongFileName.reserved = 0;
      p_writeCD->nwcdTracks [ counter ].natSourceDataExchg.ndeData.ndeLongFileName.ptr = AsCString ( ml_audioFiles [ counter ] );
   }

   int res = NeroBurn
   (
    mp_neroPointer->mp_deviceHandle,
    NERO_ISO_AUDIO_CD,
    p_writeCD,
    NBF_DETECT_NON_EMPTY_CDRW | NBF_SPEED_IN_KBS | NBF_WRITE | NBF_SPEED_IN_KBS | NBF_CLOSE_SESSION,
    m_speed * mp_neroPointer->mp_deviceInfo->nsdiWriteSpeeds.nsiBaseSpeedKBs,
    &( mp_neroPointer->m_neroProgress )
   );

// res is now NEROAPI_BURN_FAILED and AddLogLine ( ..., NERO_TEXT_STOP, "Init failed ) is called... :-(

// ...
}

Thanks a lot

Elgrimm Esleborn


#2

Forget to append the neroerrorlog:

Windows 2000 5.0
IA32
WinAspi: File 'Wnaspi32.dll': Ver=4.57 (1008), size=48128 bytes, created 23.12.1997 02:23:24 
ahead WinASPI: File 'F:\Programme\Nero\Nero\Wnaspi32.dll': Ver=2.0.1.59, size=160016 bytes, created 29.01.2003 21:37:36 
Nero API version: 5.5.10.56
Using interface version: 6.6.0.14
Installed in: F:\Programme\Nero\Nero\
Application: Phoenix Group\Hoerbie/Nero
Recorder:             <_NEC DVD_RW ND-1300A>    Version: 1.06 - HA 1 TA 0 - 5.5.10.56
 Adapter driver:      <atapi>                   HA 1
 Drive buffer  :      2048kB
 Bus Type      :      default (0) -> ATAPI, detected: ATAPI 

=== Scsi-Device-Map ===
DiskPeripheral       : IC35L080AVVA07-0                 atapi Port 0 ID 0  DMA: On 
CdRomPeripheral      : _NEC DVD_RW ND-1300A             atapi Port 1 ID 0  DMA: On 
CdRomPeripheral      : TOSHIBA DVD-ROM SD-M1612         atapi Port 1 ID 1  DMA: On 
=======================

AutoRun : 1
Excluded drive IDs: 
CmdQueuing     : 1
CmdNotification: 2
WriteBufferSize: 74448896 (0) Byte
ShowDrvBufStat : 0
EraseSpeed     : 0
BUFE           : 0
Physical memory     : 511MB (523760kB)
Free physical memory: 99MB (101640kB)
Memory in use       : 80 %
Uncached PFiles: 0x0
Use Static Write Speed Table: 0
Use Inquiry    : 1
Global Bus Type: default (0)
Check supported media : Enabled (1) 

21.4.2006
NeroAPI
15:06:57	#1 PLUGAUDIOITEM -1 File PlugAudioItem.cpp, Line 1002
	
15:06:57	#2 NEROAPI 2 File NeroAPI.cpp, Line 3450
	Initialization failed
	

Existing drivers:
File 'Drivers\CDR4_2K.SYS': Ver=5.3.2.31, size=58000 bytes, created 18.08.2005 04:11:46 
File 'Drivers\CDRALW2K.SYS': Ver=5.3.2.31, size=23420 bytes, created 18.08.2005 04:11:46 
File 'Drivers\ASPI32.SYS': Ver=4.57 (1008), size=23936 bytes, created 23.12.1997 03:02:46 

Registry Keys:
HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\AllocateCDROMs : 0 (Security Option) 



#3

the problem is now fixed.

I had missed to read that “ndeLongFileName” is not supported by Nero 5.*