mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
ksvideosrc: fix support for DV devices
This commit is contained in:
parent
7bc0fa5d70
commit
83a54e07fd
3 changed files with 39 additions and 11 deletions
|
@ -752,14 +752,12 @@ gst_ks_video_device_set_caps (GstKsVideoDevice * self, GstCaps * caps)
|
|||
if (!gst_structure_get_int (s, "width", &width) ||
|
||||
!gst_structure_get_int (s, "height", &height) ||
|
||||
!gst_structure_get_fraction (s, "framerate", &fps_n, &fps_d)) {
|
||||
GST_ERROR ("Failed to get width/height/fps");
|
||||
goto error;
|
||||
} else {
|
||||
if (!ks_video_fixate_media_type (media_type->range,
|
||||
media_type->format, width, height, fps_n, fps_d))
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!ks_video_fixate_media_type (media_type->range,
|
||||
media_type->format, width, height, fps_n, fps_d))
|
||||
goto error;
|
||||
|
||||
if (priv->cur_media_type != NULL) {
|
||||
if (media_type->format_size == priv->cur_media_type->format_size &&
|
||||
memcmp (media_type->format, priv->cur_media_type->format,
|
||||
|
|
|
@ -446,7 +446,8 @@ ks_video_probe_filter_for_caps (HANDLE filter_handle)
|
|||
guint i;
|
||||
|
||||
for (i = 0; i < items->Count; i++) {
|
||||
if (IsEqualGUID (&range->MajorFormat, &KSDATAFORMAT_TYPE_VIDEO)) {
|
||||
if (IsEqualGUID (&range->MajorFormat, &MEDIATYPE_Video)
|
||||
|| IsEqualGUID (&range->MajorFormat, &MEDIATYPE_Interleaved)) {
|
||||
KsVideoMediaType *entry;
|
||||
gpointer src_vscc, src_format;
|
||||
GstStructure *media_structure;
|
||||
|
@ -485,16 +486,22 @@ ks_video_probe_filter_for_caps (HANDLE filter_handle)
|
|||
entry->sample_size =
|
||||
vr->VideoInfoHeader.hdr.bmiHeader.biSizeImage;
|
||||
} else if (IsEqualGUID (&range->Specifier, &FORMAT_MPEG2Video)) {
|
||||
/* Untested and probably wrong... */
|
||||
KS_DATARANGE_MPEG2_VIDEO *vr =
|
||||
(KS_DATARANGE_MPEG2_VIDEO *) entry->range;
|
||||
|
||||
src_vscc = &vr->ConfigCaps;
|
||||
src_format = &vr->VideoInfoHeader;
|
||||
|
||||
entry->format_size = sizeof (vr->VideoInfoHeader);
|
||||
entry->sample_size =
|
||||
vr->VideoInfoHeader.hdr.bmiHeader.biSizeImage;
|
||||
} else if (IsEqualGUID (&range->Specifier, &FORMAT_DvInfo)) {
|
||||
KS_DATARANGE_DVVIDEO *vr = (KS_DATARANGE_DVVIDEO *) entry->range;
|
||||
|
||||
src_vscc = NULL;
|
||||
src_format = &vr->DVVideoInfo;
|
||||
|
||||
entry->format_size = sizeof (vr->DVVideoInfo);
|
||||
entry->sample_size = vr->DataRange.SampleSize;
|
||||
} else {
|
||||
gchar *guid_str;
|
||||
|
||||
|
@ -510,19 +517,26 @@ ks_video_probe_filter_for_caps (HANDLE filter_handle)
|
|||
if (entry != NULL) {
|
||||
g_assert (entry->sample_size != 0);
|
||||
|
||||
memcpy ((gpointer) & entry->vscc, src_vscc, sizeof (entry->vscc));
|
||||
if (src_vscc != NULL) {
|
||||
memcpy ((gpointer) & entry->vscc, src_vscc,
|
||||
sizeof (entry->vscc));
|
||||
}
|
||||
|
||||
entry->format = g_malloc (entry->format_size);
|
||||
memcpy (entry->format, src_format, entry->format_size);
|
||||
|
||||
media_structure =
|
||||
ks_video_format_to_structure (range->SubFormat,
|
||||
range->MajorFormat);
|
||||
range->Specifier);
|
||||
|
||||
if (media_structure == NULL) {
|
||||
g_warning ("ks_video_format_to_structure returned NULL");
|
||||
ks_video_media_type_free (entry);
|
||||
entry = NULL;
|
||||
} else if (src_vscc == NULL) {
|
||||
entry->translated_caps = gst_caps_new_empty ();
|
||||
gst_caps_append_structure (entry->translated_caps,
|
||||
media_structure);
|
||||
} else if (ks_video_append_video_stream_cfg_fields
|
||||
(media_structure, &entry->vscc)) {
|
||||
entry->translated_caps = gst_caps_new_empty ();
|
||||
|
|
|
@ -51,6 +51,22 @@ struct _KsVideoMediaType
|
|||
GstCaps * translated_caps;
|
||||
};
|
||||
|
||||
typedef struct DVINFO {
|
||||
DWORD dwDVAAuxSrc;
|
||||
DWORD dwDVAAuxCtl;
|
||||
DWORD dwDVAAuxSrc1;
|
||||
DWORD dwDVAAuxCtl1;
|
||||
DWORD dwDVVAuxSrc;
|
||||
DWORD dwDVVAuxCtl;
|
||||
DWORD dwDVReserved[2];
|
||||
} DVINFO;
|
||||
|
||||
typedef struct KS_DATARANGE_DVVIDEO {
|
||||
KSDATARANGE DataRange;
|
||||
DVINFO DVVideoInfo;
|
||||
} KS_DATARANGE_DVVIDEO,*PKS_DATARANGE_DVVIDEO;
|
||||
|
||||
|
||||
GList * ks_video_device_list_sort_cameras_first (GList * devices);
|
||||
|
||||
KsVideoMediaType * ks_video_media_type_dup (KsVideoMediaType * media_type);
|
||||
|
|
Loading…
Reference in a new issue