亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? qtcapture.m

?? VLC Player Source Code
?? M
字號:
/****************************************************************************** qtcapture.m: qtkit (Mac OS X) based capture module****************************************************************************** Copyright (C) 2008 the VideoLAN team** Authors: Pierre d'Herbemont <pdherbemont@videolan.org>******************************************************************************* This library is free software; you can redistribute it and/or* modify it under the terms of the GNU Lesser General Public* License as published by the Free Software Foundation;* version 2 of the License.** This library is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU* Lesser General Public License for more details.** You should have received a copy of the GNU Lesser General Public* License along with this library; if not, write to the Free Software* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA******************************************************************************//****************************************************************************** Preamble*****************************************************************************/#ifdef HAVE_CONFIG_H# include "config.h"#endif#include <vlc_common.h>#include <vlc_plugin.h>#include <vlc_input.h>#include <vlc_vout.h>#include <vlc_demux.h>#include <vlc_interface.h>#import <QTKit/QTKit.h>#import <CoreAudio/CoreAudio.h>/****************************************************************************** Local prototypes*****************************************************************************/static int Open( vlc_object_t *p_this );static void Close( vlc_object_t *p_this );static int Demux( demux_t *p_demux );static int Control( demux_t *, int, va_list );/****************************************************************************** Module descriptor*****************************************************************************/vlc_module_begin();   set_shortname( N_("Quicktime Capture") );   set_description( N_("Quicktime Capture") );   set_category( CAT_INPUT );   set_subcategory( SUBCAT_INPUT_ACCESS );   add_shortcut( "qtcapture" );   set_capability( "access_demux", 10 );   set_callbacks( Open, Close );vlc_module_end();/****************************************************************************** QTKit Bridge*****************************************************************************/@interface VLCDecompressedVideoOutput : QTCaptureDecompressedVideoOutput{    CVImageBufferRef currentImageBuffer;    mtime_t currentPts;    mtime_t previousPts;}- (id)init;- (void)outputVideoFrame:(CVImageBufferRef)videoFrame withSampleBuffer:(QTSampleBuffer *)sampleBuffer fromConnection:(QTCaptureConnection *)connection;- (mtime_t)copyCurrentFrameToBuffer:(void *)buffer;@end/* Apple sample code */@implementation VLCDecompressedVideoOutput : QTCaptureDecompressedVideoOutput- (id)init{    if( self = [super init] )    {        currentImageBuffer = nil;        currentPts = 0;        previousPts = 0;    }    return self;}- (void)dealloc{    @synchronized (self)    {        CVBufferRelease(currentImageBuffer);        currentImageBuffer = nil;    }    [super dealloc];}- (void)outputVideoFrame:(CVImageBufferRef)videoFrame withSampleBuffer:(QTSampleBuffer *)sampleBuffer fromConnection:(QTCaptureConnection *)connection{    // Store the latest frame    // This must be done in a @synchronized block because this delegate method is not called on the main thread    CVImageBufferRef imageBufferToRelease;    CVBufferRetain(videoFrame);    @synchronized (self)    {        imageBufferToRelease = currentImageBuffer;        currentImageBuffer = videoFrame;        currentPts = (mtime_t)(1000000L / [sampleBuffer presentationTime].timeScale * [sampleBuffer presentationTime].timeValue);                /* Try to use hosttime of the sample if available, because iSight Pts seems broken */        NSNumber *hosttime = (NSNumber *)[sampleBuffer attributeForKey:QTSampleBufferHostTimeAttribute];        if( hosttime ) currentPts = (mtime_t)AudioConvertHostTimeToNanos([hosttime unsignedLongLongValue])/1000;    }    CVBufferRelease(imageBufferToRelease);}- (mtime_t)copyCurrentFrameToBuffer:(void *)buffer{    CVImageBufferRef imageBuffer;    mtime_t pts;    if(!currentImageBuffer || currentPts == previousPts )        return 0;    @synchronized (self)    {        imageBuffer = CVBufferRetain(currentImageBuffer);        pts = previousPts = currentPts;        CVPixelBufferLockBaseAddress(imageBuffer, 0);        void * pixels = CVPixelBufferGetBaseAddress(imageBuffer);        memcpy( buffer, pixels, CVPixelBufferGetBytesPerRow(imageBuffer) * CVPixelBufferGetHeight(imageBuffer) );        CVPixelBufferUnlockBaseAddress(imageBuffer, 0);    }    CVBufferRelease(imageBuffer);    return currentPts;}@end/****************************************************************************** Struct*****************************************************************************/struct demux_sys_t {    QTCaptureSession * session;    QTCaptureDevice * device;    VLCDecompressedVideoOutput * output;    int height, width;    es_out_id_t * p_es_video;};/****************************************************************************** qtchroma_to_fourcc*****************************************************************************/static int qtchroma_to_fourcc( int i_qt ){    static const struct    {        unsigned int i_qt;        int i_fourcc;    } qtchroma_to_fourcc[] =    {        /* Raw data types */        { k422YpCbCr8CodecType,    VLC_FOURCC('U','Y','V','Y') },        { 0, 0 }    };    int i;    for( i = 0; qtchroma_to_fourcc[i].i_qt; i++ )    {        if( qtchroma_to_fourcc[i].i_qt == i_qt )            return qtchroma_to_fourcc[i].i_fourcc;    }    return 0;}/****************************************************************************** Open:*****************************************************************************/static int Open( vlc_object_t *p_this ){    demux_t     *p_demux = (demux_t*)p_this;    demux_sys_t *p_sys = NULL;    es_format_t fmt;    int i;    int i_width;    int i_height;    int i_aspect;    int result = 0;    /* Only when selected */    if( *p_demux->psz_access == '\0' )        return VLC_EGENERIC;        NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];    /* Set up p_demux */    p_demux->pf_demux = Demux;    p_demux->pf_control = Control;    p_demux->info.i_update = 0;    p_demux->info.i_title = 0;    p_demux->info.i_seekpoint = 0;        p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );    if( !p_sys ) return VLC_ENOMEM;        memset( p_sys, 0, sizeof( demux_sys_t ) );    memset( &fmt, 0, sizeof( es_format_t ) );            msg_Dbg( p_demux, "QTCapture Probed" );    QTCaptureDeviceInput * input = nil;    NSError *o_returnedError;    p_sys->device = [QTCaptureDevice defaultInputDeviceWithMediaType: QTMediaTypeVideo];    if( !p_sys->device )    {        intf_UserFatal( p_demux, true, _("No Input device found"),                        _("Your Mac does not seem to be equipped with a suitable input device. "                          "Please check your connectors and drivers.") );        msg_Err( p_demux, "Can't find any Video device" );                goto error;    }    if( ![p_sys->device open: &o_returnedError] )    {        msg_Err( p_demux, "Unable to open the capture device (%i)", [o_returnedError code] );        goto error;    }    if( [p_sys->device isInUseByAnotherApplication] == YES )    {        msg_Err( p_demux, "default capture device is exclusively in use by another application" );        goto error;    }    input = [[QTCaptureDeviceInput alloc] initWithDevice: p_sys->device];    if( !input )    {        msg_Err( p_demux, "can't create a valid capture input facility" );        goto error;    }    p_sys->output = [[VLCDecompressedVideoOutput alloc] init];    /* Hack - This will lower CPU consumption for some reason */    [p_sys->output setPixelBufferAttributes: [NSDictionary dictionaryWithObjectsAndKeys:        [NSNumber numberWithInt:480], kCVPixelBufferHeightKey,        [NSNumber numberWithInt:640], kCVPixelBufferWidthKey, nil]];    p_sys->session = [[QTCaptureSession alloc] init];    bool ret = [p_sys->session addInput:input error: &o_returnedError];    if( !ret )    {        msg_Err( p_demux, "default video capture device could not be added to capture session (%i)", [o_returnedError code] );        goto error;    }    ret = [p_sys->session addOutput:p_sys->output error: &o_returnedError];    if( !ret )    {        msg_Err( p_demux, "output could not be added to capture session (%i)", [o_returnedError code] );        goto error;    }    [p_sys->session startRunning];    int qtchroma = [[[p_sys->device formatDescriptions] objectAtIndex: 0] formatType]; /* FIXME */    int chroma = qtchroma_to_fourcc( qtchroma );    if( !chroma )    {        msg_Err( p_demux, "Unknown qt chroma %4.4s provided by camera", (char*)&qtchroma );        goto error;    }    /* Now we can init */    es_format_Init( &fmt, VIDEO_ES, chroma );    NSSize size = [[p_sys->device attributeForKey:QTFormatDescriptionVideoEncodedPixelsSizeAttribute] sizeValue];    p_sys->width = fmt.video.i_width = 640;/* size.width; FIXME */    p_sys->height = fmt.video.i_height = 480;/* size.height; FIXME */    msg_Dbg( p_demux, "added new video es %4.4s %dx%d",            (char*)&fmt.i_codec, fmt.video.i_width, fmt.video.i_height );    p_sys->p_es_video = es_out_Add( p_demux->out, &fmt );    [input release];    [pool release];    msg_Dbg( p_demux, "QTCapture: We have a video device ready!" );    return VLC_SUCCESS;error:    [input release];    [pool release];    free( p_sys );    return VLC_EGENERIC;}/****************************************************************************** Close:*****************************************************************************/static void Close( vlc_object_t *p_this ){    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];    demux_t     *p_demux = (demux_t*)p_this;    demux_sys_t *p_sys = p_demux->p_sys;    /* Hack: if libvlc was killed, main interface thread was,     * and poor QTKit needs it, so don't tell him.     * Else we dead lock. */    if( vlc_object_alive(p_this->p_libvlc))    {        [p_sys->session stopRunning];        [p_sys->output release];        [p_sys->session release];    }    free( p_sys );    [pool release];}/****************************************************************************** Demux:*****************************************************************************/static int Demux( demux_t *p_demux ){    demux_sys_t *p_sys = p_demux->p_sys;    block_t *p_block;    p_block = block_New( p_demux, p_sys->width *                            p_sys->height * 2 /* FIXME */ );    if( !p_block )    {        msg_Err( p_demux, "cannot get block" );        return 0;    }    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];    @synchronized (p_sys->output)    {    p_block->i_pts = [p_sys->output copyCurrentFrameToBuffer: p_block->p_buffer];    }    if( !p_block->i_pts )    {        /* Nothing to display yet, just forget */        block_Release( p_block );        [pool release];        msleep( 10000 );        return 1;    }    es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block->i_pts );    es_out_Send( p_demux->out, p_sys->p_es_video, p_block );    [pool release];    return 1;}/****************************************************************************** Control:*****************************************************************************/static int Control( demux_t *p_demux, int i_query, va_list args ){    bool *pb;    int64_t    *pi64;    switch( i_query )    {        /* Special for access_demux */        case DEMUX_CAN_PAUSE:        case DEMUX_CAN_SEEK:        case DEMUX_SET_PAUSE_STATE:        case DEMUX_CAN_CONTROL_PACE:           pb = (bool*)va_arg( args, bool * );           *pb = false;           return VLC_SUCCESS;        case DEMUX_GET_PTS_DELAY:           pi64 = (int64_t*)va_arg( args, int64_t * );           *pi64 = (int64_t)DEFAULT_PTS_DELAY;           return VLC_SUCCESS;        default:           return VLC_EGENERIC;    }    return VLC_EGENERIC;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
婷婷夜色潮精品综合在线| 五月天一区二区| 麻豆精品国产91久久久久久| 欧美日韩亚洲综合在线 | 欧美一区二区久久| 亚洲第一福利一区| 91精品国产黑色紧身裤美女| 粉嫩欧美一区二区三区高清影视| 亚洲男人天堂av网| 日韩精品一区二区三区老鸭窝| 国内国产精品久久| 亚洲一区二区三区三| 久久久久88色偷偷免费| 91精品在线观看入口| 一本大道av一区二区在线播放| 极品美女销魂一区二区三区| 亚洲第一福利视频在线| 国产欧美精品日韩区二区麻豆天美| 欧美日韩一区精品| 在线欧美日韩精品| 91久久精品一区二区| 99精品国产99久久久久久白柏 | 成人免费看片app下载| 奇米777欧美一区二区| 一区二区三区中文字幕| 亚洲欧洲99久久| ●精品国产综合乱码久久久久| 日韩色视频在线观看| 日韩午夜激情免费电影| 欧美精品久久99久久在免费线 | 国产欧美日产一区| 国产日韩三级在线| 国产精品成人一区二区艾草 | 国产69精品久久99不卡| 国产一区二区三区四区五区美女| 久久精品999| 精东粉嫩av免费一区二区三区| 日韩国产欧美三级| 国产成人av自拍| 91免费视频观看| 欧美一区二区视频在线观看2020 | 日韩电影一区二区三区| 经典三级视频一区| 成人福利视频在线| 91.com视频| 欧美激情中文字幕一区二区| 亚洲人妖av一区二区| 奇米精品一区二区三区四区| 国产成人啪免费观看软件| 97久久精品人人爽人人爽蜜臀| 欧美日韩一区高清| 国产偷国产偷亚洲高清人白洁| 亚洲日穴在线视频| 精品一区二区三区av| 欧美视频一区二区三区四区| 欧美mv和日韩mv的网站| 亚洲一区二区黄色| 91在线观看地址| 国产蜜臀av在线一区二区三区| 亚洲123区在线观看| av在线这里只有精品| 欧美电影精品一区二区| 亚洲综合视频在线观看| 丁香六月久久综合狠狠色| 日韩午夜中文字幕| 日本美女一区二区| 日韩欧美亚洲一区二区| 亚洲va欧美va人人爽| 91免费观看在线| 中文字幕亚洲区| 91老师片黄在线观看| 亚洲欧美日韩一区二区| 色综合中文字幕国产| 日韩欧美国产1| 国产一区二区在线影院| 日韩欧美一级精品久久| 美女视频一区二区三区| 欧美一卡2卡3卡4卡| 青青草91视频| 久久久久久一级片| 99re热这里只有精品视频| 亚洲日本在线天堂| 欧美疯狂做受xxxx富婆| 国产一区不卡在线| 久久久久久久久久久久电影| 成人av小说网| 亚洲成人你懂的| 精品sm在线观看| 成+人+亚洲+综合天堂| 中文字幕字幕中文在线中不卡视频| 欧洲一区在线电影| 狠狠色丁香婷综合久久| 国产精品亲子伦对白| 欧美专区在线观看一区| 国产老女人精品毛片久久| 日本在线不卡视频| 亚洲欧美福利一区二区| 欧美成人aa大片| 色婷婷国产精品| 精品在线亚洲视频| 婷婷久久综合九色综合伊人色| 国产偷国产偷亚洲高清人白洁| 欧美三区在线观看| jizz一区二区| 精品一区二区在线播放| 亚洲va欧美va国产va天堂影院| 国产亚洲精品免费| 欧美一二区视频| 精品婷婷伊人一区三区三| 成人一区二区三区| 国产一区 二区| 九九九精品视频| 美女尤物国产一区| 麻豆成人在线观看| 日韩**一区毛片| 成人小视频在线观看| 国产精品一区二区三区99| 成人手机电影网| av激情综合网| av高清不卡在线| 91麻豆蜜桃一区二区三区| 99久久久久免费精品国产| 91香蕉视频黄| 欧美日韩中文字幕一区| 精品视频在线免费看| 欧美xxx久久| 国产亚洲综合在线| 亚洲桃色在线一区| 舔着乳尖日韩一区| 精品一二三四区| 色综合久久综合网97色综合| 在线观看日韩电影| 欧美精品一区二区三区四区| 中文字幕免费在线观看视频一区| 亚洲四区在线观看| 久久精品国产精品亚洲精品 | 久久综合丝袜日本网| 亚洲人成7777| 狠狠狠色丁香婷婷综合久久五月| 国产精品主播直播| 91行情网站电视在线观看高清版| 欧美日韩国产123区| 久久伊人蜜桃av一区二区| 一区二区三区丝袜| 国产一区二区三区四区在线观看| 91亚洲男人天堂| 久久影视一区二区| 亚洲综合色婷婷| www.一区二区| 欧美极品美女视频| 蜜臀久久99精品久久久画质超高清| 97国产一区二区| 国产欧美一区二区三区网站| 免费人成黄页网站在线一区二区| 91在线观看视频| 亚洲欧美日韩系列| 成人精品视频.| 欧美国产禁国产网站cc| 国产中文字幕精品| 精品国产青草久久久久福利| 亚洲v日本v欧美v久久精品| 91官网在线免费观看| 亚洲女人的天堂| yourporn久久国产精品| 综合av第一页| 欧美在线高清视频| 午夜精品久久一牛影视| 欧美亚洲综合在线| 亚洲午夜私人影院| 欧美伦理视频网站| 国产在线精品一区二区不卡了| 欧美军同video69gay| 日韩精彩视频在线观看| 欧美一卡2卡三卡4卡5免费| 精品在线免费视频| 国产婷婷色一区二区三区| 国产精品一区二区三区网站| 一区在线中文字幕| 666欧美在线视频| 久久99久久精品欧美| 亚洲欧洲美洲综合色网| 欧美三级乱人伦电影| 老司机精品视频线观看86| 久久久精品黄色| 欧美日本韩国一区| 成人爽a毛片一区二区免费| 亚洲一二三四在线| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 日韩一区二区精品在线观看| 国产成人免费在线| 久久草av在线| 亚洲国产精品一区二区www在线| 日韩亚洲欧美高清| 欧美亚洲动漫精品| 国产福利一区在线| 久久精品国产精品亚洲综合| 一区二区三区精密机械公司| 精品福利二区三区| 91精品免费在线| 欧美性猛交xxxx乱大交退制版 |