Commit c1cbe147 authored by Katsushi Kobayashi's avatar Katsushi Kobayashi Committed by Felix Paul Kühne

qtcapture: added support for all QTKit-compatible video input devices

includes a couple of tweaks by me and will need further testing and cleaning
parent f767daa2
......@@ -38,6 +38,7 @@ Access:
* RTP: support for dynamic payload types by specifying the payload format
in an option (no autodetection): only Theora supported for now
* Basic HTCPCP implementation for Coffee Pot control
* QTCapture: added support for all QTKit-compatible video input devices
Codecs:
* You can now use ffmpeg-mt in conjunction with vlc
......
......@@ -3779,6 +3779,7 @@ then
VLC_ADD_LDFLAGS([macosx minimal_macosx], [-Wl,-framework,Carbon])
VLC_ADD_LDFLAGS([macosx minimal_macosx], [-Wl,-framework,CoreServices])
VLC_ADD_LDFLAGS([macosx minimal_macosx], [-Wl,-framework,AGL])
VLC_ADD_LDFLAGS([macosx], [-Wl,-framework,QTKit])
VLC_ADD_LDFLAGS([macosx], [-Wl,-framework,IOKit])
VLC_ADD_LDFLAGS([macosx], [-F${CONTRIB_DIR}/Sparkle -Wl,-framework,Sparkle])
VLC_ADD_OBJCFLAGS([macosx], [-F${CONTRIB_DIR}/Sparkle])
......
/*****************************************************************************
* qtcapture.m: qtkit (Mac OS X) based capture module
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* Copyright (C) 2008-2011 the VideoLAN team
*
* Authors: Pierre d'Herbemont <pdherbemont@videolan.org>
*
......@@ -258,8 +258,8 @@ static int Open( vlc_object_t *p_this )
{
camera_format = [format_array objectAtIndex: k];
NSLog( @"%@", [camera_format localizedFormatSummary] );
NSLog( @"%@",[[camera_format formatDescriptionAttributes] description] );
msg_Dbg(p_demux, "localized Format: %s", [[camera_format localizedFormatSummary] UTF8String] );
msg_Dbg(p_demux, "format description: %s", [[[camera_format formatDescriptionAttributes] description] UTF8String] );
}
if( [format_array count] )
camera_format = [format_array objectAtIndex: 0];
......@@ -288,9 +288,9 @@ static int Open( vlc_object_t *p_this )
fmt.video.i_sar_den = encoded_size.width;
}
NSLog( @"encoded_size %d %d", (int)encoded_size.width, (int)encoded_size.height );
NSLog( @"display_size %d %d", (int)display_size.width, (int)display_size.height );
NSLog( @"PAR size %d %d", (int)par_size.width, (int)par_size.height );
msg_Dbg(p_demux, "encoded_size %i %i", (int)encoded_size.width, (int)encoded_size.height );
msg_Dbg(p_demux, "display_size %i %i", (int)display_size.width, (int)display_size.height );
msg_Dbg(p_demux, "PAR size %i %i", (int)par_size.width, (int)par_size.height );
[p_sys->output setPixelBufferAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt: p_sys->height], kCVPixelBufferHeightKey,
......
......@@ -82,7 +82,6 @@ static VLCTrackSynchronization *_o_sharedInstance = nil;
if( p_input )
{
var_SetTime( p_input, "audio-delay", 0.0 );
var_SetTime( p_input, "spu-delay", 0.0 );
var_SetFloat( p_input, "sub-fps", 1.0 );
......
......@@ -159,6 +159,16 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class );
IBOutlet id o_screen_height_stp;
IBOutlet id o_screen_follow_mouse_ckb;
/* QTK support */
IBOutlet id o_qtk_view;
IBOutlet id o_qtk_lbl;
IBOutlet id o_qtk_long_lbl;
IBOutlet id o_qtk_device_pop;
IBOutlet id o_qtk_label_view;
NSArray *qtkvideoDevices;
NSString *qtk_currdevice_uid;
BOOL b_autoplay;
id o_currentCaptureView;
NSString *o_file_slave_path;
......@@ -171,6 +181,9 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class );
- (void)setMRL:(NSString *)mrl;
- (NSString *)MRL;
- (NSArray *)qtkvideoDevices;
- (void)qtkrefreshDevices;
- (void)setSubPanel;
- (void)openTarget:(int)i_type;
- (void)tabView:(NSTabView *)o_tv didSelectTabViewItem:(NSTabViewItem *)o_tvi;
......@@ -200,6 +213,7 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class );
- (void)openCapture;
- (void)showCaptureView: theView;
- (IBAction)openCaptureModeChanged:(id)sender;
- (IBAction)qtkChanged:(id)sender;
- (IBAction)eyetvSwitchChannel:(id)sender;
- (IBAction)eyetvLaunch:(id)sender;
- (IBAction)eyetvGetPlugin:(id)sender;
......
......@@ -38,6 +38,9 @@
#include <IOKit/storage/IOMedia.h>
#include <IOKit/storage/IOCDMedia.h>
#include <IOKit/storage/IODVDMedia.h>
#import <Cocoa/Cocoa.h>
#import <QTKit/QTKit.h>
#import <Foundation/NSobject.h>
#import "intf.h"
#import "playlist.h"
......@@ -47,14 +50,14 @@
#include <vlc_url.h>
NSArray *qtkvideoDevices;
#define setEyeTVUnconnected \
[o_capture_lbl setStringValue: _NS("No device connected")]; \
[o_capture_long_lbl setStringValue: _NS("VLC could not detect any EyeTV compatible device.\n\nCheck the device's connection, make sure that the latest EyeTV software is installed and try again.")]; \
[o_capture_lbl setStringValue: _NS("No device is selected")]; \
[o_capture_long_lbl setStringValue: _NS("Any device is not selected.\n\nChose abailable device in above pull-down menu\n.")]; \
[o_capture_lbl displayIfNeeded]; \
[o_capture_long_lbl displayIfNeeded]; \
[self showCaptureView: o_capture_label_view]
/*****************************************************************************
* GetEjectableMediaOfClass
*****************************************************************************/
......@@ -240,6 +243,27 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_eyetv_launchEyeTV_btn setTitle: _NS("Launch EyeTV now")];
[o_eyetv_getPlugin_btn setTitle: _NS("Download Plugin")];
[self qtkvideoDevices];
[o_qtk_device_pop removeAllItems];
msg_Dbg( VLCIntf, "Found %lu capture devices", [qtkvideoDevices count] );
if([qtkvideoDevices count] == 0){
[o_qtk_device_pop addItemWithTitle: _NS("None")];
[qtk_currdevice_uid release];
}else {
if (!qtk_currdevice_uid) {
qtk_currdevice_uid = [[[QTCaptureDevice defaultInputDeviceWithMediaType: QTMediaTypeVideo] uniqueID]
stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
}
for(int ivideo = 0; ivideo < [qtkvideoDevices count]; ivideo++){
QTCaptureDevice *qtk_device;
qtk_device = [qtkvideoDevices objectAtIndex:ivideo];
[o_qtk_device_pop addItemWithTitle: [qtk_device localizedDisplayName]];
if([[[qtk_device uniqueID]stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] isEqualToString:qtk_currdevice_uid]){
[o_qtk_device_pop selectItemAtIndex:ivideo];
}
}
}
[self setSubPanel];
[[NSNotificationCenter defaultCenter] addObserver: self
......@@ -464,6 +488,15 @@ static VLCOpen *_o_sharedMainInstance = nil;
}
}
- (IBAction)qtkChanged:(id)sender
{
msg_Dbg( VLCIntf, "Changed UID: old %s", [qtk_currdevice_uid UTF8String] );
qtk_currdevice_uid = [[[qtkvideoDevices objectAtIndex:[o_qtk_device_pop indexOfSelectedItem]] uniqueID]
stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
msg_Dbg( VLCIntf, "Changed UID: new %s", [qtk_currdevice_uid UTF8String] );
[self setMRL:[NSString stringWithFormat:@"qtcapture://%@", qtk_currdevice_uid]];
}
- (void)tabView:(NSTabView *)o_tv didSelectTabViewItem:(NSTabViewItem *)o_tvi
{
NSString *o_label = [o_tvi label];
......@@ -569,7 +602,6 @@ static VLCOpen *_o_sharedMainInstance = nil;
- (void)openCapture
{
[self openCaptureModeChanged: nil];
[self showCaptureView: o_capture_label_view];
[self openTarget: 3];
}
......@@ -1058,13 +1090,20 @@ static VLCOpen *_o_sharedMainInstance = nil;
}
else if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: @"iSight"] )
{
[o_capture_lbl setStringValue: _NS("iSight Capture Input")];
[o_capture_long_lbl setStringValue: _NS("This facility allows you to process your iSight's input signal.\n\nNo settings are available in this version, so you will be provided a 640px*480px raw video stream.\n\nLive Audio input is not supported.")];
[o_capture_lbl displayIfNeeded];
[o_capture_long_lbl displayIfNeeded];
[self showCaptureView: o_qtk_view];
[o_qtk_lbl setStringValue: _NS("iSight Capture Input")];
[o_qtk_long_lbl setStringValue: _NS("This facility allows you to process your iSight's input signal.\n\nNo settings are available in this version, so you will be provided a 640px*480px raw video stream.\n\nLive Audio input is not supported.")];
[o_qtk_lbl displayIfNeeded];
[o_qtk_long_lbl displayIfNeeded];
[self showCaptureView: o_capture_label_view];
[self setMRL: @"qtcapture://"];
if(!qtk_currdevice_uid)
{
[self setMRL: @""];
}
else
{
[self setMRL:[NSString stringWithFormat:@"qtcapture://%@", qtk_currdevice_uid]];
}
}
}
......@@ -1262,6 +1301,19 @@ static VLCOpen *_o_sharedMainInstance = nil;
NSBeep();
}
- (NSArray *)qtkvideoDevices
{
if (!qtkvideoDevices)
[self qtkrefreshDevices];
return qtkvideoDevices;
}
- (void)qtkrefreshDevices
{
[qtkvideoDevices release];
qtkvideoDevices = [[[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo] arrayByAddingObjectsFromArray:[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeMuxed]] retain];
}
@end
@implementation VLCOpenTextField
......
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