Skip to content

Commit

Permalink
Merge branch 'master' of github.com:qiniu/qplayer-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
jinbangfei committed May 23, 2017
2 parents be333e9 + ab2ae5b commit 7378a90
Show file tree
Hide file tree
Showing 15 changed files with 323 additions and 74 deletions.
Binary file modified ios/bin/corePlayer.ipa
Binary file not shown.
109 changes: 109 additions & 0 deletions ios/include/qcAna.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*******************************************************************************
File: qcAna.h
Contains: qc player analytics define header file.
Written by: Bangfei Jin
Change History (most recent first):
2017-04-22 Bangfei Create file
*******************************************************************************/
#ifndef __QCANA_H__
#define __QCANA_H__

// General device info
typedef struct
{
char szDeviceID[64]; /*!< device unique ID */
char szAppID[64]; /*!< application unique ID */
char szAppFamily[64]; /*!< for example company name of appication */
char szAppVersion[64]; /*!< application version */
char szDeviceIP[64]; /*!< IP address of device. IPV4. To obtain region? */
char szDeviceFamily[64]; /*!< device family. Phone, Pad, Desktop... */
char szOSFamily[32]; /*!< OS family. iOS, Android, Windows, macOS */
char szOSVersion[16]; /*!< OS version. "6.0" */
char szPlayerVersion[16]; /*!< corePlayer SDK version */
int nScreenWidth; /*!< width of device screen */
int nScreenHeight; /*!< height of device screen */
} QCANA_DEVICE_INFO;

// General source info
typedef struct
{
char szURL[1024]; /*!< the URL of current stream */
char szFormat[16]; /*!< format of resource, m3u8, mp4 */
long long llDuration; /*!< duration of resource, 0 is live stream */
int nVideoCodec; /*!< video codec, refer to QCCodecID */
int nAudioCodec; /*!< audio codec, refer to QCCodecID */
int nBitrate; /*!< video bitrate */
int nWidth; /*!< width of video */
int nHeight; /*!< height of video */
int nLiveStream; /*!< stream type, 0 is VOD, 1 is live */
} QCANA_SOURCE_INFO;

typedef enum
{
QCANA_EVTID_OPEN = 0,
QCANA_EVTID_CLOSE = 1,
QCANA_EVTID_STARTUP = 2,
QCANA_EVTID_LAG = 3,
QCANA_EVTID_SEEK = 4,
QCANA_EVTID_PAUSE = 5,
QCANA_EVTID_BA = 6,
QCANA_EVTID_RESUME = 7,
QCANA_EVTID_DOWNLOAD = 8,
QCANA_EVTID_MAX
}QCANA_EVT_ID;

typedef struct tagQCANA_EVT_BASE
{
long long llTime; /*!< event happen time, UTC */
long long llPos; /*!< event happen position, in ms */
long long llEvtDuration; /*!< event duration, in ms */
int nEventID; /*!< event ID */
int nErrCode; /*!< error code, refer to QC_ERR_XXX */
char szSessionID[36]; /*!< playback session ID */
} QCANA_EVT_BASE;

// Close event
typedef struct tagQCANA_EVT_CLOSE : QCANA_EVT_BASE
{
long long llWatchDuration; /*!< total playback time, not include seek */
}QCANA_EVT_CLOSE;

// Seek event
typedef struct tagQCANA_EVT_SEEK : QCANA_EVT_BASE
{
long long llWhereFrom; /*!< where seek from */
long long llWhereTo; /*!< where seek to */
}QCANA_EVT_SEEK;

// Bitrate adaption event
typedef struct tagQCANA_EVT_BA : QCANA_EVT_BASE
{
long long llBAPosition; /*!< where BA happens */
QCANA_SOURCE_INFO* pBitrateFrom; /*!< the old bitrate */
QCANA_SOURCE_INFO* pBitrateTo; /*!< the new bitrate */
int nBAMode; /*!< manual or auto */
}QCANA_EVT_BA;

// Download information
typedef struct tagQCANA_EVT_DLD : QCANA_EVT_BASE
{
long long llDownloadSize;
int nDownloadUseTime;

}QCANA_EVT_DLD;


// Event information, (szDeviceID + szAppID + szSessionID) identify one playback for specified end user
typedef struct tagQCANA_EVENT_INFO
{
QCANA_DEVICE_INFO* pDevInfo;
QCANA_SOURCE_INFO* pSrcInfo;
QCANA_EVT_BASE* pEvtInfo;
}QCANA_EVENT_INFO;


#endif // __QCANA_H__
37 changes: 35 additions & 2 deletions ios/include/qcCodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,46 @@
extern "C" {
#endif /* __cplusplus */

enum qcAudioSampleFormat {
QA_SAMPLE_FMT_NONE = -1,
QA_SAMPLE_FMT_U8, ///< unsigned 8 bits
QA_SAMPLE_FMT_S16, ///< signed 16 bits
QA_SAMPLE_FMT_S32, ///< signed 32 bits
QA_SAMPLE_FMT_FLT, ///< float
QA_SAMPLE_FMT_DBL, ///< double

QA_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar
QA_SAMPLE_FMT_S16P, ///< signed 16 bits, planar
QA_SAMPLE_FMT_S32P, ///< signed 32 bits, planar
QA_SAMPLE_FMT_FLTP, ///< float, planar
QA_SAMPLE_FMT_DBLP, ///< double, planar
QA_SAMPLE_FMT_S64, ///< signed 64 bits
QA_SAMPLE_FMT_S64P, ///< signed 64 bits, planar

QA_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically
};

// qc Audio frame info
typedef struct
{
int nSampleRate;
int nChannels;
int nFormat;
int nNBSamples;
char * pDataBuff[8];
int nDataSize[8];
} QC_AUDIO_FRAME;

/**
* the qc parser interface
*/
typedef struct
{
// Define the version of the Codec. It shuild be 1
int nVer;

// indicate it is video or audio. 1 is video, 0 is audio, -1 is subtt
int nAVType;
// The Codec handle, it will fill in function qcCreateDecoder.
void * hCodec;

Expand All @@ -47,8 +80,8 @@ typedef struct
} QC_Codec_Func;

// create the Codec with Codec type.
DLLEXPORT_C int qcCreateDecoder (QC_Codec_Func * pCodec, int nCodecID);
typedef int (* QCCREATEDECODER) (QC_Codec_Func * pCodec, int nCodecID);
DLLEXPORT_C int qcCreateDecoder (QC_Codec_Func * pCodec, void * pFormat);
typedef int(*QCCREATEDECODER) (QC_Codec_Func * pCodec, void * pFormat);

// destory the Codec
DLLEXPORT_C int qcDestroyDecoder (QC_Codec_Func * pCodec);
Expand Down
7 changes: 7 additions & 0 deletions ios/include/qcData.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ typedef enum {
QC_PARSER_MP4,
QC_PARSER_FLV,
QC_PARSER_TS,
QC_PARSER_MP3,
QC_PARSER_AAC,
QC_PARSER_MAX = 0X7FFFFFFF
}QCParserFormat;

Expand All @@ -56,6 +58,7 @@ typedef enum {
// audio codecs
QC_CODEC_ID_AAC = 0x10000,
QC_CODEC_ID_MP3,
QC_CODEC_ID_MP2,
QC_CODEC_ID_MAX = 0X7FFFFFFF
}QCCodecID;

Expand Down Expand Up @@ -193,6 +196,8 @@ typedef enum {
#ifdef __cplusplus
class CBuffMng;
#endif /* __cplusplus */
typedef int (*QC_FREE_BUFF) (void * pUser, void * pBuff);

typedef struct
{
QCMediaType nMediaType; /*!< buffer type */
Expand All @@ -214,6 +219,8 @@ typedef struct
CBuffMng * pBuffMng;
int nUsed; /*!< The buffer used times. It can free when is 0 */
#endif // __cplusplus
void * pUserData;
QC_FREE_BUFF fFreeBuff;
// for buffer track info
#ifdef __QC_BUFF_TRACE__
int nBuffID;
Expand Down
1 change: 1 addition & 0 deletions ios/include/qcErr.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define QC_ERR_NEWSTREAM 0x00000004
#define QC_ERR_NEEDMORE 0x00000005
#define QC_ERR_BUFFERING 0X00000006
#define QC_ERR_EMPTY 0X00000007
#define QC_ERR_FAILED 0x80000001
#define QC_ERR_MEMORY 0x80000002
#define QC_ERR_IMPLEMENT 0x80000003
Expand Down
2 changes: 2 additions & 0 deletions ios/include/qcIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ typedef struct
int (* GetSpeed) (void * hIO, int nLastSecs);
// return the io is newwork live, vod or local file
QCIOType (* GetType) (void * hIO);
// get the io is live streaming or vod
bool (* IsStreaming) (void * hIO);

// for extend function later.
int (* GetParam) (void * hIO, int nID, void * pParam);
Expand Down
19 changes: 17 additions & 2 deletions ios/include/qcMsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@
#define QC_MSG_HTTP_DOWNLOAD_SPEED 0x11000030 // Param: int speed
#define QC_MSG_HTTP_DISCONNECTED 0x11000050 // Param:
#define QC_MSG_HTTP_RECONNECT_FAILED 0x11000051 // Param:
#define QC_MSG_HTTP_RECONNECT_SUCESS 0x11000052 // Param:
#define QC_MSG_HTTP_RECONNECT_SUCESS 0x11000052 // Param:

#define QC_MSG_RTMP_CONNECT_START 0x11010001 // Param: URL.
#define QC_MSG_RTMP_CONNECT_FAILED 0x11010002 // Param:
#define QC_MSG_RTMP_CONNECT_SUCESS 0x11010003 // Param:
#define QC_MSG_RTMP_DOWNLOAD_SPEED 0x11010004 // Param: int speed
#define QC_MSG_RTMP_DNS_GET_IPADDR 0x11010005 // Param:

#define QC_MSG_IO_FIRST_BYTE_DONE 0x11020001 // Param:


// define the parser msg ID
#define QC_MSG_PARSER_BASE 0x12000000
Expand Down Expand Up @@ -85,10 +94,16 @@
// define the buffer msg ID
#define QC_MSG_BUFF_VBUFFTIME 0x18000001 //param: video buff time
#define QC_MSG_BUFF_ABUFFTIME 0x18000002 //param: audio buff time
#define QC_MSG_BUFF_GOPTIME 0x18000003 //param: video GOP time

#define QC_MSG_BUFF_NEWSTREAM 0x18000004 //param:
#define QC_MSG_BUFF_START_BUFFERING 0x18000006 //param: playing time
#define QC_MSG_BUFF_END_BUFFERING 0x18000007 //param:
#define QC_MSG_BUFF_END_BUFFERING 0x18000007 //param:

// define the render msg ID
#define QC_MSG_RENDER_BASE 0x19000000
#define QC_MSG_RENDER_VIDEO_FPS 0x19000001 //param: fps of video render



#endif // __QCMSG_H__
9 changes: 9 additions & 0 deletions ios/include/qcParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ typedef struct
// get the source is end of stream or not.
bool (* IsEOS) (void * hParser);

// get the source is live or not.
bool (* IsLive) (void * hParser);

// enable the subtitle or not.
int (* EnableSubtt) (void * hParser,bool bEnable);

Expand Down Expand Up @@ -86,6 +89,12 @@ DLLEXPORT_C int qcCreateParser (QC_Parser_Func * pParser, QCParserFormat nForma
// destory the Parser
DLLEXPORT_C int qcDestroyParser (QC_Parser_Func * pParser);

DLLEXPORT_C int ffCreateParser(QC_Parser_Func * pParser, QCParserFormat nFormat);
typedef int (*FFCREATEPARSER) (QC_Parser_Func * pParser, QCParserFormat nFormat);

DLLEXPORT_C int ffDestroyParser(QC_Parser_Func * pParser);
typedef int (*FFDESTROYPARSER) (QC_Parser_Func * pParser);

#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
Expand Down
2 changes: 2 additions & 0 deletions ios/include/qcPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ typedef enum {
// the flag for open source
#define QCPLAY_OPEN_VIDDEC_HW 0X01000000

#define QCPLAY_OPEN_SAME_SOURCE 0X02000000

// Call back function of player notify event
typedef void (QC_API * QCPlayerNotifyEvent) (void * pUserData, int nID, void * pValue1);

Expand Down
Binary file modified ios/lib/libqcPlayEng.a
Binary file not shown.
13 changes: 8 additions & 5 deletions ios/sample/TestCode.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
27648E281E3723EB005C1A20 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
27648E321E37A336005C1A20 /* AVKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVKit.framework; path = System/Library/Frameworks/AVKit.framework; sourceTree = SDKROOT; };
27648E341E37A34F005C1A20 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
27C98B021E3500270018DFA1 /* TestCode.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestCode.app; sourceTree = BUILT_PRODUCTS_DIR; };
27C98B021E3500270018DFA1 /* corePlayer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = corePlayer.app; sourceTree = BUILT_PRODUCTS_DIR; };
27C98B061E3500270018DFA1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
27C98B081E3500270018DFA1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
27C98B091E3500270018DFA1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -121,7 +121,7 @@
27C98B031E3500270018DFA1 /* Products */ = {
isa = PBXGroup;
children = (
27C98B021E3500270018DFA1 /* TestCode.app */,
27C98B021E3500270018DFA1 /* corePlayer.app */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -188,7 +188,7 @@
);
name = TestCode;
productName = TestCode;
productReference = 27C98B021E3500270018DFA1 /* TestCode.app */;
productReference = 27C98B021E3500270018DFA1 /* corePlayer.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
Expand Down Expand Up @@ -345,6 +345,7 @@
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = "";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
Expand All @@ -371,6 +372,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = GDFHW66V92;
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
HEADER_SEARCH_PATHS = (
../../../include,
../include,
Expand All @@ -383,7 +385,7 @@
);
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.qiniu.testcode;
PRODUCT_NAME = "$(TARGET_NAME)";
PRODUCT_NAME = corePlayer;
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
VALID_ARCHS = "arm64 armv7 armv7s";
Expand All @@ -399,6 +401,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = GDFHW66V92;
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = "";
HEADER_SEARCH_PATHS = (
../../../include,
../include,
Expand All @@ -411,7 +414,7 @@
);
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.qiniu.testcode;
PRODUCT_NAME = "$(TARGET_NAME)";
PRODUCT_NAME = corePlayer;
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
VALID_ARCHS = "arm64 armv7 armv7s";
Expand Down
7 changes: 6 additions & 1 deletion ios/sample/TestCode/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand All @@ -15,7 +20,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>V1.0.0.6</string>
<string>V1.1.0.9</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
1 change: 0 additions & 1 deletion ios/sample/TestCode/ViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

-(IBAction)onStart:(id)sender;
-(IBAction)onStop:(id)sender;
-(IBAction)onPause:(id)sender;
-(IBAction)onFullScreen:(id)sender;
-(IBAction)onSelectStream:(id)sender;
@end
Expand Down
Loading

0 comments on commit 7378a90

Please sign in to comment.