aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmedia/llmediaimplquicktime.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llmedia/llmediaimplquicktime.cpp')
-rw-r--r--linden/indra/llmedia/llmediaimplquicktime.cpp35
1 files changed, 19 insertions, 16 deletions
diff --git a/linden/indra/llmedia/llmediaimplquicktime.cpp b/linden/indra/llmedia/llmediaimplquicktime.cpp
index f9a3b05..b126e2f 100644
--- a/linden/indra/llmedia/llmediaimplquicktime.cpp
+++ b/linden/indra/llmedia/llmediaimplquicktime.cpp
@@ -256,17 +256,6 @@ bool LLMediaImplQuickTime::sizeChanged()
256 SetMovieGWorld( mMovieHandle, mGWorldHandle, GetGWorldDevice ( mGWorldHandle ) ); 256 SetMovieGWorld( mMovieHandle, mGWorldHandle, GetGWorldDevice ( mGWorldHandle ) );
257 } 257 }
258 258
259 // flip movie to match the way the client expects textures (sigh!)
260 MatrixRecord transform;
261 SetIdentityMatrix( &transform ); // transforms are additive so start from identify matrix
262 double scaleX = 1.0 / (double)LLMediaManager::textureWidthFromMediaWidth( width );
263 double scaleY = -1.0 / (double)LLMediaManager::textureHeightFromMediaHeight( height );
264 double centerX = width / 2.0;
265 double centerY = height / 2.0;
266 ScaleMatrix( &transform, X2Fix ( scaleX ), X2Fix ( scaleY ), X2Fix ( centerX ), X2Fix ( centerY ) );
267 SetMovieMatrix( mMovieHandle, &transform );
268 std::cout << "LLMEDIA> Flipping stream to match expected OpenGL orientation size=" << width << " x " << height << std::endl;
269
270 // update movie controller 259 // update movie controller
271 if ( mMovieController ) 260 if ( mMovieController )
272 { 261 {
@@ -454,10 +443,14 @@ bool LLMediaImplQuickTime::processState()
454bool LLMediaImplQuickTime::setMovieBoxEnhanced( Rect* rect ) 443bool LLMediaImplQuickTime::setMovieBoxEnhanced( Rect* rect )
455{ 444{
456 // get movie rect 445 // get movie rect
457 GetMovieBox( mMovieHandle, rect ); 446 GetMovieNaturalBoundsRect( mMovieHandle, rect );
458 int width = ( rect->right - rect->left ); 447
459 int height = ( rect->bottom - rect->top ); 448 int natural_width = ( rect->right - rect->left );
449 int natural_height = ( rect->bottom - rect->top );
460 450
451 int width = natural_width;
452 int height = natural_height;
453
461 // if the user has requested a specific size, use it: 454 // if the user has requested a specific size, use it:
462 if ((mMediaRequestedWidth != 0) && (mMediaRequestedHeight != 0)) 455 if ((mMediaRequestedWidth != 0) && (mMediaRequestedHeight != 0))
463 { 456 {
@@ -485,12 +478,22 @@ bool LLMediaImplQuickTime::setMovieBoxEnhanced( Rect* rect )
485 if ( height > mMaxHeight ) 478 if ( height > mMaxHeight )
486 height = mMaxHeight; 479 height = mMaxHeight;
487 480
488 // tell quicktime about new size 481
482 // scale movie to fit rect and invert vertically to match opengl image format
483 MatrixRecord transform;
484 SetIdentityMatrix( &transform ); // transforms are additive so start from identify matrix
485 double scaleX = (double) width / natural_width;
486 double scaleY = -1.0 * (double) height / natural_height;
487 double centerX = width / 2.0;
488 double centerY = height / 2.0;
489 ScaleMatrix( &transform, X2Fix ( scaleX ), X2Fix ( scaleY ), X2Fix ( centerX ), X2Fix ( centerY ) );
490 SetMovieMatrix( mMovieHandle, &transform );
491
492 // return the new rect
489 rect->right = width; 493 rect->right = width;
490 rect->bottom = height; 494 rect->bottom = height;
491 rect->left = 0; 495 rect->left = 0;
492 rect->top = 0; 496 rect->top = 0;
493 SetMovieBox( mMovieHandle, rect );
494 497
495 return true; 498 return true;
496} 499}