There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
Microsoft.PKS.MediaInfo coding issues
I was looking at the source for the Microsoft.PKS.MediaInfo class and noticed what I think is a few mistakes. Of course, I may be wrong.
1) I'm pretty sure the line of code in the 'RetrieveThumbnail' method that reads:
int bufferSize = (rowLength * Resolution.Height) + VideoHeaderSize;
int bufferSize = (rowLength * Resolution.Height) + BitMapInfoHeaderSize;
Where 'BitMapInfoHeaderSize' can be defined as:
private static readonly int BitMapInfoHeaderSize = Marshal.SizeOf(typeof(WinApiInteropStructs.BitmapInfoHeader));
Because the space required to store the bitmap includes a 'bit map header' and not a 'video header'.
also I think the 'VideoHeaderSize' in the lines below should also be changed to 'BitMapInfoHeaderSize'
if (bd.Stride == rowLength)
Marshal.Copy(buffer, VideoHeaderSize, bd.Scan0, rowLength * Resolution.Height);
IntPtr row = bd.Scan0;
int startIndex = VideoHeaderSize + ((Resolution.Height - 1) * rowLength);
2) Numerous places in the class create instances of the 'new DexterLib.MediaDetClass()' class, but none seems to 'clean up' afterwards. My understanding is that to release resources propery, you need to 'free' each of these instances. For example:
DexterLib.MediaDetClass det = new DexterLib.MediaDetClass();
... do stuff ...
3) In the 'Microsoft.PKS.GfxUtils' class, there are places like 'WriteText' method, 'ConvertBitmapToArgb' method that use the construct 'Graphics g = Graphics.FromImage(..)'. However, 'dispose' is never called on 'g' graphics instance. Maybe the 'using (Graphics
g = Graphics.FromImage(..))' construct could be employed here.