VKVideoDecoder Class Reference

Inherits from VKDecoder : VKQueue : NSObject
Declared in VKVideoDecoder.h

Overview

VKVideoDecoder is responsible for decoding video packets into video frames, queuing frames for AV syncing, and feeding OpenGL view with frames

– initWithFormatContext:codecContext:stream:streamId:manager:audioDecoder:

Initialize video decoder with AVCodecContext, AVStream, stream index, and audioIsOK parameters

- (id)initWithFormatContext:(AVFormatContext *)avFmtCtx codecContext:(AVCodecContext *)cdcCtx stream:(AVStream *)strm streamId:(NSInteger)sId manager:(id)manager audioDecoder:(VKAudioDecoder *)audioDecoder

Parameters

avFmtCtx

FFmpeg’s format I/O context

cdcCtx

FFmpeg’s codec I/O context

strm

FFmpeg’s Stream structure

sId

Stream index

manager

VKDecodeManager object

audioDecoder

VKAudioDecoder object to be used in AV sync algorithm

Return Value

VKVideoDecoder object

Declared In

VKVideoDecoder.h

– shutdown

Shutdown video decoder

- (void)shutdown

Declared In

VKVideoDecoder.h

– unlockQueues

Queues are interworking with eachother and uses wait mechanism for management, this methods unlocks all queues

- (void)unlockQueues

Declared In

VKVideoDecoder.h

– schedulePicture

A loop for refreshing screen with pictures

- (void)schedulePicture

Declared In

VKVideoDecoder.h

– onAudioDecoderDestroyed

Inform Video Decoder that Audio Decoder is destroyed

- (void)onAudioDecoderDestroyed

Declared In

VKVideoDecoder.h

– onStreamPaused

Inform Video Decoder that streaming/playing is paused

- (void)onStreamPaused

Declared In

VKVideoDecoder.h

– onAudioStreamCycled:

Inform Video Decoder that Audio stream is cycled/changed

- (void)onAudioStreamCycled:(VKAudioDecoder *)decoder

Parameters

decoder

VKAudioDecoder object should be set again in Video Decoder

Declared In

VKVideoDecoder.h

– setEOF:

Inform Video Decoder that it’s reached end of file

- (void)setEOF:(BOOL)value

Parameters

value

Specify YES for end of file is reached or NO for continue playing

Declared In

VKVideoDecoder.h

– decodeVideo

Start to decode video packets (This method needs to be called after a succesful connection)

- (int)decodeVideo

Declared In

VKVideoDecoder.h

– snapshot

Get snapshot of video frame in original size in UIImage format

- (UIImage *)snapshot

Return Value

UIImage object

Declared In

VKVideoDecoder.h

  decodeJobIsDone

A Boolean that indicates whether if the decode process is done not not, used for managing threads

@property (nonatomic, readonly) BOOL decodeJobIsDone

Declared In

VKVideoDecoder.h

  schedulePictureJobIsDone

A Boolean that indicates whether if the scheduling of picture process is done not not, used for managing threads

@property (nonatomic, readonly) BOOL schedulePictureJobIsDone

Declared In

VKVideoDecoder.h

  currentPos

Current byte position of AVPacket in stream, used for AV syncing

@property (nonatomic, readonly) int64_t currentPos

Declared In

VKVideoDecoder.h