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: ...@@ -38,6 +38,7 @@ Access:
* RTP: support for dynamic payload types by specifying the payload format * RTP: support for dynamic payload types by specifying the payload format
in an option (no autodetection): only Theora supported for now in an option (no autodetection): only Theora supported for now
* Basic HTCPCP implementation for Coffee Pot control * Basic HTCPCP implementation for Coffee Pot control
* QTCapture: added support for all QTKit-compatible video input devices
Codecs: Codecs:
* You can now use ffmpeg-mt in conjunction with vlc * You can now use ffmpeg-mt in conjunction with vlc
......
...@@ -3779,6 +3779,7 @@ then ...@@ -3779,6 +3779,7 @@ then
VLC_ADD_LDFLAGS([macosx minimal_macosx], [-Wl,-framework,Carbon]) 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,CoreServices])
VLC_ADD_LDFLAGS([macosx minimal_macosx], [-Wl,-framework,AGL]) 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], [-Wl,-framework,IOKit])
VLC_ADD_LDFLAGS([macosx], [-F${CONTRIB_DIR}/Sparkle -Wl,-framework,Sparkle]) VLC_ADD_LDFLAGS([macosx], [-F${CONTRIB_DIR}/Sparkle -Wl,-framework,Sparkle])
VLC_ADD_OBJCFLAGS([macosx], [-F${CONTRIB_DIR}/Sparkle]) VLC_ADD_OBJCFLAGS([macosx], [-F${CONTRIB_DIR}/Sparkle])
......
/***************************************************************************** /*****************************************************************************
* qtcapture.m: qtkit (Mac OS X) based capture module * 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> * Authors: Pierre d'Herbemont <pdherbemont@videolan.org>
* *
...@@ -258,8 +258,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -258,8 +258,8 @@ static int Open( vlc_object_t *p_this )
{ {
camera_format = [format_array objectAtIndex: k]; camera_format = [format_array objectAtIndex: k];
NSLog( @"%@", [camera_format localizedFormatSummary] ); msg_Dbg(p_demux, "localized Format: %s", [[camera_format localizedFormatSummary] UTF8String] );
NSLog( @"%@",[[camera_format formatDescriptionAttributes] description] ); msg_Dbg(p_demux, "format description: %s", [[[camera_format formatDescriptionAttributes] description] UTF8String] );
} }
if( [format_array count] ) if( [format_array count] )
camera_format = [format_array objectAtIndex: 0]; camera_format = [format_array objectAtIndex: 0];
...@@ -288,9 +288,9 @@ static int Open( vlc_object_t *p_this ) ...@@ -288,9 +288,9 @@ static int Open( vlc_object_t *p_this )
fmt.video.i_sar_den = encoded_size.width; fmt.video.i_sar_den = encoded_size.width;
} }
NSLog( @"encoded_size %d %d", (int)encoded_size.width, (int)encoded_size.height ); msg_Dbg(p_demux, "encoded_size %i %i", (int)encoded_size.width, (int)encoded_size.height );
NSLog( @"display_size %d %d", (int)display_size.width, (int)display_size.height ); msg_Dbg(p_demux, "display_size %i %i", (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, "PAR size %i %i", (int)par_size.width, (int)par_size.height );
[p_sys->output setPixelBufferAttributes: [NSDictionary dictionaryWithObjectsAndKeys: [p_sys->output setPixelBufferAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt: p_sys->height], kCVPixelBufferHeightKey, [NSNumber numberWithInt: p_sys->height], kCVPixelBufferHeightKey,
......
...@@ -82,7 +82,6 @@ static VLCTrackSynchronization *_o_sharedInstance = nil; ...@@ -82,7 +82,6 @@ static VLCTrackSynchronization *_o_sharedInstance = nil;
if( p_input ) if( p_input )
{ {
var_SetTime( p_input, "audio-delay", 0.0 ); var_SetTime( p_input, "audio-delay", 0.0 );
var_SetTime( p_input, "spu-delay", 0.0 ); var_SetTime( p_input, "spu-delay", 0.0 );
var_SetFloat( p_input, "sub-fps", 1.0 ); var_SetFloat( p_input, "sub-fps", 1.0 );
......
...@@ -159,6 +159,16 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class ); ...@@ -159,6 +159,16 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class );
IBOutlet id o_screen_height_stp; IBOutlet id o_screen_height_stp;
IBOutlet id o_screen_follow_mouse_ckb; 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; BOOL b_autoplay;
id o_currentCaptureView; id o_currentCaptureView;
NSString *o_file_slave_path; NSString *o_file_slave_path;
...@@ -171,6 +181,9 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class ); ...@@ -171,6 +181,9 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class );
- (void)setMRL:(NSString *)mrl; - (void)setMRL:(NSString *)mrl;
- (NSString *)MRL; - (NSString *)MRL;
- (NSArray *)qtkvideoDevices;
- (void)qtkrefreshDevices;
- (void)setSubPanel; - (void)setSubPanel;
- (void)openTarget:(int)i_type; - (void)openTarget:(int)i_type;
- (void)tabView:(NSTabView *)o_tv didSelectTabViewItem:(NSTabViewItem *)o_tvi; - (void)tabView:(NSTabView *)o_tv didSelectTabViewItem:(NSTabViewItem *)o_tvi;
...@@ -200,6 +213,7 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class ); ...@@ -200,6 +213,7 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class );
- (void)openCapture; - (void)openCapture;
- (void)showCaptureView: theView; - (void)showCaptureView: theView;
- (IBAction)openCaptureModeChanged:(id)sender; - (IBAction)openCaptureModeChanged:(id)sender;
- (IBAction)qtkChanged:(id)sender;
- (IBAction)eyetvSwitchChannel:(id)sender; - (IBAction)eyetvSwitchChannel:(id)sender;
- (IBAction)eyetvLaunch:(id)sender; - (IBAction)eyetvLaunch:(id)sender;
- (IBAction)eyetvGetPlugin:(id)sender; - (IBAction)eyetvGetPlugin:(id)sender;
......
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
#include <IOKit/storage/IOMedia.h> #include <IOKit/storage/IOMedia.h>
#include <IOKit/storage/IOCDMedia.h> #include <IOKit/storage/IOCDMedia.h>
#include <IOKit/storage/IODVDMedia.h> #include <IOKit/storage/IODVDMedia.h>
#import <Cocoa/Cocoa.h>
#import <QTKit/QTKit.h>
#import <Foundation/NSobject.h>
#import "intf.h" #import "intf.h"
#import "playlist.h" #import "playlist.h"
...@@ -47,14 +50,14 @@ ...@@ -47,14 +50,14 @@
#include <vlc_url.h> #include <vlc_url.h>
NSArray *qtkvideoDevices;
#define setEyeTVUnconnected \ #define setEyeTVUnconnected \
[o_capture_lbl setStringValue: _NS("No device connected")]; \ [o_capture_lbl setStringValue: _NS("No device is selected")]; \
[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_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_lbl displayIfNeeded]; \
[o_capture_long_lbl displayIfNeeded]; \ [o_capture_long_lbl displayIfNeeded]; \
[self showCaptureView: o_capture_label_view] [self showCaptureView: o_capture_label_view]
/***************************************************************************** /*****************************************************************************
* GetEjectableMediaOfClass * GetEjectableMediaOfClass
*****************************************************************************/ *****************************************************************************/
...@@ -240,6 +243,27 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -240,6 +243,27 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_eyetv_launchEyeTV_btn setTitle: _NS("Launch EyeTV now")]; [o_eyetv_launchEyeTV_btn setTitle: _NS("Launch EyeTV now")];
[o_eyetv_getPlugin_btn setTitle: _NS("Download Plugin")]; [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]; [self setSubPanel];
[[NSNotificationCenter defaultCenter] addObserver: self [[NSNotificationCenter defaultCenter] addObserver: self
...@@ -464,6 +488,15 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -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 - (void)tabView:(NSTabView *)o_tv didSelectTabViewItem:(NSTabViewItem *)o_tvi
{ {
NSString *o_label = [o_tvi label]; NSString *o_label = [o_tvi label];
...@@ -569,7 +602,6 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -569,7 +602,6 @@ static VLCOpen *_o_sharedMainInstance = nil;
- (void)openCapture - (void)openCapture
{ {
[self openCaptureModeChanged: nil]; [self openCaptureModeChanged: nil];
[self showCaptureView: o_capture_label_view];
[self openTarget: 3]; [self openTarget: 3];
} }
...@@ -662,7 +694,7 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -662,7 +694,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
psz_class = kIOCDMediaClass; psz_class = kIOCDMediaClass;
o_disc = o_type; o_disc = o_type;
b_no_menus = NO; b_title_chapter = YES; b_no_menus = NO; b_title_chapter = YES;
} }
else if ( [o_type isEqualToString: _NS("Audio CD")]) else if ( [o_type isEqualToString: _NS("Audio CD")])
{ {
psz_class = kIOCDMediaClass; psz_class = kIOCDMediaClass;
...@@ -683,7 +715,7 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -683,7 +715,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
if ( i_devices ) if ( i_devices )
{ {
for( int i = 0; i < i_devices; i++ ) for( int i = 0; i < i_devices; i++ )
{ {
[o_disc_device [o_disc_device
addItemWithObjectValue: [o_devices objectAtIndex: i]]; addItemWithObjectValue: [o_devices objectAtIndex: i]];
...@@ -768,7 +800,7 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -768,7 +800,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
o_mrl_string = [NSString stringWithFormat: @"dvdread://%@@%i:%i-", o_mrl_string = [NSString stringWithFormat: @"dvdread://%@@%i:%i-",
o_device, i_title, i_chapter]; o_device, i_title, i_chapter];
else else
o_mrl_string = [NSString stringWithFormat: @"dvdnav://%@", o_mrl_string = [NSString stringWithFormat: @"dvdnav://%@",
o_device]; o_device];
} }
...@@ -1058,13 +1090,20 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -1058,13 +1090,20 @@ static VLCOpen *_o_sharedMainInstance = nil;
} }
else if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: @"iSight"] ) else if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: @"iSight"] )
{ {
[o_capture_lbl setStringValue: _NS("iSight Capture Input")]; [self showCaptureView: o_qtk_view];
[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_qtk_lbl setStringValue: _NS("iSight Capture Input")];
[o_capture_lbl displayIfNeeded]; [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_capture_long_lbl displayIfNeeded]; [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; ...@@ -1262,6 +1301,19 @@ static VLCOpen *_o_sharedMainInstance = nil;
NSBeep(); NSBeep();
} }
- (NSArray *)qtkvideoDevices
{
if (!qtkvideoDevices)
[self qtkrefreshDevices];
return qtkvideoDevices;
}
- (void)qtkrefreshDevices
{
[qtkvideoDevices release];
qtkvideoDevices = [[[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo] arrayByAddingObjectsFromArray:[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeMuxed]] retain];
}
@end @end
@implementation VLCOpenTextField @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