+ p_format->i_chroma = i_chroma;
+ p_format->i_width = p_format->i_visible_width = i_width;
+ p_format->i_height = p_format->i_visible_height = i_height;
+ p_format->i_x_offset = p_format->i_y_offset = 0;
+ p_format->i_aspect = i_aspect;
+
+#if 0
+ /* Assume we have square pixels */
+ if( i_width && i_height )
+ p_format->i_aspect = i_width * VOUT_ASPECT_FACTOR / i_height;
+ else
+ p_format->i_aspect = 0;
+#endif
+
+ switch( i_chroma )
+ {
+ case FOURCC_YUVA:
+ p_format->i_bits_per_pixel = 32;
+ break;
+ case FOURCC_I444:
+ p_format->i_bits_per_pixel = 24;
+ break;
+ case FOURCC_I422:
+ case FOURCC_YUY2:
+ case FOURCC_UYVY:
+ p_format->i_bits_per_pixel = 16;
+ p_format->i_bits_per_pixel = 16;
+ break;
+ case FOURCC_I411:
+ case FOURCC_YV12:
+ case FOURCC_I420:
+ case FOURCC_IYUV:
+ p_format->i_bits_per_pixel = 12;
+ break;
+ case FOURCC_I410:
+ case FOURCC_YVU9:
+ p_format->i_bits_per_pixel = 9;
+ break;
+ case FOURCC_Y211:
+ p_format->i_bits_per_pixel = 8;
+ break;
+ case FOURCC_YUVP:
+ p_format->i_bits_per_pixel = 8;
+ break;
+
+ case FOURCC_RV32:
+ p_format->i_bits_per_pixel = 32;
+ break;
+ case FOURCC_RV24:
+ /* FIXME: Should be 24 here but x11 and our chroma conversion
+ * routines assume 32. */
+#ifdef WIN32
+ p_format->i_bits_per_pixel = 24;
+#else
+ p_format->i_bits_per_pixel = 32;
+#endif
+ break;
+ case FOURCC_RV15:
+ case FOURCC_RV16:
+ p_format->i_bits_per_pixel = 16;
+ break;
+ case FOURCC_RGB2:
+ p_format->i_bits_per_pixel = 8;
+ break;
+ default:
+ p_format->i_bits_per_pixel = 0;
+ break;
+ }
+}
+
+/**
+ * Initialise the picture_t fields given chroma/size.
+ *
+ * This function initializes most of the picture_t fields given a chroma and
+ * size. It makes the assumption that stride == width.
+ * \param p_this The calling object
+ * \param p_pic Pointer to the picture to initialize
+ * \param i_chroma The chroma fourcc to set
+ * \param i_width The width of the picture
+ * \param i_height The height of the picture
+ * \param i_aspect The aspect ratio of the picture
+ */
+void vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic,
+ vlc_fourcc_t i_chroma,
+ int i_width, int i_height, int i_aspect )
+{
+ int i_index, i_width_aligned, i_height_aligned;