Skip to content

Commit

Permalink
添加flv库
Browse files Browse the repository at this point in the history
  • Loading branch information
tonychanchen committed Dec 2, 2021
1 parent 3744353 commit 7f56307
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/deploypod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,30 @@ jobs:
pod trunk push TIoTLinkKit_XP2P.podspec --verbose --allow-warnings --use-libraries
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.IOT_COCOAPODS_TRUNK_TOKEN }}


- name: Deploy flv SDK
if: ${{contains(env.curr_tag, 'flv')}}
run: |
set -eo pipefail
temptag=$(git describe --tags `git rev-list --tags --max-count=1`)
vtaglist=(${temptag//-/ })
beta=${vtaglist[2]}
version=${vtaglist[1]}
if [ ${#beta} -gt 0 ]
then
version=${vtaglist[1]}-$beta
fi
version=${version#*v}
echo $version
export LIB_VERSION=$version
perl -i -pe "s#.*s.source .*#\ts.source = { :git => 'https://github.com/tencentyun/iot-thirdparty-ios.git', :tag => \"$temptag\" }#g" TIoTLinkKit_FLV.podspec
pod lib lint TIoTLinkKit_FLV.podspec --verbose --allow-warnings --use-libraries
pod trunk push TIoTLinkKit_FLV.podspec --verbose --allow-warnings --use-libraries
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.IOT_COCOAPODS_TRUNK_TOKEN }}


63 changes: 63 additions & 0 deletions Source/FLV-iOS/Classes/flv-muxer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#ifndef _flv_muxer_h_
#define _flv_muxer_h_

#include <stddef.h>
#include <stdint.h>

#if defined(__cplusplus)
extern "C" {
#endif

typedef struct flv_muxer_t flv_muxer_t;

///Video: FLV VideoTagHeader + AVCVIDEOPACKET: AVCDecoderConfigurationRecord(ISO 14496-15) / One or more NALUs(four-bytes length + NALU)
///Audio: FLV AudioTagHeader + AACAUDIODATA: AudioSpecificConfig(14496-3) / Raw AAC frame data in UI8
///@param[in] data FLV Audio/Video Data(don't include FLV Tag Header)
///@param[in] type 8-audio, 9-video
///@return 0-ok, other-error
typedef int (*flv_muxer_handler)(void* param, int type, const void* data, size_t bytes, uint32_t timestamp);

flv_muxer_t* flv_muxer_create(flv_muxer_handler handler, void* param);
void flv_muxer_destroy(flv_muxer_t* muxer);

/// re-create AAC/AVC sequence header
int flv_muxer_reset(flv_muxer_t* muxer);

/// @param[in] data AAC ADTS stream, 0xFFF15C40011FFC...
int flv_muxer_aac(flv_muxer_t* muxer, const void* data, size_t bytes, uint32_t pts, uint32_t dts);

/// @param[in] data mp3 stream
int flv_muxer_mp3(flv_muxer_t* muxer, const void* data, size_t bytes, uint32_t pts, uint32_t dts);

/// @param[in] data opus stream, first opus head, then opus samples
int flv_muxer_opus(flv_muxer_t* muxer, const void* data, size_t bytes, uint32_t pts, uint32_t dts);

/// @param[in] data h.264 annexb bitstream: H.264 start code + H.264 NALU, 0x0000000168...
int flv_muxer_avc(flv_muxer_t* muxer, const void* data, size_t bytes, uint32_t pts, uint32_t dts);

/// @param[in] data h.265 annexb bitstream: H.265 start code + H.265 NALU, 0x00000001...
int flv_muxer_hevc(flv_muxer_t* muxer, const void* data, size_t bytes, uint32_t pts, uint32_t dts);

struct flv_metadata_t
{
int audiocodecid;
double audiodatarate; // kbps
int audiosamplerate;
int audiosamplesize;
int stereo;

int videocodecid;
double videodatarate; // kbps
double framerate; // fps
double duration;
int interval; // frame interval
int width;
int height;
};

int flv_muxer_metadata(flv_muxer_t* muxer, const struct flv_metadata_t* metadata);

#if defined(__cplusplus)
}
#endif
#endif /* !_flv_muxer_h_ */
41 changes: 41 additions & 0 deletions Source/FLV-iOS/Classes/flv-writer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#ifndef _flv_writer_h_
#define _flv_writer_h_

#include <stddef.h>
#include <stdint.h>

#if defined(__cplusplus)
extern "C" {
#endif

struct flv_vec_t
{
void* ptr;
int len;
};

/// @param[in] param flv_writer_create2 param
/// @param[in] n vec number
/// @return 0-ok, other-error
typedef int (*flv_writer_onwrite)(void* param, const struct flv_vec_t* vec, int n);

void* flv_writer_create(const char* file);
/// @param[in] audio 1-has audio, 0-don't has audio
/// @param[in] video 1-has video, 0-don't has video
void* flv_writer_create2(int audio, int video, flv_writer_onwrite onwrite, void* param);

void flv_writer_destroy(void* flv);

/// Video: FLV VideoTagHeader + AVCVIDEOPACKET: AVCDecoderConfigurationRecord(ISO 14496-15) / One or more NALUs(four-bytes length + NALU)
/// Audio: FLV AudioTagHeader + AACAUDIODATA: AudioSpecificConfig(14496-3) / Raw AAC frame data in UI8
/// @param[in] data FLV Audio/Video Data(don't include FLV Tag Header)
/// @param[in] type 8-audio, 9-video
/// @return 0-ok, other-error
int flv_writer_input(void* flv, int type, const void* data, size_t bytes, uint32_t timestamp);

int flv_writer_input_v(void* flv, int type, const struct flv_vec_t* vec, int num, uint32_t timestamp);

#if defined(__cplusplus)
}
#endif
#endif /* !_flv_writer_h_ */
Binary file added Source/FLV-iOS/liblibflv.a
Binary file not shown.
26 changes: 26 additions & 0 deletions TIoTLinkKit_FLV.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Pod::Spec.new do |s|
s.name = 'TIoTLinkKit_FLV'
s.version = ENV['LIB_VERSION'] || '1.0.0'
s.summary = '该仓库为方便个人仓库构建使用,如有其他需求还请从官网下载原SDK'

s.description = <<-DESC
在CI构建中,有些SDK没有提供供方便pod集成使用,在此仓库提供个聚合SDK以便更好的支持CI。
DESC

s.homepage = 'https://github.com/tencentyun/iot-thirdparty-ios'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { '[email protected]' => '[email protected]' }
s.source = { :git => 'https://github.com/tencentyun/iot-thirdparty-ios.git', :tag => s.version.to_s }

s.ios.deployment_target = '9.0'
# s.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-all_load' }
# s.static_framework = true

s.source_files = 'Source/FLV-iOS/Classes/**/*'
s.vendored_libraries = 'Source/FLV-iOS/*.a'
# s.frameworks = "NetworkExtension", "CoreGraphics", "SystemConfiguration", "Foundation", "UIKit"
# s.libraries = 'c++', 'sqlite3', 'z'
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }

end

0 comments on commit 7f56307

Please sign in to comment.