From 3f5bfcc07a3203bcb660fe294209bfebcf9b63ae Mon Sep 17 00:00:00 2001 From: hopet Date: Thu, 22 Nov 2007 14:22:20 +0000 Subject: [PATCH] QuickTime capture compiles and runs, though it generates just garbage instead of proper image as of now. --- ultragrid/Makefile.in | 4 ++-- ultragrid/src/video_capture.c | 15 +++++++++++++-- ultragrid/src/video_capture/quicktime.c | 17 +++++++++-------- ultragrid/src/video_capture/quicktime.h | 4 ++-- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/ultragrid/Makefile.in b/ultragrid/Makefile.in index 65b224521..7be195a5b 100644 --- a/ultragrid/Makefile.in +++ b/ultragrid/Makefile.in @@ -36,8 +36,8 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -# $Revision: 1.3 $ -# $Date: 2007/11/22 12:14:19 $ +# $Revision: 1.4 $ +# $Date: 2007/11/22 14:22:20 $ # AR = ar diff --git a/ultragrid/src/video_capture.c b/ultragrid/src/video_capture.c index de1bafb4b..d49f4a92c 100644 --- a/ultragrid/src/video_capture.c +++ b/ultragrid/src/video_capture.c @@ -38,8 +38,8 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Revision: 1.1 $ - * $Date: 2007/11/08 09:48:59 $ + * $Revision: 1.2 $ + * $Date: 2007/11/22 14:22:20 $ * */ @@ -51,6 +51,7 @@ #include "video_capture.h" #include "video_capture/firewire_dv_freebsd.h" #include "video_capture/hdstation.h" +#include "video_capture/quicktime.h" #include "video_capture/testcard.h" #include "video_capture/null.h" @@ -90,6 +91,16 @@ struct vidcap_device_api vidcap_device_table[] = { vidcap_hdstation_done, vidcap_hdstation_grab }, +#endif +#ifdef HAVE_MACOSX + { + /* The QuickTime API */ + 0, + vidcap_quicktime_probe, + vidcap_quicktime_init, + vidcap_quicktime_done, + vidcap_quicktime_grab + }, #endif { /* Dummy sender for testing purposes */ diff --git a/ultragrid/src/video_capture/quicktime.c b/ultragrid/src/video_capture/quicktime.c index 5707de0ea..f98b0964e 100644 --- a/ultragrid/src/video_capture/quicktime.c +++ b/ultragrid/src/video_capture/quicktime.c @@ -33,8 +33,8 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Revision: 1.1 $ - * $Date: 2007/11/22 12:14:19 $ + * $Revision: 1.2 $ + * $Date: 2007/11/22 14:22:20 $ * */ @@ -119,6 +119,7 @@ qt_data_proc(SGChannel c, Ptr p, long len, long *offset, long chRefCon, TimeValu err = SGGetChannelSampleDescription(c, (Handle)imageDesc); debug_msg("image %dx%d size=%d\n", (*imageDesc)->width, (*imageDesc)->height, (*imageDesc)->dataSize); + printf("image %dx%d size=%d\n", (*imageDesc)->width, (*imageDesc)->height, (*imageDesc)->dataSize); // begin the process of decompressing a sequence of frames // this is a set-up call and is only called once for @@ -227,7 +228,7 @@ qt_open_grabber(struct qt_grabber_state *s) debug_msg("Unable to set channel usage\n"); return 0; } - + /****************************************************************************************/ /* Step ?: Set the data procedure, which processes the frames as they're captured. */ SGSetDataProc(s->grabber, NewSGDataUPP (qt_data_proc), (long)s); @@ -284,8 +285,8 @@ vidcap_quicktime_init (int fps) s->seqID = 0; s->bounds.top = 0; s->bounds.left = 0; - s->bounds.bottom = 575; - s->bounds.right = 719; + s->bounds.bottom = hd_size_y - 1; + s->bounds.right = hd_size_x - 1; qt_open_grabber (s); } @@ -333,10 +334,10 @@ vidcap_quicktime_grab (void *state) vf = malloc(sizeof(struct video_frame)); if (vf != NULL) { vf->colour_mode = YUV_422; - vf->width = 720; - vf->height = 576; + vf->width = hd_size_x; + vf->height = hd_size_y; vf->data = (unsigned char *) GetPixBaseAddr(GetGWorldPixMap(s->gworld)); - vf->data_len = 720 * 576 * 2; + vf->data_len = hd_size_x * hd_size_y * hd_color_bpp; } return vf; } diff --git a/ultragrid/src/video_capture/quicktime.h b/ultragrid/src/video_capture/quicktime.h index 310b98a8a..fef745e52 100644 --- a/ultragrid/src/video_capture/quicktime.h +++ b/ultragrid/src/video_capture/quicktime.h @@ -32,8 +32,8 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Revision: 1.1 $ - * $Date: 2007/11/22 12:14:19 $ + * $Revision: 1.2 $ + * $Date: 2007/11/22 14:22:20 $ * */