Hi
I'm using Starburn 10.0.0.4128 under Delphi 2010 to burn DVD video files + some proprietary files to a disk. However i am finding that after burning and releasing the burner the files that have been burned are still locked. They remain locked until i restart the application.
This is the method i use for building the UDF file tree:
Code:
procedure TsbBurner.PrepareDVDFilesFileTree(sDiscLabel:string;
sPublisherName:string;
ssVideoTSFiles:TStrings; // Files for VIDEO_TS folder
ssRootFiles:TStrings; // Files for Root folder
sOtherFolder:string; // Name of other folder
ssOtherFolderFiles:TStrings); // Files for Other folder
var
l__ULONG__Status : DWORD;
l__CHAR__ExceptionText : Packed Array[ 1..1024 ] Of Char;
l__EXCEPTION_NUMBER : EXCEPTION_NUMBER;
pVideoTSFolder:pointer;
pAudioTSFolder:pointer;
pOtherFolder:pointer;
l__PVOID__NewNode: Pointer;
sMessage: string;
i: Integer;
FYear, FMonth, FDay: Word;
FHour, FMin, FSec, FMSec: Word;
procedure _AddFile(sFilename:string;pFolder:Pointer;sNameOnDisk:string='');
var
pNameOnDisk: Pointer;
begin
if sNameOnDisk='' then
pNameOnDisk:=nil
else
pNameOnDisk:=Pchar(sNameOnDisk);
l__EXCEPTION_NUMBER :=
StarBurn_UDF_Add(
PCHAR( @l__CHAR__ExceptionText[1] ),
sizeof( l__CHAR__ExceptionText ),
l__ULONG__Status,
Pchar(sFilename),
pNameOnDisk,
pFolder,
l__PVOID__NewNode
);
// Check for success
If l__EXCEPTION_NUMBER <> EN_SUCCESS Then
Begin
sMessage:= Format('%s (%d,%d): %s',
['Failed to add '+sFilename,
Integer(l__EXCEPTION_NUMBER),
l__ULONG__Status,
PAnsiChar(@l__CHAR__ExceptionText[1])]);
Logger.Log(sMessage);
Raise Exception.Create(sMessage);
End;
end;
begin
ShutDownFileTree;
l__ULONG__Status := ERROR_GEN_FAILURE;
ZeroMemory(@l__CHAR__ExceptionText, sizeof( l__CHAR__ExceptionText));
FDVDFilesRootFolder:=nil;
ZeroMemory(@UDFControlBlock, sizeof( UDF_CONTROL_BLOCK));
Logger.Log('Formatting folders...');
// Format root directory
l__EXCEPTION_NUMBER :=
StarBurn_UDF_Add(
PCHAR( @l__CHAR__ExceptionText[1] ),
sizeof( l__CHAR__ExceptionText ),
l__ULONG__Status,
NIL,
NIL,
NIL,
FDVDFilesRootFolder
);
If l__EXCEPTION_NUMBER <> EN_SUCCESS Then
Begin
sMessage:= Format('%s (%d,%d): %s',
['Failed to create Root',
Integer(l__EXCEPTION_NUMBER),
l__ULONG__Status,
PAnsiChar(@l__CHAR__ExceptionText[1])]);
Logger.Log(sMessage);
Raise Exception.Create(sMessage);
End;
// Format VIDEO_TS directory
l__EXCEPTION_NUMBER :=
StarBurn_UDF_Add(
PCHAR( @l__CHAR__ExceptionText[1] ),
sizeof( l__CHAR__ExceptionText ),
l__ULONG__Status,
nil,
'VIDEO_TS',
FDVDFilesRootFolder,
pVideoTSFolder
);
If l__EXCEPTION_NUMBER <> EN_SUCCESS Then
Begin
sMessage:= Format('%s (%d,%d): %s',
['Failed to create VIDEO_TS',
Integer(l__EXCEPTION_NUMBER),
l__ULONG__Status,
PAnsiChar(@l__CHAR__ExceptionText[1])]);
Logger.Log(sMessage);
Raise Exception.Create(sMessage);
End;
// Format AUDIO_TS directory
l__EXCEPTION_NUMBER :=
StarBurn_UDF_Add(
PCHAR( @l__CHAR__ExceptionText[1] ),
sizeof( l__CHAR__ExceptionText ),
l__ULONG__Status,
nil,
'AUDIO_TS',
FDVDFilesRootFolder,
pAudioTSFolder
);
If l__EXCEPTION_NUMBER <> EN_SUCCESS Then
Begin
sMessage:= Format('%s (%d,%d): %s',
['Failed to create AUDIO_TS',
Integer(l__EXCEPTION_NUMBER),
l__ULONG__Status,
PAnsiChar(@l__CHAR__ExceptionText[1])]);
Logger.Log(sMessage);
Raise Exception.Create(sMessage);
End;
// Format OTHER directory
if (ssOtherFolderFiles<>nil) and (ssOtherFolderFiles.count>0) then
begin
if sOtherFolder='' then Raise Exception.Create('Other folder name unspecified');
l__EXCEPTION_NUMBER :=
StarBurn_UDF_Add(
PCHAR( @l__CHAR__ExceptionText[1] ),
sizeof( l__CHAR__ExceptionText ),
l__ULONG__Status,
nil,
pchar(sOtherFolder),
FDVDFilesRootFolder,
pOtherFolder
);
If l__EXCEPTION_NUMBER <> EN_SUCCESS Then
Begin
sMessage:= Format('%s (%d,%d): %s',
['Failed to create '+sOtherFolder,
Integer(l__EXCEPTION_NUMBER),
l__ULONG__Status,
PAnsiChar(@l__CHAR__ExceptionText[1])]);
Logger.Log(sMessage);
Raise Exception.Create(sMessage);
End;
end;
Logger.Log('Formatting files...');
// VIDEO_TS
for i := 0 to ssVideoTSFiles.Count - 1 do
_AddFile(ssVideoTSFiles[i],pVideoTSFolder);
// OTHER_TS
if (ssOtherFolderFiles<>nil) and (ssOtherFolderFiles.count>0) then
for i := 0 to ssOtherFolderFiles.Count - 1 do
_AddFile(ssOtherFolderFiles[i],pOtherFolder);
// Root
if (ssRootFiles<>nil) then
for i := 0 to ssRootFiles.Count - 1 do
_AddFile(ssRootFiles[i],FDVDFilesRootFolder);
//
// Try to create UDF
//
DecodeDate(Date, FYear, FMonth, FDay);
DecodeTime(Now, FHour, FMin, FSec, FMSec);
l__EXCEPTION_NUMBER :=
StarBurn_UDF_CreateEx(
StarBurn_UDF_GetNodeObject(FDVDFilesRootFolder), // This is ROOT
NIL,//@pVideoTSFolder, // This is VIDEO_TS and not ROOT, for VIDEO_TS listing
NIL,//@pAudioTSFolder, // This is AUDIO_TS and not ROOT, for AUDIO_TS listing
@UDFControlBlock,
PCHAR( @l__CHAR__ExceptionText[1] ),
sizeof( l__CHAR__ExceptionText ),
l__ULONG__Status,
PChar(sDiscLabel),
PChar(sPublisherName),
PChar(sPublisherName+' Burning Library'),
FYear, FMonth, FDay,
FHour, FMin, FSec, FMSec
);
FUDFControlBlockCreated := True;
If l__EXCEPTION_NUMBER <> EN_SUCCESS Then
Begin
sMessage:= Format('%s (%d,%d): %s',
['Create UDF failed',
Integer(l__EXCEPTION_NUMBER),
l__ULONG__Status,
PAnsiChar(@l__CHAR__ExceptionText[1])]);
Logger.Log(sMessage);
Raise Exception.Create(sMessage);
End;
end;
Free it as follows:
Code:
procedure TsbBurner.ShutDownFileTree;
begin
// Was file tree allocated
if (ISO9660JolietFileTree <> nil) then
begin
Logger.Log('Destroy: FileTree');
StarBurn_Destroy(ISO9660JolietFileTree);
ISO9660JolietFileTree := nil;
end;
// Destroy UDF
If FUDFControlBlockCreated and (UDFControlBlock.m__PVOID__Body <> nil) Then
begin
Logger.Log('Destroy: UDFControlBlock');
StarBurn_UDF_Destroy(StarBurn_UDF_GetNodeObject(FDVDFilesRootFolder),
@UDFControlBlock);
FDVDFilesRootFolder:= nil;
FUDFControlBlockCreated := False;
end;
end;
As well as performing the usual functions for unlocking and releasing the burner.
Thanks