-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
286 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ project.xcworkspace | |
## my | ||
tmp/* | ||
libs/FFmpeg/* | ||
output/* | ||
## output/* | ||
plan | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Pod::Spec.new do |s| | ||
s.name = "kxmovie" | ||
s.version = "0.0.1" | ||
s.summary = "kxmovie for vcam." | ||
|
||
s.homepage = "https://github.com/littleluren/kxmovie" | ||
s.license = "MIT" | ||
s.author = { "gxw" => "[email protected]" } | ||
s.platform = :ios, "7.0" | ||
s.source = { :git => "https://github.com/littleluren/kxmovie.git" } | ||
|
||
s.source_files = "output", "output/*.{h,m}" | ||
s.resources = "output/kxmovie.bundle/*.png" | ||
s.public_header_files = "output/*.h" | ||
|
||
s.frameworks = "MediaPlayer", "CoreAudio", "AudioToolbox", "Accelerate", "QuartzCore", "OpenGLES" | ||
s.ios.libraries = "z", "iconv" | ||
s.vendored_libraries = "output/libkxmovie.a", "output/libavcodec.a", "output/libavformat.a", "output/libavutil.a", "output/libswscale.a", "output/libswresample.a" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// KxAudioManager.h | ||
// kxmovie | ||
// | ||
// Created by Kolyvan on 23.10.12. | ||
// Copyright (c) 2012 Konstantin Boukreev . All rights reserved. | ||
// | ||
// https://github.com/kolyvan/kxmovie | ||
// this file is part of KxMovie | ||
// KxMovie is licenced under the LGPL v3, see lgpl-3.0.txt | ||
|
||
|
||
#import <CoreFoundation/CoreFoundation.h> | ||
|
||
typedef void (^KxAudioManagerOutputBlock)(float *data, UInt32 numFrames, UInt32 numChannels); | ||
|
||
@protocol KxAudioManager <NSObject> | ||
|
||
@property (readonly) UInt32 numOutputChannels; | ||
@property (readonly) Float64 samplingRate; | ||
@property (readonly) UInt32 numBytesPerSample; | ||
@property (readonly) Float32 outputVolume; | ||
@property (readonly) BOOL playing; | ||
@property (readonly, strong) NSString *audioRoute; | ||
|
||
@property (readwrite, copy) KxAudioManagerOutputBlock outputBlock; | ||
|
||
- (BOOL) activateAudioSession; | ||
- (void) deactivateAudioSession; | ||
- (BOOL) play; | ||
- (void) pause; | ||
|
||
@end | ||
|
||
@interface KxAudioManager : NSObject | ||
+ (id<KxAudioManager>) audioManager; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
// | ||
// KxMovieDecoder.h | ||
// kxmovie | ||
// | ||
// Created by Kolyvan on 15.10.12. | ||
// Copyright (c) 2012 Konstantin Boukreev . All rights reserved. | ||
// | ||
// https://github.com/kolyvan/kxmovie | ||
// this file is part of KxMovie | ||
// KxMovie is licenced under the LGPL v3, see lgpl-3.0.txt | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <CoreGraphics/CoreGraphics.h> | ||
|
||
extern NSString * kxmovieErrorDomain; | ||
|
||
typedef enum { | ||
|
||
kxMovieErrorNone, | ||
kxMovieErrorOpenFile, | ||
kxMovieErrorStreamInfoNotFound, | ||
kxMovieErrorStreamNotFound, | ||
kxMovieErrorCodecNotFound, | ||
kxMovieErrorOpenCodec, | ||
kxMovieErrorAllocateFrame, | ||
kxMovieErroSetupScaler, | ||
kxMovieErroReSampler, | ||
kxMovieErroUnsupported, | ||
|
||
} kxMovieError; | ||
|
||
typedef enum { | ||
|
||
KxMovieFrameTypeAudio, | ||
KxMovieFrameTypeVideo, | ||
KxMovieFrameTypeArtwork, | ||
KxMovieFrameTypeSubtitle, | ||
|
||
} KxMovieFrameType; | ||
|
||
typedef enum { | ||
|
||
KxVideoFrameFormatRGB, | ||
KxVideoFrameFormatYUV, | ||
|
||
} KxVideoFrameFormat; | ||
|
||
@interface KxMovieFrame : NSObject | ||
@property (readonly, nonatomic) KxMovieFrameType type; | ||
@property (readonly, nonatomic) CGFloat position; | ||
@property (readonly, nonatomic) CGFloat duration; | ||
@end | ||
|
||
@interface KxAudioFrame : KxMovieFrame | ||
@property (readonly, nonatomic, strong) NSData *samples; | ||
@end | ||
|
||
@interface KxVideoFrame : KxMovieFrame | ||
@property (readonly, nonatomic) KxVideoFrameFormat format; | ||
@property (readonly, nonatomic) NSUInteger width; | ||
@property (readonly, nonatomic) NSUInteger height; | ||
@end | ||
|
||
@interface KxVideoFrameRGB : KxVideoFrame | ||
@property (readonly, nonatomic) NSUInteger linesize; | ||
@property (readonly, nonatomic, strong) NSData *rgb; | ||
- (UIImage *) asImage; | ||
@end | ||
|
||
@interface KxVideoFrameYUV : KxVideoFrame | ||
@property (readonly, nonatomic, strong) NSData *luma; | ||
@property (readonly, nonatomic, strong) NSData *chromaB; | ||
@property (readonly, nonatomic, strong) NSData *chromaR; | ||
@end | ||
|
||
@interface KxArtworkFrame : KxMovieFrame | ||
@property (readonly, nonatomic, strong) NSData *picture; | ||
- (UIImage *) asImage; | ||
@end | ||
|
||
@interface KxSubtitleFrame : KxMovieFrame | ||
@property (readonly, nonatomic, strong) NSString *text; | ||
@end | ||
|
||
typedef BOOL(^KxMovieDecoderInterruptCallback)(); | ||
|
||
@interface KxMovieDecoder : NSObject | ||
|
||
@property (readonly, nonatomic, strong) NSString *path; | ||
@property (readonly, nonatomic) BOOL isEOF; | ||
@property (readwrite,nonatomic) CGFloat position; | ||
@property (readonly, nonatomic) CGFloat duration; | ||
@property (readonly, nonatomic) CGFloat fps; | ||
@property (readonly, nonatomic) CGFloat sampleRate; | ||
@property (readonly, nonatomic) NSUInteger frameWidth; | ||
@property (readonly, nonatomic) NSUInteger frameHeight; | ||
@property (readonly, nonatomic) NSUInteger audioStreamsCount; | ||
@property (readwrite,nonatomic) NSInteger selectedAudioStream; | ||
@property (readonly, nonatomic) NSUInteger subtitleStreamsCount; | ||
@property (readwrite,nonatomic) NSInteger selectedSubtitleStream; | ||
@property (readonly, nonatomic) BOOL validVideo; | ||
@property (readonly, nonatomic) BOOL validAudio; | ||
@property (readonly, nonatomic) BOOL validSubtitles; | ||
@property (readonly, nonatomic, strong) NSDictionary *info; | ||
@property (readonly, nonatomic, strong) NSString *videoStreamFormatName; | ||
@property (readonly, nonatomic) BOOL isNetwork; | ||
@property (readonly, nonatomic) CGFloat startTime; | ||
@property (readwrite, nonatomic) BOOL disableDeinterlacing; | ||
@property (readwrite, nonatomic, strong) KxMovieDecoderInterruptCallback interruptCallback; | ||
|
||
+ (id) movieDecoderWithContentPath: (NSString *) path | ||
error: (NSError **) perror; | ||
|
||
- (BOOL) openFile: (NSString *) path | ||
error: (NSError **) perror; | ||
|
||
-(void) closeFile; | ||
|
||
- (BOOL) setupVideoFrameFormat: (KxVideoFrameFormat) format; | ||
|
||
- (NSArray *) decodeFrames: (CGFloat) minDuration; | ||
|
||
@end | ||
|
||
@interface KxMovieSubtitleASSParser : NSObject | ||
|
||
+ (NSArray *) parseEvents: (NSString *) events; | ||
+ (NSArray *) parseDialogue: (NSString *) dialogue | ||
numFields: (NSUInteger) numFields; | ||
+ (NSString *) removeCommandsFromEventText: (NSString *) text; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// | ||
// ViewController.h | ||
// kxmovieapp | ||
// | ||
// Created by Kolyvan on 11.10.12. | ||
// Copyright (c) 2012 Konstantin Boukreev . All rights reserved. | ||
// | ||
// https://github.com/kolyvan/kxmovie | ||
// this file is part of KxMovie | ||
// KxMovie is licenced under the LGPL v3, see lgpl-3.0.txt | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@class KxMovieDecoder; | ||
#import <MediaPlayer/MediaPlayer.h> | ||
#import <QuartzCore/QuartzCore.h> | ||
#import "KxMovieDecoder.h" | ||
#import "KxAudioManager.h" | ||
|
||
extern NSString * const KxMovieParameterMinBufferedDuration; // Float | ||
extern NSString * const KxMovieParameterMaxBufferedDuration; // Float | ||
extern NSString * const KxMovieParameterDisableDeinterlacing; // BOOL | ||
|
||
@interface KxMovieViewController : UIViewController<UITableViewDataSource, UITableViewDelegate> { | ||
KxMovieDecoder *_decoder; | ||
dispatch_queue_t _dispatchQueue; | ||
NSMutableArray *_videoFrames; | ||
NSMutableArray *_audioFrames; | ||
NSMutableArray *_subtitles; | ||
NSData *_currentAudioFrame; | ||
NSUInteger _currentAudioFramePos; | ||
CGFloat _moviePosition; | ||
BOOL _disableUpdateHUD; | ||
NSTimeInterval _tickCorrectionTime; | ||
NSTimeInterval _tickCorrectionPosition; | ||
NSUInteger _tickCounter; | ||
BOOL _fullscreen; | ||
BOOL _hiddenHUD; | ||
BOOL _fitMode; | ||
BOOL _infoMode; | ||
BOOL _restoreIdleTimer; | ||
BOOL _interrupted; | ||
|
||
UIImageView *_imageView; | ||
UIView *_topHUD; | ||
UIToolbar *_topBar; | ||
UIToolbar *_bottomBar; | ||
UISlider *_progressSlider; | ||
|
||
UIBarButtonItem *_playBtn; | ||
UIBarButtonItem *_pauseBtn; | ||
UIBarButtonItem *_rewindBtn; | ||
UIBarButtonItem *_fforwardBtn; | ||
UIBarButtonItem *_spaceItem; | ||
UIBarButtonItem *_fixedSpaceItem; | ||
|
||
UIButton *_doneButton; | ||
UILabel *_progressLabel; | ||
UILabel *_leftLabel; | ||
UITableView *_tableView; | ||
UIActivityIndicatorView *_activityIndicatorView; | ||
UILabel *_subtitlesLabel; | ||
|
||
UITapGestureRecognizer *_tapGestureRecognizer; | ||
UITapGestureRecognizer *_doubleTapGestureRecognizer; | ||
UIPanGestureRecognizer *_panGestureRecognizer; | ||
|
||
#ifdef DEBUG | ||
UILabel *_messageLabel; | ||
NSTimeInterval _debugStartTime; | ||
NSUInteger _debugAudioStatus; | ||
NSDate *_debugAudioStatusTS; | ||
#endif | ||
|
||
CGFloat _bufferedDuration; | ||
CGFloat _minBufferedDuration; | ||
CGFloat _maxBufferedDuration; | ||
BOOL _buffered; | ||
|
||
BOOL _savedIdleTimer; | ||
|
||
NSDictionary *_parameters; | ||
} | ||
|
||
+ (id) movieViewControllerWithContentPath: (NSString *) path | ||
parameters: (NSDictionary *) parameters; | ||
|
||
@property (readwrite) BOOL playing; | ||
@property (readwrite) BOOL decoding; | ||
@property (readwrite, strong) UIButton *infoButton; | ||
@property (readwrite, strong) KxArtworkFrame *artworkFrame; | ||
|
||
- (void) play; | ||
- (void) pause; | ||
|
||
|
||
@end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.