Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

IAAFEssenceData->Write() working?

f_bar
2006-06-19
2013-04-29
  • f_bar
    f_bar
    2006-06-19

    Hello.
    I am trying to write in an existing essence through the Write() method. I can properly Read() it, but writing it leads to nothing.
    I'm positionning at the beginning of the stream in both cases. I tried to write then read back immediatly and write then save the file, but only old data got saved in my two tests.

    Can anyone confirm that this method works?

     
    • Tim Bingham
      Tim Bingham
      2006-06-19

      Does your call to Write() succeed ? What status result does it return ? Is the file opened for modify ?

       
    • f_bar
      f_bar
      2006-06-19

      my dumb test code is as follows:

      aafDataBuffer_t buffer = new aafUInt8[8];
      buffer[0]= (aafUInt8)0xff;
      buffer[1]= (aafUInt8)0xff;
      buffer[2]= (aafUInt8)0xff;
      buffer[3]= (aafUInt8)0xff;
      buffer[4]= (aafUInt8)0xff;
      buffer[5]= (aafUInt8)0x00;
      buffer[6]= (aafUInt8)0x00;
      buffer[7]= (aafUInt8)0x00;
      pEssence->SetPosition( 0 );
      aafUInt32 bytesWritten = 8;
      for ( int loop = 0; loop < (720*576)/2; loop++ )
      {
        if (!SUCCEEDED( pEssence->Write( 8, buffer, &bytesWritten ) ) )
          {
            wprintf(L"ERROR in essence writing");
          }
      }

      Based on your request, i did a test on the value and saw that write() returns 0x80000006 (0x80000006 -2147483642 Invalid handle).
      Why is error not detected? I don't know, but if you have any idea, i'll take it.

      File is not modifiable, which ought to be the root of the problem. Opening the file with AAFFileOpenExistingModify() results in an immediate crash so i can't test this option at the moment.
      Anyway, for the test being, a quick and dirty write in the essence directly in the binary file showed that it would not yeld the results i was expecting.

      Well, i feel pretty dumb at the moment. Thanks for your time and patience. 

       
    • Tim Bingham
      Tim Bingham
      2006-06-19

      > Why is error not detected? I don't know,
      > but if you have any idea, i'll take it.

      Try adding a newline to the end of your
      error message, perhaps then you'll see the
      output.