- int i_adj_height = i_width * VOUT_ASPECT_FACTOR /
- p_vout->output.i_aspect;
-
- factor_x = FixDiv( Long2Fix( i_width ),
- Long2Fix( p_vout->output.i_width ) );
- factor_y = FixDiv( Long2Fix( i_adj_height ),
- Long2Fix( p_vout->output.i_height ) );
-
- i_offset_y = (i_height - i_adj_height) / 2;
- }
-
- SetIdentityMatrix( p_vout->p_sys->p_matrix );
-
- ScaleMatrix( p_vout->p_sys->p_matrix,
- factor_x, factor_y,
- Long2Fix(0), Long2Fix(0) );
-
- TranslateMatrix( p_vout->p_sys->p_matrix,
- Long2Fix(i_offset_x),
- Long2Fix(i_offset_y) );
-
-}
-
-/*****************************************************************************
- * QTCreateSequence: create a new sequence
- *****************************************************************************
- * Returns 0 on success, 1 otherwise
- *****************************************************************************/
-static int QTCreateSequence( vout_thread_t *p_vout )
-{
- OSErr err;
- ImageDescriptionPtr p_descr;
-
- HLock( (Handle)p_vout->p_sys->h_img_descr );
- p_descr = *p_vout->p_sys->h_img_descr;
-
- p_descr->idSize = sizeof(ImageDescription);
- p_descr->cType = p_vout->p_sys->i_codec;
- p_descr->version = 1;
- p_descr->revisionLevel = 0;
- p_descr->vendor = 'appl';
- p_descr->width = p_vout->output.i_width;
- p_descr->height = p_vout->output.i_height;
- p_descr->hRes = Long2Fix(72);
- p_descr->vRes = Long2Fix(72);
- p_descr->spatialQuality = codecLosslessQuality;
- p_descr->frameCount = 1;
- p_descr->clutID = -1;
- p_descr->dataSize = 0;
- p_descr->depth = 24;
-
- HUnlock( (Handle)p_vout->p_sys->h_img_descr );
-
- if( ( err = DecompressSequenceBeginS(
- &p_vout->p_sys->i_seq,
- p_vout->p_sys->h_img_descr,
- NULL, 0,
- p_vout->p_sys->p_qdport,
- NULL, NULL,
- p_vout->p_sys->p_matrix,
- 0, NULL,
- codecFlagUseImageBuffer,
- codecLosslessQuality,
- p_vout->p_sys->img_dc ) ) )
- {
- msg_Err( p_vout, "DecompressSequenceBeginS failed: %d", err );
- return( 1 );
- }
-
- return( 0 );
-}
-
-/*****************************************************************************
- * QTDestroySequence: destroy sequence
- *****************************************************************************/
-static void QTDestroySequence( vout_thread_t *p_vout )
-{
- CDSequenceEnd( p_vout->p_sys->i_seq );
-}
-
-/*****************************************************************************
- * QTNewPicture: allocate a picture
- *****************************************************************************
- * Returns 0 on success, 1 otherwise
- *****************************************************************************/
-static int QTNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
-{
- int i_width = p_vout->output.i_width;
- int i_height = p_vout->output.i_height;
-
- /* We know the chroma, allocate a buffer which will be used
- * directly by the decoder */
- p_pic->p_sys = malloc( sizeof( picture_sys_t ) );
-
- if( p_pic->p_sys == NULL )
- {
- return( -1 );
- }
-
- switch( p_vout->output.i_chroma )
- {
- case VLC_FOURCC('I','4','2','0'):
-
- p_pic->p_sys->p_info = (void *)&p_pic->p_sys->pixmap_i420;
- p_pic->p_sys->i_size = sizeof(PlanarPixmapInfoYUV420);
-
- /* Allocate the memory buffer */
- p_pic->p_data = vlc_memalign( &p_pic->p_data_orig,
- 16, i_width * i_height * 3 / 2 );
-
- /* Y buffer */
- p_pic->Y_PIXELS = p_pic->p_data;
- p_pic->p[Y_PLANE].i_lines = i_height;
- p_pic->p[Y_PLANE].i_pitch = i_width;
- p_pic->p[Y_PLANE].i_pixel_pitch = 1;
- p_pic->p[Y_PLANE].i_visible_pitch = i_width;
-
- /* U buffer */
- p_pic->U_PIXELS = p_pic->Y_PIXELS + i_height * i_width;
- p_pic->p[U_PLANE].i_lines = i_height / 2;
- p_pic->p[U_PLANE].i_pitch = i_width / 2;
- p_pic->p[U_PLANE].i_pixel_pitch = 1;
- p_pic->p[U_PLANE].i_visible_pitch = i_width / 2;
-
- /* V buffer */
- p_pic->V_PIXELS = p_pic->U_PIXELS + i_height * i_width / 4;
- p_pic->p[V_PLANE].i_lines = i_height / 2;
- p_pic->p[V_PLANE].i_pitch = i_width / 2;
- p_pic->p[V_PLANE].i_pixel_pitch = 1;
- p_pic->p[V_PLANE].i_visible_pitch = i_width / 2;
-
- /* We allocated 3 planes */
- p_pic->i_planes = 3;
-
-#define P p_pic->p_sys->pixmap_i420
- P.componentInfoY.offset = (void *)p_pic->Y_PIXELS
- - p_pic->p_sys->p_info;
- P.componentInfoCb.offset = (void *)p_pic->U_PIXELS
- - p_pic->p_sys->p_info;
- P.componentInfoCr.offset = (void *)p_pic->V_PIXELS
- - p_pic->p_sys->p_info;
-
- P.componentInfoY.rowBytes = i_width;
- P.componentInfoCb.rowBytes = i_width / 2;
- P.componentInfoCr.rowBytes = i_width / 2;
-#undef P
-
- break;
-
- default:
- /* Unknown chroma, tell the guy to get lost */
- free( p_pic->p_sys );
- msg_Err( p_vout, "never heard of chroma 0x%.8x (%4.4s)",
- p_vout->output.i_chroma, (char*)&p_vout->output.i_chroma );
- p_pic->i_planes = 0;
- return( -1 );
- }
-
- return( 0 );
-}
-
-/*****************************************************************************
- * QTFreePicture: destroy a picture allocated with QTNewPicture
- *****************************************************************************/
-static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
-{
- switch( p_vout->output.i_chroma )
- {
- case VLC_FOURCC('I','4','2','0'):
- free( p_pic->p_data_orig );
- break;