Ok, so I ended up creating 2 versions of this, I hope the attachments aren't 
too big.

The first one is what I mentioned earlier, pretty much a line-for-line 
translation of the original example. The c++-style casts made the (already 
ugly) lines with casts even uglier by the way...

The difference in the second version is that the metadata objects are no longer 
heap-allocated. This is more in line with the concept of RAII, and removes the 
need to keep setting and checking the 'ok' bool, which in the first version 
needs to be done from the moment the metadata[] is created. The only downside 
is that users following this example would need to remember to make sure the 
metadata objects are kept in scope for the duration of encoding. On the other 
hand, they no longer have to remember to delete all the objects at every point 
the program returns.

Bas

Attachment: encode_example_ver1.patch
Description: Binary data

Attachment: main_ver2.cpp
Description: Binary data

Attachment: main_ver1.cpp
Description: Binary data

Attachment: encode_example_ver2.patch
Description: Binary data

_______________________________________________
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev

Reply via email to