转载自 http://blog.csdn.net/andy_jiangbin/article/details/19823333

拍照,摄像,载图总结

1 建立Session 

2 添加 input 

3 添加output 

4 开始捕捉

5 为用户显示当前录制状态

6 捕捉

7 结束捕捉

8 参考 

1 建立Session 

1.1 声明session 

AVCaptureSession *session = [[AVCaptureSession alloc] init];

// Add inputs and outputs.

[session startRunning];

1.2 设置采集的质量 

Symbol

Resolution

Comments

AVCaptureSessionPresetHigh

High

Highest recording quality.

This varies per device.

AVCaptureSessionPresetMedium

Medium

Suitable for WiFi sharing.

The actual values may change.

AVCaptureSessionPresetLow

Low

Suitable for 3G sharing.

The actual values may change.

AVCaptureSessionPreset640x480

640x480

VGA.

AVCaptureSessionPreset1280x720

1280x720

720p HD.

AVCaptureSessionPresetPhoto

Photo

Full photo resolution.

This is not supported for video output.

if ([session canSetSessionPreset:AVCaptureSessionPreset1280x720]) {

session.sessionPreset = AVCaptureSessionPreset1280x720;

}

else {

// Handle the failure.

}

1.3 重新设置session 

[session beginConfiguration];

// Remove an existing capture device.

// Add a new capture device.

// Reset the preset.

[session commitConfiguration];

添加input 

2.1 配置一个device (查找前后摄像头

NSArray *devices = [AVCaptureDevice devices];

for (AVCaptureDevice *device in devices) {

NSLog(@"Device name: %@", [device localizedName]);

if ([device hasMediaType:AVMediaTypeVideo]) {

if ([device position] == AVCaptureDevicePositionBack) {

NSLog(@"Device position : back");

}

else {

NSLog(@"Device position : front");

}

}

}

2.2 设备的前后切换 Switching Between Devices

AVCaptureSession *session = <#A capture session#>;

[session beginConfiguration];

[session removeInput:frontFacingCameraDeviceInput];

[session addInput:backFacingCameraDeviceInput];

[session commitConfiguration];

2.3 添加输入设备到当前session 

NSError *error;

AVCaptureDeviceInput *input =

[AVCaptureDeviceInput deviceInputWithDevice:device error:&error];

if (!input) {

// Handle the error appropriately.

}

AVCaptureSession *captureSession = <#Get a capture session#>;

AVCaptureDeviceInput *captureDeviceInput = <#Get a capture device input#>;

if ([captureSession canAddInput:captureDeviceInput]) {

[captureSession addInput:captureDeviceInput];

}

else {

// Handle the failure.

}

添加输出设备到session 

AVCaptureMovieFileOutput to
output to a movie file (输出一个 视频文件)

AVCaptureVideoDataOutput if
you want to process frames from the video being captured (可以采集数据从指定的视频中)

AVCaptureAudioDataOutput if
you want to process the audio data being captured (采集音频)

AVCaptureStillImageOutput if
you want to capture still images with accompanying metadata (采集静态图片)

3.1 添加一个output 到session 

AVCaptureSession *captureSession = <#Get a capture session#>;

AVCaptureMovieFileOutput *movieOutput = <#Create and configure a movie output#>;

if ([captureSession canAddOutput:movieOutput]) {

[captureSession addOutput:movieOutput];

}

else {

// Handle the failure.

}

3.2 保存视频到文件  Saving to a Movie File

3.2.1 声明一个输出

AVCaptureMovieFileOutput *aMovieFileOutput = [[AVCaptureMovieFileOutput alloc] init];

CMTime maxDuration = <#Create a CMTime to represent the maximum duration#>;

aMovieFileOutput.maxRecordedDuration = maxDuration;

aMovieFileOutput.minFreeDiskSpaceLimit
= <#An appropriate minimum given the quality of the movie format and
the duration#>;

3.2.2 配置写到指定的文件

AVCaptureMovieFileOutput *aMovieFileOutput = <#Get a movie file output#>;

NSURL *fileURL = <#A file URL that identifies the output location#>;

[aMovieFileOutput startRecordingToOutputFileURL:fileURL recordingDelegate:<#The delegate#>];

3.2.3 确定文件是否写成功

captureOutput:didFinishRecordingToOutputFileAtURL:fromConnections:error:  实现这个方法

- (void)captureOutput:(AVCaptureFileOutput *)captureOutput

didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL

fromConnections:(NSArray *)connections

error:(NSError *)error {

BOOL recordedSuccessfully = YES;

if ([error code] != noErr) {

// A problem occurred: Find out if the recording was successful.

id value = [[error userInfo] objectForKey:AVErrorRecordingSuccessfullyFinishedKey];

if (value) {

recordedSuccessfully = [value boolValue];

}

}

// Continue as appropriate...

3.3 对采集载图

3.3.1 设置采集图片的像素格式 

说实话下面这段的像素格式我也似懂非懂, 感觉是不是像素的对像素的质量会有一些影响

You can use the videoSettings property
to specify a custom output format. The video settings property is a dictionary; currently, the only supported key is kCVPixelBufferPixelFormatTypeKey.
The recommended pixel format choices for iPhone 4 arekCVPixelFormatType_420YpCbCr8BiPlanarVideoRange or kCVPixelFormatType_32BGRA;
for iPhone 3G the recommended pixel format choices arekCVPixelFormatType_422YpCbCr8 or kCVPixelFormatType_32BGRA.
Both Core Graphics and OpenGL work well with the BGRA format:

// Create a VideoDataOutput and add it to the session

AVCaptureVideoDataOutput *output = [[[AVCaptureVideoDataOutput alloc] init] autorelease];

[session addOutput:output];

// Configure your output.

dispatch_queue_t queue = dispatch_queue_create("myQueue", NULL);

[output setSampleBufferDelegate:self queue:queue];

dispatch_release(queue);

// Specify the pixel format

output.videoSettings =

[NSDictionary dictionaryWithObject:

[NSNumber numberWithInt:kCVPixelFormatType_32BGRA]

forKey:(id)kCVPixelBufferPixelFormatTypeKey];

3.3.2 采集静态图片

AVCaptureStillImageOutput  这个类可以采集静态图片。

Preset

iPhone 3G

iPhone 3GS

iPhone 4 (Back)

iPhone 4 (Front)

High

400x304

640x480

1280x720

640x480

Medium

400x304

480x360

480x360

480x360

Low

400x304

192x144

192x144

192x144

640x480

N/A

640x480

640x480

640x480

1280x720

N/A

N/A

1280x720

N/A

Photo

1600x1200

2048x1536

2592x1936

640x480

Pixel and Encoding Formats

Different devices support different image formats:

iPhone 3G

iPhone 3GS

iPhone 4

yuvs, 2vuy, BGRA, jpeg

420f, 420v, BGRA, jpeg

420f, 420v, BGRA, jpeg

可以自己指定想要捕捉的格式, 下面就可以指定捕捉一个JPEG的图片

AVCaptureStillImageOutput *stillImageOutput = [[AVCaptureStillImageOutput alloc] init];

NSDictionary *outputSettings = @{ AVVideoCodecKey : AVVideoCodecJPEG};

[stillImageOutput setOutputSettings:outputSettings];

如果使用JPEG图片格式, 就不应该再指定其它的压缩了, output 会自动压缩, 这个压缩会使用硬件加速。 而我们要使用这个图片数据时。 可以使用jpegStillImageNSDataRepresentation: 这个方法来获取相应的NSData,这个方法不会做重复压缩的动作。

jpegStillImageNSDataRepresentation:

Returns an NSData representation of a still image data and metadata attachments in a JPEG sample buffer.

+ (NSData *)jpegStillImageNSDataRepresentation:(CMSampleBufferRef)jpegSampleBuffer

Parameters

jpegSampleBuffer

The sample buffer carrying JPEG image data, optionally with Exif metadata sample buffer attachments.

This method throws an NSInvalidArgumentException if
jpegSampleBuffer is NULL or not in the JPEG format.

Return Value

An NSData representation of jpegSampleBuffer.

Discussion

This method merges the image data and Exif metadata sample buffer attachments without re-compressing the image.

The returned NSData object is suitable for writing to disk.

捕捉图片 Capturing an Image

When you want to capture an image, you send the output a captureStillImageAsynchronouslyFromConnection:completionHandler: message.

The first argument is the connection you want to use for the capture.
You need to look for the connection whose input port is collecting
video:

AVCaptureConnection *videoConnection = nil;

for (AVCaptureConnection *connection in stillImageOutput.connections) {

for (AVCaptureInputPort *port in [connection inputPorts]) {

if ([[port mediaType] isEqual:AVMediaTypeVideo] ) {

videoConnection = connection;

break;

}

}

if (videoConnection) { break; }

}

The second argument to captureStillImageAsynchronouslyFromConnection:completionHandler: is a block that
takes two arguments: a CMSampleBuffer containing the image
data, and an error. The sample buffer itself may contain metadata, such
as an Exif dictionary, as an attachment. You can modify the attachments
should you want, but note the optimization for JPEG images discussed
in “Pixel
and Encoding Formats.”

[stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler:

^(CMSampleBufferRef imageSampleBuffer, NSError *error) {

CFDictionaryRef exifAttachments =

CMGetAttachment(imageSampleBuffer, kCGImagePropertyExifDictionary, NULL);

if (exifAttachments) {

// Do something with the attachments.

}

// Continue as appropriate.

}];

5 为用户显示当前的录制状态

5.1 录制预览

AVCaptureSession *captureSession = <#Get a capture session#>;

CALayer *viewLayer = <#Get a layer from the view in which you want to present the preview#>;

AVCaptureVideoPreviewLayer *captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:captureSession];

[viewLayer addSublayer:captureVideoPreviewLayer];

Video Gravity Modes

The preview layer supports three gravity modes that you set using videoGravity:

6 捕捉

下面是一个完整的过程

Putting it all Together: Capturing Video Frames as UIImage Objects

This brief code example to illustrates how you can capture video and convert the frames you get to UIImage objects. It shows you how to:

Note: To focus on the most relevant code, this example
omits several aspects of a complete application, including memory
management. To use AV Foundation, you are expected to have enough
experience with Cocoa to be able to infer the missing
pieces.

Create and Configure a Capture Session

You use an AVCaptureSession object

to coordinate the flow of data from an AV input device to an output.
Create a session, and configure it to produce medium resolution video
frames.

AVCaptureSession *session = [[AVCaptureSession alloc] init];

session.sessionPreset = AVCaptureSessionPresetMedium;

Create and Configure the Device and Device Input

Capture devices are represented by AVCaptureDevice objects;

the class provides methods to retrieve an object for the input type you
want. A device has one or more ports, configured using an AVCaptureInput object.
Typically, you use the capture input in its default configuration.

Find a video capture device, then create a device input with the device and add it to the session.

AVCaptureDevice *device =

[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];

NSError *error = nil;

AVCaptureDeviceInput *input =

[AVCaptureDeviceInput deviceInputWithDevice:device error:&error];

if (!input) {

// Handle the error appropriately.

}

[session addInput:input];

Create and Configure the Data Output

You use an AVCaptureVideoDataOutput object

to process uncompressed frames from the video being captured. You
typically configure several aspects of an output. For video, for
example, you can specify the pixel format using the videoSettings property,
and cap the frame rate by setting the minFrameDuration property.

Create and configure an output for video data and add it to the session; cap the frame rate to 15 fps by setting the minFrameDuration property to 1/15 second:

AVCaptureVideoDataOutput *output = [[AVCaptureVideoDataOutput alloc] init];

[session addOutput:output];

output.videoSettings =

@{ (NSString *)kCVPixelBufferPixelFormatTypeKey : @(kCVPixelFormatType_32BGRA) };

output.minFrameDuration = CMTimeMake(1, 15);

The data output object uses delegation to vend the video frames. The delegate must adopt the AVCaptureVideoDataOutputSampleBufferDelegateprotocol.
When you set the data output’s delegate, you must also provide a queue on which callbacks should be invoked.

dispatch_queue_t queue = dispatch_queue_create("MyQueue", NULL);

[output setSampleBufferDelegate:self queue:queue];

dispatch_release(queue);

You use the queue to modify the priority given to delivering and processing the video frames.

Implement the Sample Buffer Delegate Method

In the delegate class, implement the method (captureOutput:didOutputSampleBuffer:fromConnection:)
that is called when a sample buffer is written. The video data output
object delivers frames as CMSampleBuffers, so you need to convert from
the CMSampleBuffer to a UIImageobject. The function for this operation
is shown in “Converting
a CMSampleBuffer to a UIImage.”

- (void)captureOutput:(AVCaptureOutput *)captureOutput

didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer

fromConnection:(AVCaptureConnection *)connection {

UIImage *image = imageFromSampleBuffer(sampleBuffer);

// Add your code here that uses the image.

}

Remember that the delegate method is invoked on the queue you specified in setSampleBufferDelegate:queue:;
if you want to update the user interface, you must invoke any relevant code on the main thread.

Starting and Stopping Recording

After configuring the capture session, you send it a startRunning message
to start the recording.

[session startRunning];

To stop recording, you send the session a stopRunning message.

DEMO Code

这个demo 运行时出了一个问题,- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer 
      fromConnection:(AVCaptureConnection *)connection 里载到图后把图片转换为UIImage后转出来后怎么都不显示图片, 经查后直接转为NSData传出来后一切正常,
特别说明一下。 

// Create and configure a capture session and start it running

- (void)setupCaptureSession

{

NSError *error = nil;

// Create the session

AVCaptureSession *session = [[AVCaptureSession alloc] init];

// Configure the session to produce lower resolution video frames, if your

// processing algorithm can cope. We'll specify medium quality for the

// chosen device.

session.sessionPreset = AVCaptureSessionPresetLow;

// Find a suitable AVCaptureDevice

AVCaptureDevice *device = [AVCaptureDevice

defaultDeviceWithMediaType:AVMediaTypeVideo];

// Create a device input with the device and add it to the session.

AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device

error:&error];

if (!input) {

// Handling the error appropriately.

}

[session addInput:input];

// Create a VideoDataOutput and add it to the session

AVCaptureVideoDataOutput *output = [[[AVCaptureVideoDataOutput alloc] init] autorelease];

[session addOutput:output];

// Configure your output.

dispatch_queue_t queue = dispatch_queue_create("myQueue", NULL);

[output setSampleBufferDelegate:self queue:queue];

dispatch_release(queue);

// Specify the pixel format

output.videoSettings =

[NSDictionary dictionaryWithObject:

[NSNumber numberWithInt:kCVPixelFormatType_32BGRA]

forKey:(id)kCVPixelBufferPixelFormatTypeKey];

// 添加界面显示

AVCaptureVideoPreviewLayer *previewLayer = nil;

previewLayer = [[[AVCaptureVideoPreviewLayer alloc] initWithSession:session] autorelease];

[previewLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill];

CGRect layerRect = [[[self view] layer] bounds];

[previewLayer setBounds:layerRect];

[previewLayer setPosition:CGPointMake(CGRectGetMidX(layerRect),CGRectGetMidY(layerRect))];

[[[self view] layer] addSublayer:previewLayer];

// If you wish to cap the frame rate to a known value, such as 15 fps, set

// minFrameDuration.

//    output.minFrameDuration = CMTimeMake(1, 15);

// Start the session running to start the flow of data

[session startRunning];

sessionGlobal = session;

// Assign session to an ivar.

//  [self setSession:session];

isCapture = FALSE;

UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 300)];

v.backgroundColor = [UIColor blueColor];

v.layer.masksToBounds = YES;

v1 = [v retain];

[self.view addSubview:v];

// [v release];

start = [[NSDate date] timeIntervalSince1970];

before = start;

num = 0;

}

(NSTimeInterval)getTimeFromStart

{

NSDate* dat = [NSDate dateWithTimeIntervalSinceNow:0];

NSTimeInterval now = [dat timeIntervalSince1970]*1;

NSTimeInterval b = now - start;

return b;

}

- (void)showImage:(NSData *)topImageData

{

if(num > 5)

{

[sessionGlobal stopRunning];

return;

}

num ++;

NSString *numStr = [NSString stringWithFormat:@"%d.jpg", num];

NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:numStr];

NSLog(@"PATH : %@", path);

[topImageData writeToFile:path atomically:YES];

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];

imageView.layer.masksToBounds = YES;

imageView.backgroundColor = [UIColor redColor];

UIImage *img = [[UIImage alloc] initWithData:topImageData];

imageView.image = img;

[img release];

[self.view addSubview:imageView];

[imageView release];

[self.view setNeedsDisplay];

//    [v1 setNeedsDisplay];

}

// Delegate routine that is called when a sample buffer was written

- (void)captureOutput:(AVCaptureOutput *)captureOutput

didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer

fromConnection:(AVCaptureConnection *)connection

{

NSDate* dat = [NSDate dateWithTimeIntervalSinceNow:0];

NSTimeInterval now = [dat timeIntervalSince1970]*1;

NSLog(@" before: %f  num: %f" , before,
now - before);

if((now - before) > 5)

{

before = [[NSDate date] timeIntervalSince1970];

// Create a UIImage from the sample buffer data

UIImage *image = [self imageFromSampleBuffer:sampleBuffer];

if(image != nil)

{ //            NSTimeInterval t = [self getTimeFromStart];

NSData* topImageData = UIImageJPEGRepresentation(image, 1.0);

[self performSelectorOnMainThread:@selector(showImage:) withObject:topImageData waitUntilDone:NO];

}

}

}

// Create a UIImage from sample buffer data

- (UIImage *) imageFromSampleBuffer:(CMSampleBufferRef) sampleBuffer

{

CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);

// Lock the base address of the pixel buffer

CVPixelBufferLockBaseAddress(imageBuffer,0);

// Get the number of bytes per row for the pixel buffer

size_t bytesPerRow = CVPixelBufferGetBytesPerRow(imageBuffer);

// Get the pixel buffer width and height

size_t width = CVPixelBufferGetWidth(imageBuffer);

size_t height = CVPixelBufferGetHeight(imageBuffer);

// Create a device-dependent RGB color space

CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();

if (!colorSpace)

{

NSLog(@"CGColorSpaceCreateDeviceRGB failure");

return nil;

}

// Get the base address of the pixel buffer

void *baseAddress = CVPixelBufferGetBaseAddress(imageBuffer);

// Get the data size for contiguous planes of the pixel buffer.

size_t bufferSize = CVPixelBufferGetDataSize(imageBuffer);

// Create a Quartz direct-access data provider that uses data we supply

CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, baseAddress, bufferSize,

NULL);

// Create a bitmap image from data supplied by our data provider

CGImageRef cgImage =

CGImageCreate(width,

height,

8,

32,

bytesPerRow,

colorSpace,

kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Little,

provider,

NULL,

true,

kCGRenderingIntentDefault);

CGDataProviderRelease(provider);

CGColorSpaceRelease(colorSpace);

// Create and return an image object representing the specified Quartz image

UIImage *image = [UIImage imageWithCGImage:cgImage];

CGImageRelease(cgImage);

CVPixelBufferUnlockBaseAddress(imageBuffer, 0);

return image;

}

7 结束捕捉 

- (void)stopVideoCapture:(id)arg

{

//停止摄像头捕抓

if(self->avCaptureSession){

[self->avCaptureSession stopRunning];

self->avCaptureSession= nil;

[labelStatesetText:@"Video capture stopped"];

}

8 参考

xcode 自带文档 Media Capture

比较完整的捕捉代码 http://chenweihuacwh.iteye.com/blog/734229

随便找的2个

http://blog.csdn.net/guo_hongjun1611/article/details/7992294

http://blog.csdn.net/xiaobingbing/article/details/6012798

自定义使用AVCaptureSession 拍照,摄像,载图的更多相关文章

  1. AVCaptureSession拍照,摄像,载图总结

    AVCaptureSession [IOS开发]拍照,摄像,载图总结 1 建立Session  2 添加 input  3 添加output  4 开始捕捉 5 为用户显示当前录制状态 6 捕捉 7 ...

  2. 如何用uniapp+vue开发自定义相机插件——拍照+录像功能

    调用手机的相机功能并实现拍照和录像是很多APP与插件都必不可少的一个功能,今天智密科技就来分享一下如何基于uniapp + vue实现自定义相机界面,并且实现: 1: 自定义拍照 2: 自定义录像 3 ...

  3. 仿百度壁纸客户端(二)——主页自定义ViewPager广告定时轮播图

    仿百度壁纸客户端(二)--主页自定义ViewPager广告定时轮播图 百度壁纸系列 仿百度壁纸客户端(一)--主框架搭建,自定义Tab + ViewPager + Fragment 仿百度壁纸客户端( ...

  4. Android Camera开发系列(下)——自定义Camera实现拍照查看图片等功能

    Android Camera开发系列(下)--自定义Camera实现拍照查看图片等功能 Android Camera开发系列(上)--Camera的基本调用与实现拍照功能以及获取拍照图片加载大图片 上 ...

  5. [MISSAJJ原创]cell内 通过SDWebImage自定义创建动态菊花加载指示器

    最后更新已经放到了github上了 MISSAJJ自己写的一个基于SDWebImage自定义的管理网络图片加载的工具类(普通图片加载,渐现Alpha图片加载,菊花Indicator动画加载) 经常在项 ...

  6. iOS Swift WisdomScanKit二维码扫码SDK,自定义全屏拍照SDK,系统相册图片浏览,编辑SDK

    iOS Swift WisdomScanKit 是一款强大的集二维码扫码,自定义全屏拍照,系统相册图片编辑多选和系统相册图片浏览功能于一身的 Framework SDK [1]前言:    今天给大家 ...

  7. Android—实现自定义相机倒计时拍照

    这篇博客为大家介绍Android自定义相机,并且实现倒计时拍照功能 首先自定义拍照会用到SurfaceView控件显示照片的预览区域,以下是布局文件: 两个TextView是用来显示提示信息和倒计时的 ...

  8. android99 拍照摄像

    package com.itheima.camera; import java.io.File; import android.net.Uri; import android.os.Bundle; i ...

  9. JQuery自定义插件详解之Banner图滚动插件

      前  言 JRedu JQuery是什么相信已经不需要详细介绍了.作为时下最火的JS库之一,JQuery将其"Write Less,Do More!"的口号发挥的极致.而帮助J ...

随机推荐

  1. 爬虫技术(五)-- 模拟简单浏览器(附c#代码)

    由于最近在做毕业设计,需要用到一些简单的浏览器功能,于是学习了一下,顺便写篇博客~~大牛请勿喷,菜鸟练练手~ 实现界面如下:(简单朴素版@_@||) button_go实现如下: private vo ...

  2. poj 2411 Mondriaan's Dream(状态压缩dP)

    题目:http://poj.org/problem?id=2411 Input The input contains several test cases. Each test case is mad ...

  3. HDU 2586 + HDU 4912 最近公共祖先

    先给个LCA模板 HDU 1330(LCA模板) #include <cstdio> #include <cstring> #define N 40005 struct Edg ...

  4. 数据库锁机制(一)——概述

    注:内容为自己的推理认知+网络,如有错误和不合理之处,敬请指出. 在多线程环境中我用使用线程锁处理并发问题,而在数据库系统中,并发问题可以细化到事务级别,而DBMS对此的处理方案就是使用锁. 为了适应 ...

  5. bzoj1934: [Shoi2007]Vote 善意的投票

    最大流..建图方式都是玄学啊.. //Dinic是O(n2m)的. #include<cstdio> #include<cstring> #include<cctype& ...

  6. powerScript脚本

    一.powerScript的语法 1.0变量的命名及使用 powerscript的标识符(变量名称)必须以字母或下划线开头,其它的字符可以是下划线(_).短横线(-).美元符号($).号码符号(#) ...

  7. H.264中NAL、Slice与frame意思及相互关系

    H.264中NAL.Slice与frame意思及相互关系 NAL nal_unit_type中的1(非IDR图像的编码条带).2(编码条带数据分割块A).3(编码条带数据分割块B).4(编码条带数据分 ...

  8. uva 11768

    // 扩展欧几里得算法 // 先求出一个解 再求出区间 [x1,x2]有几个整数符合条件// 需要注意的是 水平和垂直2种情况的处理 还有正数和负数取整的细微差别#include <iostre ...

  9. Delphi 2010

    Delphi 2010已早由Embarcadero公司发布.作者Kim Madsen作为一名资深的Delphi开发者,在他的博客中谈到了Delphi 2010的新性能.它的使用感受以及对Delphi语 ...

  10. Objective-C异步编程

    1. 不要阻塞主线程 不管在进行iOS还是OS X开发中,主线程都只应该处理用户交互和界面布局,好的程序通常能够随时快速响应用户的操作,所以CPU密集型或者会阻塞线程的代码应该在其他位置去执行,我指的 ...