Commit b3a46a94 authored by Ziqing Hui's avatar Ziqing Hui Committed by Alexandre Julliard

winegstreamer: Merge video_cinepak into video field.

parent 03f852a6
......@@ -391,7 +391,7 @@ unsigned int wg_format_get_max_size(const struct wg_format *format)
/* Both ffmpeg's encoder and a Cinepak file seen in the wild report
* 24 bpp. ffmpeg sets biSizeImage as below; others may be smaller,
* but as long as every sample fits into our allocator, we're fine. */
return format->u.video_cinepak.width * format->u.video_cinepak.height * 3;
return format->u.video.width * format->u.video.height * 3;
case WG_MAJOR_TYPE_VIDEO_MPEG1:
/* Estimated max size of a compressed video frame.
......@@ -609,11 +609,11 @@ static bool amt_from_wg_format_video_cinepak(AM_MEDIA_TYPE *mt, const struct wg_
mt->pbFormat = (BYTE *)video_format;
memset(video_format, 0, sizeof(*video_format));
if ((frame_time = MulDiv(10000000, format->u.video_cinepak.fps_d, format->u.video_cinepak.fps_n)) != -1)
if ((frame_time = MulDiv(10000000, format->u.video.fps_d, format->u.video.fps_n)) != -1)
video_format->AvgTimePerFrame = frame_time;
video_format->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
video_format->bmiHeader.biWidth = format->u.video_cinepak.width;
video_format->bmiHeader.biHeight = format->u.video_cinepak.height;
video_format->bmiHeader.biWidth = format->u.video.width;
video_format->bmiHeader.biHeight = format->u.video.height;
video_format->bmiHeader.biPlanes = 1;
video_format->bmiHeader.biBitCount = 24;
video_format->bmiHeader.biCompression = mt->subtype.Data1;
......
......@@ -119,9 +119,14 @@ struct wg_format
unsigned char codec_data[64];
} audio;
/* Valid members for different video formats:
*
* Uncompressed(RGB and YUV): width, height, fps_n, fps_d, padding.
* CINEPAK: width, height, fps_n, fps_d. */
struct
{
wg_video_format format;
/* Positive height indicates top-down video; negative height
* indicates bottom-up video. */
int32_t width, height;
......@@ -130,13 +135,6 @@ struct wg_format
} video;
struct
{
uint32_t width;
uint32_t height;
uint32_t fps_n;
uint32_t fps_d;
} video_cinepak;
struct
{
int32_t width, height;
uint32_t fps_n, fps_d;
uint32_t profile;
......
......@@ -287,10 +287,10 @@ static void wg_format_from_caps_video_cinepak(struct wg_format *format, const Gs
}
format->major_type = WG_MAJOR_TYPE_VIDEO_CINEPAK;
format->u.video_cinepak.width = width;
format->u.video_cinepak.height = height;
format->u.video_cinepak.fps_n = fps_n;
format->u.video_cinepak.fps_d = fps_d;
format->u.video.width = width;
format->u.video.height = height;
format->u.video.fps_n = fps_n;
format->u.video.fps_d = fps_d;
}
static void wg_format_from_caps_video_wmv(struct wg_format *format, const GstCaps *caps)
......@@ -622,12 +622,12 @@ static GstCaps *wg_format_to_caps_video_cinepak(const struct wg_format *format)
if (!(caps = gst_caps_new_empty_simple("video/x-cinepak")))
return NULL;
if (format->u.video_cinepak.width)
gst_caps_set_simple(caps, "width", G_TYPE_INT, format->u.video_cinepak.width, NULL);
if (format->u.video_cinepak.height)
gst_caps_set_simple(caps, "height", G_TYPE_INT, format->u.video_cinepak.height, NULL);
if (format->u.video_cinepak.fps_d || format->u.video_cinepak.fps_n)
gst_caps_set_simple(caps, "framerate", GST_TYPE_FRACTION, format->u.video_cinepak.fps_n, format->u.video_cinepak.fps_d, NULL);
if (format->u.video.width)
gst_caps_set_simple(caps, "width", G_TYPE_INT, format->u.video.width, NULL);
if (format->u.video.height)
gst_caps_set_simple(caps, "height", G_TYPE_INT, format->u.video.height, NULL);
if (format->u.video.fps_d || format->u.video.fps_n)
gst_caps_set_simple(caps, "framerate", GST_TYPE_FRACTION, format->u.video.fps_n, format->u.video.fps_d, NULL);
return caps;
}
......@@ -848,7 +848,7 @@ static GstCaps *wg_format_to_caps_video_mpeg1(const struct wg_format *format)
gst_caps_set_simple(caps, "width", G_TYPE_INT, format->u.video_mpeg1.width, NULL);
if (format->u.video_mpeg1.height)
gst_caps_set_simple(caps, "height", G_TYPE_INT, format->u.video_mpeg1.height, NULL);
if (format->u.video_mpeg1.fps_d || format->u.video_cinepak.fps_n)
if (format->u.video_mpeg1.fps_d || format->u.video.fps_n)
gst_caps_set_simple(caps, "framerate", GST_TYPE_FRACTION, format->u.video_mpeg1.fps_n, format->u.video_mpeg1.fps_d, NULL);
return caps;
}
......@@ -916,8 +916,8 @@ bool wg_format_compare(const struct wg_format *a, const struct wg_format *b)
case WG_MAJOR_TYPE_VIDEO_CINEPAK:
/* Do not compare FPS. */
return a->u.video_cinepak.width == b->u.video_cinepak.width
&& a->u.video_cinepak.height == b->u.video_cinepak.height;
return a->u.video.width == b->u.video.width
&& a->u.video.height == b->u.video.height;
case WG_MAJOR_TYPE_VIDEO_WMV:
/* Do not compare FPS. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment