Changeset 877 for trunk

Show
Ignore:
Timestamp:
05/17/08 21:58:20 (6 months ago)
Author:
astrange
Message:

Handle MKV with really big values in DisplayWidth/Height? better.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/MatroskaImportPrivate.cpp

    r863 r877  
    409409                // some files ignore the spec and treat display width/height as a ratio, not as pixels 
    410410                // so scale the display size to be at least as large as the pixel size here 
     411                // but don't let it be bigger in both dimensions 
    411412                float horizRatio = float(uint32(pxl_width)) / uint32(disp_width); 
    412413                float vertRatio = float(uint32(pxl_height)) / uint32(disp_height); 
     
    419420                        height = FloatToFixed(uint32(disp_height) * horizRatio); 
    420421                } else { 
    421                         width = IntToFixed(uint32(disp_width)); 
    422                         height = IntToFixed(uint32(disp_height)); 
     422                        float dar = uint32(disp_width) / (float)uint32(disp_height); 
     423                        float p_ratio = uint32(pxl_width) / (float)uint32(pxl_height); 
     424                         
     425                        if (dar > p_ratio) { 
     426                                width  = FloatToFixed(uint32(pxl_height) * dar); 
     427                                height = IntToFixed(uint32(pxl_height)); 
     428                        } else { 
     429                                width  = IntToFixed(uint32(pxl_width)); 
     430                                height = FloatToFixed(uint32(pxl_width) / dar); 
     431                        } 
    423432                }                                
    424433        } else if (pxl_width.ValueIsSet() && pxl_height.ValueIsSet()) {