mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-26 17:18:15 +00:00
Add support for libdc1394 2.0.0 and above and require this version now. Fixes bug #514964.
Original commit message from CVS: Patch by: Daniel Fischer <dan at f3c dot com> * configure.ac: * ext/dc1394/gstdc1394.c: (gst_dc1394_change_state), (gst_dc1394_get_cam_caps), (gst_dc1394_open_cam_with_best_caps): * ext/dc1394/gstdc1394.h: Add support for libdc1394 2.0.0 and above and require this version now. Fixes bug #514964.
This commit is contained in:
parent
72f07c778e
commit
5a0a89a8a0
4 changed files with 59 additions and 51 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2008-02-26 Sebastian Dröge <slomo@circular-chaos.org>
|
||||
|
||||
Patch by: Daniel Fischer <dan at f3c dot com>
|
||||
|
||||
* configure.ac:
|
||||
* ext/dc1394/gstdc1394.c: (gst_dc1394_change_state),
|
||||
(gst_dc1394_get_cam_caps), (gst_dc1394_open_cam_with_best_caps):
|
||||
* ext/dc1394/gstdc1394.h:
|
||||
Add support for libdc1394 2.0.0 and above and require this version
|
||||
now. Fixes bug #514964.
|
||||
|
||||
2008-02-26 Sebastian Dröge <slomo@circular-chaos.org>
|
||||
|
||||
Patch by: Wouter Cloetens <wouter at mind dot be>
|
||||
|
|
|
@ -361,7 +361,7 @@ AG_GST_CHECK_FEATURE(CDAUDIO, [cdaudio], cdaudio, [
|
|||
dnl *** dc1394 ***
|
||||
translit(dnm, m, l) AM_CONDITIONAL(USE_DC1394, true)
|
||||
AG_GST_CHECK_FEATURE(DC1394, [libdc1394], dc1394, [
|
||||
PKG_CHECK_MODULES(LIBDC1394, libdc1394-2 == 2.0.0-rc5, HAVE_DC1394="yes", [
|
||||
PKG_CHECK_MODULES(LIBDC1394, libdc1394-2 >= 2.0.0, HAVE_DC1394="yes", [
|
||||
HAVE_DC1394="no"
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
|
|
@ -421,6 +421,7 @@ gst_dc1394_change_state (GstElement * element, GstStateChange transition)
|
|||
switch (transition) {
|
||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||
GST_LOG_OBJECT (src, "State change null to ready");
|
||||
src->dc1394 = dc1394_new ();
|
||||
break;
|
||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||
GST_LOG_OBJECT (src, "State ready to paused");
|
||||
|
@ -468,7 +469,7 @@ gst_dc1394_change_state (GstElement * element, GstStateChange transition)
|
|||
if (src->camera && !gst_dc1394_change_camera_transmission (src, FALSE)) {
|
||||
|
||||
if (src->camera) {
|
||||
dc1394_free_camera (src->camera);
|
||||
dc1394_camera_free (src->camera);
|
||||
}
|
||||
src->camera = NULL;
|
||||
|
||||
|
@ -484,10 +485,15 @@ gst_dc1394_change_state (GstElement * element, GstStateChange transition)
|
|||
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||
GST_LOG_OBJECT (src, "State change ready to null");
|
||||
if (src->camera) {
|
||||
dc1394_free_camera (src->camera);
|
||||
dc1394_camera_free (src->camera);
|
||||
}
|
||||
src->camera = NULL;
|
||||
|
||||
if (src->dc1394) {
|
||||
dc1394_free (src->dc1394);
|
||||
}
|
||||
src->dc1394 = NULL;
|
||||
|
||||
if (src->caps) {
|
||||
gst_caps_unref (src->caps);
|
||||
src->caps = NULL;
|
||||
|
@ -838,9 +844,8 @@ gst_dc1394_get_cam_caps (GstDc1394 * src)
|
|||
{
|
||||
|
||||
dc1394camera_t *camera = NULL;
|
||||
dc1394camera_t **cameras = NULL;
|
||||
dc1394camera_list_t *cameras = NULL;
|
||||
dc1394error_t camerr;
|
||||
guint numCameras;
|
||||
gint i, j;
|
||||
dc1394video_modes_t modes;
|
||||
dc1394framerates_t framerates;
|
||||
|
@ -848,42 +853,33 @@ gst_dc1394_get_cam_caps (GstDc1394 * src)
|
|||
|
||||
gcaps = gst_caps_new_empty ();
|
||||
|
||||
camerr = dc1394_find_cameras (&cameras, &numCameras);
|
||||
camerr = dc1394_camera_enumerate (src->dc1394, &cameras);
|
||||
|
||||
if (camerr != DC1394_SUCCESS) {
|
||||
if (camerr == DC1394_NO_CAMERA) {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, ("There were no cameras"),
|
||||
("There were no cameras"));
|
||||
} else {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
|
||||
("Can't find cameras error : %d", camerr),
|
||||
("Can't find cameras error : %d", camerr));
|
||||
}
|
||||
if (camerr != DC1394_SUCCESS || cameras == NULL) {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
|
||||
("Can't find cameras error : %d", camerr),
|
||||
("Can't find cameras error : %d", camerr));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (src->camnum > (numCameras - 1)) {
|
||||
if (cameras->num == 0) {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, ("There were no cameras"),
|
||||
("There were no cameras"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (src->camnum > (cameras->num - 1)) {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, FAILED, ("Invalid camera number"),
|
||||
("Invalid camera number %d", src->camnum));
|
||||
|
||||
for (i = 0; i < numCameras; i++) {
|
||||
if (i != src->camnum) {
|
||||
dc1394_free_camera (cameras[i]);
|
||||
}
|
||||
}
|
||||
goto error;
|
||||
}
|
||||
|
||||
camera = cameras[src->camnum];
|
||||
camera =
|
||||
dc1394_camera_new_unit (src->dc1394, cameras->ids[src->camnum].guid,
|
||||
cameras->ids[src->camnum].unit);
|
||||
|
||||
// free the other cameras
|
||||
for (i = 0; i < numCameras; i++) {
|
||||
if (i != src->camnum) {
|
||||
dc1394_free_camera (cameras[i]);
|
||||
}
|
||||
}
|
||||
|
||||
free (cameras);
|
||||
dc1394_camera_free_list (cameras);
|
||||
cameras = NULL;
|
||||
|
||||
camerr = dc1394_video_get_supported_modes (camera, &modes);
|
||||
if (camerr != DC1394_SUCCESS) {
|
||||
|
@ -897,7 +893,7 @@ gst_dc1394_get_cam_caps (GstDc1394 * src)
|
|||
|
||||
if (m < DC1394_VIDEO_MODE_EXIF) {
|
||||
|
||||
GstStructure *gs = gst_structure_empty_new ("");
|
||||
GstStructure *gs = gst_structure_empty_new ("video");
|
||||
|
||||
gst_structure_set (gs, "vmode", G_TYPE_INT, m, NULL);
|
||||
|
||||
|
@ -916,7 +912,7 @@ gst_dc1394_get_cam_caps (GstDc1394 * src)
|
|||
} else {
|
||||
// FORMAT 7
|
||||
guint maxx, maxy;
|
||||
GstStructure *gs = gst_structure_empty_new ("");
|
||||
GstStructure *gs = gst_structure_empty_new ("video");
|
||||
dc1394color_codings_t colormodes;
|
||||
guint xunit, yunit;
|
||||
|
||||
|
@ -972,7 +968,7 @@ gst_dc1394_get_cam_caps (GstDc1394 * src)
|
|||
}
|
||||
|
||||
if (camera) {
|
||||
dc1394_free_camera (camera);
|
||||
dc1394_camera_free (camera);
|
||||
}
|
||||
|
||||
return gcaps;
|
||||
|
@ -983,8 +979,13 @@ error:
|
|||
gst_caps_unref (gcaps);
|
||||
}
|
||||
|
||||
if (cameras) {
|
||||
dc1394_camera_free_list (cameras);
|
||||
cameras = NULL;
|
||||
}
|
||||
|
||||
if (camera) {
|
||||
dc1394_free_camera (camera);
|
||||
dc1394_camera_free (camera);
|
||||
camera = NULL;
|
||||
}
|
||||
|
||||
|
@ -1023,24 +1024,22 @@ gst_dc1394_framerate_frac_to_const (gint num, gint denom)
|
|||
static gboolean
|
||||
gst_dc1394_open_cam_with_best_caps (GstDc1394 * src)
|
||||
{
|
||||
dc1394camera_t **cameras = NULL;
|
||||
guint numCameras;
|
||||
gint i;
|
||||
dc1394camera_list_t *cameras = NULL;
|
||||
gint err;
|
||||
int framerateconst;
|
||||
|
||||
GST_LOG_OBJECT (src, "Opening the camera!!!");
|
||||
|
||||
|
||||
if (dc1394_find_cameras (&cameras, &numCameras) != DC1394_SUCCESS) {
|
||||
if (dc1394_camera_enumerate (src->dc1394, &cameras) != DC1394_SUCCESS) {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, FAILED, ("Can't find cameras"),
|
||||
("Can't find cameras"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
GST_LOG_OBJECT (src, "Found %d cameras", numCameras);
|
||||
GST_LOG_OBJECT (src, "Found %d cameras", cameras->num);
|
||||
|
||||
if (src->camnum > (numCameras - 1)) {
|
||||
if (src->camnum > (cameras->num - 1)) {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, FAILED, ("Invalid camera number"),
|
||||
("Invalid camera number"));
|
||||
goto error;
|
||||
|
@ -1048,15 +1047,12 @@ gst_dc1394_open_cam_with_best_caps (GstDc1394 * src)
|
|||
|
||||
GST_LOG_OBJECT (src, "Opening camera : %d", src->camnum);
|
||||
|
||||
src->camera = cameras[src->camnum];
|
||||
src->camera =
|
||||
dc1394_camera_new_unit (src->dc1394, cameras->ids[src->camnum].guid,
|
||||
cameras->ids[src->camnum].unit);
|
||||
|
||||
// free the other cameras
|
||||
for (i = 0; i < numCameras; i++) {
|
||||
if (i != src->camnum)
|
||||
dc1394_free_camera (cameras[i]);
|
||||
}
|
||||
|
||||
free (cameras);
|
||||
dc1394_camera_free_list (cameras);
|
||||
cameras = NULL;
|
||||
|
||||
// figure out mode
|
||||
framerateconst = gst_dc1394_framerate_frac_to_const (src->rate_numerator,
|
||||
|
@ -1121,7 +1117,7 @@ gst_dc1394_open_cam_with_best_caps (GstDc1394 * src)
|
|||
"Trying to cleanup the iso_channels_and_bandwidth and retrying");
|
||||
|
||||
// try to cleanup the bandwidth and retry
|
||||
err = dc1394_cleanup_iso_channels_and_bandwidth (src->camera);
|
||||
err = dc1394_iso_release_all (src->camera);
|
||||
if (err != DC1394_SUCCESS) {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, FAILED,
|
||||
("Could not cleanup bandwidth"), ("Could not cleanup bandwidth"));
|
||||
|
@ -1152,7 +1148,7 @@ gst_dc1394_open_cam_with_best_caps (GstDc1394 * src)
|
|||
error:
|
||||
|
||||
if (src->camera) {
|
||||
dc1394_free_camera (src->camera);
|
||||
dc1394_camera_free (src->camera);
|
||||
src->camera = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ struct _GstDc1394 {
|
|||
gint camnum;
|
||||
gint bufsize;
|
||||
|
||||
dc1394_t * dc1394;
|
||||
dc1394camera_t * camera;
|
||||
|
||||
GstCaps *caps;
|
||||
|
|
Loading…
Reference in a new issue