2 * Copyright (C) 2007 Haakon Sporsheim <hakon.sporsheim@tandberg.com>
3 * 2008 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
4 * 2009 Knut Inge Hvidsten <knut.inge.hvidsten@tandberg.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #include "ksvideohelpers.h"
26 #include "kshelpers.h"
28 GST_DEBUG_CATEGORY_EXTERN (gst_ks_debug);
29 #define GST_CAT_DEFAULT gst_ks_debug
31 static const GUID MEDIASUBTYPE_FOURCC =
32 { 0x0 /* FourCC here */ , 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xAA, 0x00,
36 extern const GUID MEDIASUBTYPE_I420 =
37 { 0x30323449, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B,
41 typedef struct _KsVideoDeviceEntry KsVideoDeviceEntry;
43 struct _KsVideoDeviceEntry
45 KsDeviceEntry *device;
50 ks_video_device_entry_decide_priority (KsVideoDeviceEntry * videodevice)
54 videodevice->priority = 0;
56 filter_handle = CreateFile (videodevice->device->path,
57 GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
58 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
59 if (ks_is_valid_handle (filter_handle)) {
60 GUID *propsets = NULL;
63 if (ks_object_get_supported_property_sets (filter_handle, &propsets,
67 for (i = 0; i < propsets_len; i++) {
68 if (memcmp (&propsets[i], &PROPSETID_VIDCAP_CAMERACONTROL,
69 sizeof (GUID)) == 0) {
70 videodevice->priority++;
79 CloseHandle (filter_handle);
83 ks_video_device_entry_compare (gconstpointer a, gconstpointer b)
85 const KsVideoDeviceEntry *videodevice_a = a;
86 const KsVideoDeviceEntry *videodevice_b = b;
88 if (videodevice_a->priority > videodevice_b->priority)
90 else if (videodevice_a->priority == videodevice_b->priority)
97 ks_video_device_list_sort_cameras_first (GList * devices)
99 GList *videodevices = NULL, *walk;
102 for (walk = devices; walk != NULL; walk = walk->next) {
103 KsDeviceEntry *device = walk->data;
104 KsVideoDeviceEntry *videodevice;
106 videodevice = g_new (KsVideoDeviceEntry, 1);
107 videodevice->device = device;
108 ks_video_device_entry_decide_priority (videodevice);
110 videodevices = g_list_append (videodevices, videodevice);
113 videodevices = g_list_sort (videodevices, ks_video_device_entry_compare);
115 g_list_free (devices);
118 for (walk = videodevices, i = 0; walk != NULL; walk = walk->next, i++) {
119 KsVideoDeviceEntry *videodevice = walk->data;
121 videodevice->device->index = i;
122 devices = g_list_append (devices, videodevice->device);
124 g_free (videodevice);
127 g_list_free (videodevices);
132 static GstStructure *
133 ks_video_format_to_structure (GUID subtype_guid, GUID format_guid)
135 GstStructure *structure = NULL;
137 if (IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_MJPG) || IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_TVMJ) || /* FIXME: NOT tested */
138 IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_WAKE) || /* FIXME: NOT tested */
139 IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_CFCC) || /* FIXME: NOT tested */
140 IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_IJPG)) { /* FIXME: NOT tested */
141 structure = gst_structure_new ("image/jpeg", NULL);
142 } else if (IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_RGB555) || /* FIXME: NOT tested */
143 IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_RGB565) || /* FIXME: NOT tested */
144 IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_RGB24) || IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_RGB32) || /* FIXME: NOT tested */
145 IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_ARGB1555) || /* FIXME: NOT tested */
146 IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_ARGB32) || /* FIXME: NOT tested */
147 IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_ARGB4444)) { /* FIXME: NOT tested */
148 guint depth = 0, bpp = 0;
150 guint32 r_mask = 0, b_mask = 0, g_mask = 0;
152 if (IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_RGB555)) {
155 endianness = G_BIG_ENDIAN;
159 } else if (IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_RGB565)) {
161 endianness = G_BIG_ENDIAN;
165 } else if (IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_RGB24)) {
167 endianness = G_BIG_ENDIAN;
171 } else if (IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_RGB32)) {
174 endianness = G_BIG_ENDIAN;
179 *r_mask = 0xff000000;
180 *g_mask = 0x00ff0000;
181 *b_mask = 0x0000ff00;
183 } else if (IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_ARGB1555)) {
186 endianness = G_BIG_ENDIAN;
190 } else if (IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_ARGB32)) {
192 endianness = G_BIG_ENDIAN;
197 *r_mask = 0xff000000;
198 *g_mask = 0x00ff0000;
199 *b_mask = 0x0000ff00;
201 } else if (IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_ARGB4444)) {
204 endianness = G_BIG_ENDIAN;
212 g_assert_not_reached ();
215 structure = gst_structure_new ("video/x-raw-rgb",
216 "bpp", G_TYPE_INT, bpp,
217 "depth", G_TYPE_INT, depth,
218 "red_mask", G_TYPE_INT, r_mask,
219 "green_mask", G_TYPE_INT, g_mask,
220 "blue_mask", G_TYPE_INT, b_mask,
221 "endianness", G_TYPE_INT, endianness, NULL);
222 } else if (IsEqualGUID (&subtype_guid, &MEDIASUBTYPE_dvsd)) {
223 if (IsEqualGUID (&format_guid, &FORMAT_DvInfo)) {
224 structure = gst_structure_new ("video/x-dv",
225 "systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
226 } else if (IsEqualGUID (&format_guid, &FORMAT_VideoInfo)) {
227 structure = gst_structure_new ("video/x-dv",
228 "systemstream", G_TYPE_BOOLEAN, FALSE,
229 "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('d', 'v', 's', 'd'),
232 } else if (memcmp (&subtype_guid.Data2, &MEDIASUBTYPE_FOURCC.Data2,
233 sizeof (subtype_guid) - sizeof (subtype_guid.Data1)) == 0) {
234 guint8 *p = (guint8 *) & subtype_guid.Data1;
236 structure = gst_structure_new ("video/x-raw-yuv",
237 "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC (p[0], p[1], p[2], p[3]),
242 GST_DEBUG ("Unknown DirectShow Video GUID %08x-%04x-%04x-%04x-%08x%04x",
243 subtype_guid.Data1, subtype_guid.Data2, subtype_guid.Data3,
244 *(WORD *) subtype_guid.Data4, *(DWORD *) & subtype_guid.Data4[2],
245 *(WORD *) & subtype_guid.Data4[6]);
252 guess_aspect (gint width, gint height, gint * par_width, gint * par_height)
255 * As we dont have access to the actual pixel aspect, we will try to do a
256 * best-effort guess. The guess is based on most sensors being either 4/3
257 * or 16/9, and most pixel aspects being close to 1/1.
259 if ((width == 768) && (height == 448)) { /* special case for w448p */
263 if (((float) width / (float) height) < 1.2778) {
273 /* NOTE: would probably be better to use a continued fractions approach here */
275 compress_fraction (gint64 in_num, gint64 in_den, gint64 * out_num,
278 gdouble on, od, orig;
279 guint denominators[] = { 1, 2, 3, 5, 7 }, i;
280 const gdouble max_loss = 0.1;
286 for (i = 0; i < G_N_ELEMENTS (denominators); i++) {
290 cur_n = floor ((on / (od / (gdouble) denominators[i])) + 0.5);
291 cur_d = denominators[i];
292 cur = (gdouble) cur_n / (gdouble) cur_d;
293 loss = fabs (cur - orig);
295 if (loss <= max_loss) {
308 ks_video_append_video_stream_cfg_fields (GstStructure * structure,
309 const KS_VIDEO_STREAM_CONFIG_CAPS * vscc)
314 g_return_val_if_fail (structure, FALSE);
315 g_return_val_if_fail (vscc, FALSE);
318 if (vscc->MinOutputSize.cx == vscc->MaxOutputSize.cx) {
319 gst_structure_set (structure,
320 "width", G_TYPE_INT, vscc->MaxOutputSize.cx, NULL);
322 gst_structure_set (structure,
323 "width", GST_TYPE_INT_RANGE,
324 vscc->MinOutputSize.cx, vscc->MaxOutputSize.cx, NULL);
328 if (vscc->MinOutputSize.cy == vscc->MaxOutputSize.cy) {
329 gst_structure_set (structure,
330 "height", G_TYPE_INT, vscc->MaxOutputSize.cy, NULL);
332 gst_structure_set (structure,
333 "height", GST_TYPE_INT_RANGE,
334 vscc->MinOutputSize.cy, vscc->MaxOutputSize.cy, NULL);
338 compress_fraction (NANOSECONDS, vscc->MaxFrameInterval, &max_n, &max_d);
340 if (vscc->MinFrameInterval == vscc->MaxFrameInterval) {
341 g_value_init (&val, GST_TYPE_FRACTION);
342 gst_value_set_fraction (&val, max_n, max_d);
346 compress_fraction (NANOSECONDS, vscc->MinFrameInterval, &min_n, &min_d);
348 g_value_init (&val, GST_TYPE_FRACTION_RANGE);
349 gst_value_set_fraction_range_full (&val, max_n, max_d, min_n, min_d);
352 gst_structure_set_value (structure, "framerate", &val);
353 g_value_unset (&val);
356 gint par_width, par_height;
358 guess_aspect (vscc->MaxOutputSize.cx, vscc->MaxOutputSize.cy,
359 &par_width, &par_height);
361 gst_structure_set (structure,
362 "pixel-aspect-ratio", GST_TYPE_FRACTION, par_width, par_height, NULL);
369 ks_video_media_type_dup (KsVideoMediaType * media_type)
371 KsVideoMediaType *result = g_new (KsVideoMediaType, 1);
373 memcpy (result, media_type, sizeof (KsVideoMediaType));
375 result->range = g_malloc (media_type->range->FormatSize);
376 memcpy ((gpointer) result->range, media_type->range,
377 media_type->range->FormatSize);
379 result->format = g_malloc (media_type->format_size);
380 memcpy (result->format, media_type->format, media_type->format_size);
382 result->translated_caps = gst_caps_ref (media_type->translated_caps);
388 ks_video_media_type_free (KsVideoMediaType * media_type)
390 if (media_type == NULL)
393 g_free ((gpointer) media_type->range);
395 g_free (media_type->format);
397 if (media_type->translated_caps != NULL)
398 gst_caps_unref (media_type->translated_caps);
404 ks_video_media_type_list_remove_duplicates (GList * media_types)
406 GList *master, *duplicates;
411 master = duplicates = NULL;
413 /* Find the first set of duplicates and their master */
414 for (entry = media_types; entry != NULL && duplicates == NULL;
415 entry = entry->next) {
416 KsVideoMediaType *mt = entry->data;
419 for (other_entry = media_types; other_entry != NULL;
420 other_entry = other_entry->next) {
421 KsVideoMediaType *other_mt = other_entry->data;
426 if (gst_caps_is_equal (mt->translated_caps, other_mt->translated_caps))
427 duplicates = g_list_prepend (duplicates, other_mt);
430 if (duplicates != NULL)
434 if (duplicates != NULL) {
435 KsVideoMediaType *selected_mt = master->data;
438 * Pick a FORMAT_VideoInfo2 if present, if not we just stay with the
441 for (entry = duplicates; entry != NULL; entry = entry->next) {
442 KsVideoMediaType *mt = entry->data;
444 if (IsEqualGUID (&mt->range->Specifier, &FORMAT_VideoInfo2)) {
445 ks_video_media_type_free (selected_mt);
448 ks_video_media_type_free (mt);
451 /* Remove the dupe from the main list */
452 media_types = g_list_remove (media_types, mt);
455 /* Update master node with the selected MediaType */
456 master->data = selected_mt;
458 g_list_free (duplicates);
461 while (master != NULL);
467 ks_video_probe_filter_for_caps (HANDLE filter_handle)
473 if (!ks_filter_get_pin_property (filter_handle, 0, KSPROPSETID_Pin,
474 KSPROPERTY_PIN_CTYPES, &pin_count, sizeof (pin_count), NULL))
477 GST_DEBUG ("pin_count = %d", pin_count);
479 for (pin_id = 0; pin_id < pin_count; pin_id++) {
480 KSPIN_COMMUNICATION pin_comm;
481 KSPIN_DATAFLOW pin_flow;
484 if (!ks_filter_get_pin_property (filter_handle, pin_id, KSPROPSETID_Pin,
485 KSPROPERTY_PIN_COMMUNICATION, &pin_comm, sizeof (pin_comm), NULL))
488 if (!ks_filter_get_pin_property (filter_handle, pin_id, KSPROPSETID_Pin,
489 KSPROPERTY_PIN_DATAFLOW, &pin_flow, sizeof (pin_flow), NULL))
492 if (!ks_filter_get_pin_property (filter_handle, pin_id, KSPROPSETID_Pin,
493 KSPROPERTY_PIN_CATEGORY, &pin_cat, sizeof (pin_cat), NULL))
496 GST_DEBUG ("pin[%u]: pin_comm=%d, pin_flow=%d", pin_id, pin_comm, pin_flow);
498 if (pin_flow == KSPIN_DATAFLOW_OUT &&
499 memcmp (&pin_cat, &PINNAME_CAPTURE, sizeof (GUID)) == 0) {
500 KSMULTIPLE_ITEM *items;
502 if (ks_filter_get_pin_property_multi (filter_handle, pin_id,
503 KSPROPSETID_Pin, KSPROPERTY_PIN_DATARANGES, &items, NULL)) {
504 KSDATARANGE *range = (KSDATARANGE *) (items + 1);
507 for (i = 0; i < items->Count; i++) {
508 if (IsEqualGUID (&range->MajorFormat, &KSDATAFORMAT_TYPE_VIDEO)) {
509 KsVideoMediaType *entry;
510 gpointer src_vscc, src_format;
511 GstStructure *media_structure;
513 entry = g_new0 (KsVideoMediaType, 1);
514 entry->pin_id = pin_id;
516 entry->range = g_malloc (range->FormatSize);
517 memcpy ((gpointer) entry->range, range, range->FormatSize);
519 if (IsEqualGUID (&range->Specifier, &FORMAT_VideoInfo)) {
520 KS_DATARANGE_VIDEO *vr = (KS_DATARANGE_VIDEO *) entry->range;
522 src_vscc = &vr->ConfigCaps;
523 src_format = &vr->VideoInfoHeader;
525 entry->format_size = sizeof (vr->VideoInfoHeader);
526 entry->sample_size = vr->VideoInfoHeader.bmiHeader.biSizeImage;
527 } else if (IsEqualGUID (&range->Specifier, &FORMAT_VideoInfo2)) {
528 KS_DATARANGE_VIDEO2 *vr = (KS_DATARANGE_VIDEO2 *) entry->range;
530 src_vscc = &vr->ConfigCaps;
531 src_format = &vr->VideoInfoHeader;
533 entry->format_size = sizeof (vr->VideoInfoHeader);
534 entry->sample_size = vr->VideoInfoHeader.bmiHeader.biSizeImage;
535 } else if (IsEqualGUID (&range->Specifier, &FORMAT_MPEGVideo)) {
536 /* Untested and probably wrong... */
537 KS_DATARANGE_MPEG1_VIDEO *vr =
538 (KS_DATARANGE_MPEG1_VIDEO *) entry->range;
540 src_vscc = &vr->ConfigCaps;
541 src_format = &vr->VideoInfoHeader;
543 entry->format_size = sizeof (vr->VideoInfoHeader);
545 vr->VideoInfoHeader.hdr.bmiHeader.biSizeImage;
546 } else if (IsEqualGUID (&range->Specifier, &FORMAT_MPEG2Video)) {
547 /* Untested and probably wrong... */
548 KS_DATARANGE_MPEG2_VIDEO *vr =
549 (KS_DATARANGE_MPEG2_VIDEO *) entry->range;
551 src_vscc = &vr->ConfigCaps;
552 src_format = &vr->VideoInfoHeader;
554 entry->format_size = sizeof (vr->VideoInfoHeader);
556 vr->VideoInfoHeader.hdr.bmiHeader.biSizeImage;
560 guid_str = ks_guid_to_string (&range->Specifier);
561 GST_DEBUG ("pin[%u]: ignoring unknown specifier GUID %s",
565 ks_video_media_type_free (entry);
570 g_assert (entry->sample_size != 0);
572 memcpy ((gpointer) & entry->vscc, src_vscc, sizeof (entry->vscc));
574 entry->format = g_malloc (entry->format_size);
575 memcpy (entry->format, src_format, entry->format_size);
578 ks_video_format_to_structure (range->SubFormat,
581 if (media_structure == NULL) {
582 g_warning ("ks_video_format_to_structure returned NULL");
583 ks_video_media_type_free (entry);
585 } else if (ks_video_append_video_stream_cfg_fields
586 (media_structure, &entry->vscc)) {
587 entry->translated_caps = gst_caps_new_empty ();
588 gst_caps_append_structure (entry->translated_caps,
591 gst_structure_free (media_structure);
592 ks_video_media_type_free (entry);
597 ret = g_list_prepend (ret, entry);
601 /* REVISIT: Each KSDATARANGE should start on a 64-bit boundary */
602 range = (KSDATARANGE *) (((guchar *) range) + range->FormatSize);
611 ret = g_list_reverse (ret);
612 ret = ks_video_media_type_list_remove_duplicates (ret);
620 ks_video_create_pin_conn_from_media_type (KsVideoMediaType * media_type)
622 KSPIN_CONNECT *conn = NULL;
623 KSDATAFORMAT *format = NULL;
626 conn = g_malloc0 (sizeof (KSPIN_CONNECT) + sizeof (KSDATAFORMAT) +
627 media_type->format_size);
629 conn->Interface.Set = KSINTERFACESETID_Standard;
630 conn->Interface.Id = KSINTERFACE_STANDARD_STREAMING;
631 conn->Interface.Flags = 0;
633 conn->Medium.Set = KSMEDIUMSETID_Standard;
634 conn->Medium.Id = KSMEDIUM_TYPE_ANYINSTANCE;
635 conn->Medium.Flags = 0;
637 conn->PinId = media_type->pin_id;
638 conn->PinToHandle = NULL;
639 conn->Priority.PriorityClass = KSPRIORITY_NORMAL;
640 conn->Priority.PrioritySubClass = KSPRIORITY_NORMAL;
642 format = (KSDATAFORMAT *) (conn + 1);
643 memcpy (format, media_type->range, sizeof (KSDATAFORMAT));
644 format->FormatSize = sizeof (KSDATAFORMAT) + media_type->format_size;
646 vih = (guint8 *) (format + 1);
647 memcpy (vih, media_type->format, media_type->format_size);
653 ks_video_fixate_media_type (const KSDATARANGE * range,
654 guint8 * format, gint width, gint height, gint fps_n, gint fps_d)
656 KS_DATARANGE_VIDEO *vr;
657 KS_VIDEOINFOHEADER *vih;
658 KS_BITMAPINFOHEADER *bih;
661 g_return_val_if_fail (format != NULL, FALSE);
663 if (IsEqualGUID (&range->Specifier, &FORMAT_VideoInfo)) {
664 bih = &((KS_VIDEOINFOHEADER *) format)->bmiHeader;
665 } else if (IsEqualGUID (&range->Specifier, &FORMAT_VideoInfo2)) {
666 bih = &((KS_VIDEOINFOHEADER2 *) format)->bmiHeader;
667 } else if (IsEqualGUID (&range->Specifier, &FORMAT_MPEGVideo)) {
668 bih = &((KS_MPEG1VIDEOINFO *) format)->hdr.bmiHeader;
669 } else if (IsEqualGUID (&range->Specifier, &FORMAT_MPEG2Video)) {
670 bih = &((KS_MPEGVIDEOINFO2 *) format)->hdr.bmiHeader;
675 /* These formats' structures share the most basic stuff */
676 vr = (KS_DATARANGE_VIDEO *) range;
677 vih = (KS_VIDEOINFOHEADER *) format;
679 /* FIXME: Need to figure out how to properly handle ranges */
680 if (bih->biWidth != width || bih->biHeight != height)
683 /* Framerate, clamped because of fraction conversion rounding errors */
684 vih->AvgTimePerFrame =
685 gst_util_uint64_scale_int_round (NANOSECONDS, fps_d, fps_n);
686 vih->AvgTimePerFrame =
687 MAX (vih->AvgTimePerFrame, vr->ConfigCaps.MinFrameInterval);
688 vih->AvgTimePerFrame =
689 MIN (vih->AvgTimePerFrame, vr->ConfigCaps.MaxFrameInterval);
691 /* Bitrate, clamped for the same reason as framerate */
692 dwRate = (width * height * fps_n) / fps_d;
693 vih->dwBitRate = dwRate * bih->biBitCount;
694 vih->dwBitRate = MAX (vih->dwBitRate, vr->ConfigCaps.MinBitsPerSecond);
695 vih->dwBitRate = MIN (vih->dwBitRate, vr->ConfigCaps.MaxBitsPerSecond);
700 static GstStructure *
701 ks_video_append_var_video_fields (GstStructure * structure)
704 gst_structure_set (structure,
705 "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
706 "height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
707 "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
714 ks_video_get_all_caps (void)
716 static GstCaps *caps = NULL;
719 GstStructure *structure;
720 caps = gst_caps_new_empty ();
722 /* from Windows SDK 6.0 uuids.h */
725 ks_video_append_var_video_fields (ks_video_format_to_structure
726 (MEDIASUBTYPE_RGB555, FORMAT_VideoInfo));
727 gst_caps_append_structure (caps, structure);
730 ks_video_append_var_video_fields (ks_video_format_to_structure
731 (MEDIASUBTYPE_RGB565, FORMAT_VideoInfo));
732 gst_caps_append_structure (caps, structure);
735 ks_video_append_var_video_fields (ks_video_format_to_structure
736 (MEDIASUBTYPE_RGB24, FORMAT_VideoInfo));
737 gst_caps_append_structure (caps, structure);
740 ks_video_append_var_video_fields (ks_video_format_to_structure
741 (MEDIASUBTYPE_RGB32, FORMAT_VideoInfo));
742 gst_caps_append_structure (caps, structure);
746 ks_video_append_var_video_fields (gst_structure_new ("video/x-raw-yuv",
748 gst_caps_append_structure (caps, structure);
752 ks_video_append_var_video_fields (ks_video_format_to_structure
753 (MEDIASUBTYPE_MJPG, FORMAT_VideoInfo));
754 gst_caps_append_structure (caps, structure);
757 ks_video_append_var_video_fields (ks_video_format_to_structure
758 (MEDIASUBTYPE_dvsd, FORMAT_VideoInfo));
759 gst_caps_append_structure (caps, structure);
761 structure = /* no variable video fields (width, height, framerate) */
762 ks_video_format_to_structure (MEDIASUBTYPE_dvsd, FORMAT_DvInfo);
763 gst_caps_append_structure (caps, structure);