Skip to content

Commit

Permalink
Merge branch 'support_cocoapods'
Browse files Browse the repository at this point in the history
  • Loading branch information
Guoxweii committed Dec 26, 2014
1 parent ae0c320 commit 87ac1a0
Show file tree
Hide file tree
Showing 26 changed files with 286 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ project.xcworkspace
## my
tmp/*
libs/FFmpeg/*
output/*
## output/*
plan


Expand Down
19 changes: 19 additions & 0 deletions kxmovie.podspec
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
37 changes: 37 additions & 0 deletions output/KxAudioManager.h
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
132 changes: 132 additions & 0 deletions output/KxMovieDecoder.h
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
97 changes: 97 additions & 0 deletions output/KxMovieViewController.h
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
Binary file added output/kxmovie.bundle/music_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/kxmovie.bundle/playback_ff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/kxmovie.bundle/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/kxmovie.bundle/playback_next.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/kxmovie.bundle/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/kxmovie.bundle/playback_pause.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/kxmovie.bundle/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/kxmovie.bundle/playback_play.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/kxmovie.bundle/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/kxmovie.bundle/playback_prev.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/kxmovie.bundle/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/kxmovie.bundle/playback_rew.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/kxmovie.bundle/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/kxmovie.bundle/sliderthumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/kxmovie.bundle/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/libavcodec.a
Binary file not shown.
Binary file added output/libavformat.a
Binary file not shown.
Binary file added output/libavutil.a
Binary file not shown.
Binary file added output/libkxmovie.a
Binary file not shown.
Binary file added output/libswresample.a
Binary file not shown.
Binary file added output/libswscale.a
Binary file not shown.

0 comments on commit 87ac1a0

Please sign in to comment.