+ sys->unlock = var_InheritAddress(vd, "vmem-unlock");
+ sys->display = var_InheritAddress(vd, "vmem-display");
+ sys->cleanup = var_InheritAddress(vd, "vmem-cleanup");
+ sys->opaque = var_InheritAddress(vd, "vmem-data");
+ sys->pool = NULL;
+
+ /* Define the video format */
+ video_format_t fmt = vd->fmt;
+
+ if (setup != NULL) {
+ char chroma[5];
+
+ memcpy(chroma, &fmt.i_chroma, 4);
+ chroma[4] = '\0';
+ memset(sys->pitches, 0, sizeof(sys->pitches));
+ memset(sys->lines, 0, sizeof(sys->lines));
+
+ sys->count = setup(&sys->opaque, chroma, &fmt.i_width, &fmt.i_height,
+ sys->pitches, sys->lines);
+ if (sys->count == 0) {
+ msg_Err(vd, "video format setup failure (no pictures)");
+ free(sys);
+ return VLC_EGENERIC;
+ }
+ fmt.i_chroma = vlc_fourcc_GetCodecFromString(VIDEO_ES, chroma);
+
+ } else {
+ char *chroma = var_InheritString(vd, "vmem-chroma");
+ fmt.i_chroma = vlc_fourcc_GetCodecFromString(VIDEO_ES, chroma);
+ free(chroma);
+
+ fmt.i_width = var_InheritInteger(vd, "vmem-width");
+ fmt.i_height = var_InheritInteger(vd, "vmem-height");
+ sys->pitches[0] = var_InheritInteger(vd, "vmem-pitch");
+ sys->lines[0] = fmt.i_height;
+ for (size_t i = 1; i < PICTURE_PLANE_MAX; i++)
+ {
+ sys->pitches[i] = sys->pitches[0];
+ sys->lines[i] = sys->lines[0];
+ }
+ sys->count = 1;
+ sys->cleanup = NULL;