Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Laky-64 committed Sep 13, 2023
2 parents ca48161 + e1fbe5e commit 77197b3
Show file tree
Hide file tree
Showing 19 changed files with 177 additions and 102 deletions.
74 changes: 69 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,23 @@ jobs:
with:
platforms: arm64

- name: Build Shared Libs
- name: Build Debug Shared lib
run: python3 setup.py build_shared --no-preserve-cache --debug

- name: Build Release Shared lib
run: python3 setup.py build_shared --no-preserve-cache

- name: Upload shared libs for ${{ matrix.shared_name }}
- name: Upload Debug Shared lib for ${{ matrix.shared_name }}
uses: actions/upload-artifact@v3
with:
name: ntgcalls.${{ matrix.shared_name }}-debug-shared_libs
path: ./shared-output-debug/*
if-no-files-found: error

- name: Upload Release Shared lib for ${{ matrix.shared_name }}
uses: actions/upload-artifact@v3
with:
name: ntgcalls-${{ matrix.shared_name }}-lib.zip
name: ntgcalls.${{ matrix.shared_name }}-shared_libs
path: ./shared-output/*
if-no-files-found: error

Expand All @@ -70,7 +80,7 @@ jobs:

- uses: actions/upload-artifact@v3
with:
name: ntgcalls-${{ matrix.shared_name }}-wheels.zip
name: ntgcalls-${{ matrix.shared_name }}-wheels
path: ./wheelhouse/*.whl
if-no-files-found: error

Expand All @@ -79,11 +89,65 @@ jobs:
needs: [build]
permissions:
id-token: write
contents: write
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Get library Version
id: get-library-version
run: |
VERSION=$(grep -oP -m 1 'ntgcalls VERSION \K[A-Za-z0-9.]+' CMakeLists.txt)
echo "Library Version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Patch version number
id: patch-version
run: |
version="${{ steps.get-library-version.outputs.version }}"
if [[ "$version" == *.*.* ]]; then
echo "Version contains three dots"
major=$(echo "$version" | cut -d. -f1)
minor=$(echo "$version" | cut -d. -f2)
patch=$(echo "$version" | cut -d. -f3)
tweak=$(echo "$version" | cut -d. -f4)
new_version="${major}.${minor}.${patch}.dev${tweak}"
echo $new_version
echo "new_version=$new_version" >> $GITHUB_OUTPUT
echo "is_dev=true" >> $GITHUB_OUTPUT
else
echo "Version does not contain three dots"
echo "new_version=${{ steps.get-library-version.outputs.version }}" >> $GITHUB_OUTPUT
echo "is_dev=false" >> $GITHUB_OUTPUT
fi
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: tmp/

- name: Zip releases
run: |
mkdir releases
for dir in tmp/*shared_libs; do
if [ -d "$dir" ]; then
echo "$dir"
folder_name=$(basename "$dir" .zip)
(cd $dir && zip -r "../../releases/${folder_name}.zip" *)
fi
done
- name: Create Release
id: create-new-release
uses: softprops/action-gh-release@v1
with:
files: |
./releases/*
tag_name: "v${{ steps.patch-version.outputs.new_version }}"
name: "NTgCalls auto build v${{ steps.patch-version.outputs.new_version }}"
body: "These are the build files for the commit [${{ github.sha }}](https://github.com/${{ github.repository }}/${{ github.sha }}).\nThese files were built during [this workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})."
prerelease: ${{ steps.patch-version.outputs.is_dev }}

- name: Extract artifacts
run: |
mkdir dist
Expand All @@ -94,4 +158,4 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
packages-dir: dist/
packages-dir: dist/
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ endif ()
include(ExternalProject)

# https://chromiumdash.appspot.com/branches
set(WEBRTC_REVISION m116.5845.6.1)
set(WEBRTC_REVISION m117.5938.2.0)
set(BOOST_REVISION 1.83.0)
set(BOOST_LIBS filesystem)

if(DEFINED PY_VERSION_INFO)
set(IS_PYTHON TRUE)
endif()

project(ntgcalls VERSION 1.0.0.5 LANGUAGES C CXX)
project(ntgcalls VERSION 1.0.0.6 LANGUAGES C CXX)

find_package(Threads REQUIRED)

Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# NativeTgCalls: <br/> An experimental implementation of Telegram Group Calls
# NativeTgCalls: <br/> An experimental implementation of Telegram Group Calls
Welcome to NativeTgCalls, an innovative open-source project. NativeTgCalls represents the next evolution in Telegram calling, building on the foundation laid by PyTgCalls.

| Powerful | Simple | Light |
Expand Down Expand Up @@ -62,7 +62,7 @@ For developers looking to use NativeTgCalls with C and C++, we provide C Binding
* <b><a href="https://github.com/kuogi">@kuogi</a> (Senior UI/UX designer, Documenter):</b>
* As a Senior UI/UX Designer, Kuogi has significantly improved the user interface of our documentation,
making it more visually appealing and user-friendly.
* Has also played a key role in writing and structuring our documentation, ensuring that it is clear,
* It Has also played a key role in writing and structuring our documentation, ensuring that it is clear,
informative, and accessible to all users.
* <b><a href="https://github.com/vrumger">@vrumger</a> (Mid-level NodeJS Developer):</b>
* Avrumy has made important fixes and enhancements to the WebRTC component of the library,
Expand All @@ -74,21 +74,29 @@ For developers looking to use NativeTgCalls with C and C++, we provide C Binding
in expanding the functionality and usability of the library.
* <b><a href="https://github.com/null-nick">@null-nick</a> (Junior Go Developer, Tester):</b>
* Performs testing of NTgCalls on macOS to ensure its reliability and compatibility.
* Is in the process of integrating NTgCalls into a Go wrapper, further enhancing the library's
* It Is in the process of integrating NTgCalls into a Go wrapper, further enhancing the library's
versatility and accessibility.
* <b><a href="https://github.com/tappo03">@tappo03</a> (Junior Go Developer, Tester):</b>
* Performs testing of NTgCalls on Windows to ensure its reliability and compatibility.
* Is in the process of integrating NTgCalls into a Go wrapper, further enhancing the library's
* It Is in the process of integrating NTgCalls into a Go wrapper, further enhancing the library's
versatility and accessibility.

## Special Thanks
* <b><a href="https://github.com/shiguredo">@shiguredo</a>:</b>
We extend our special thanks to 時雨堂 (shiguredo) for their invaluable assistance in integrating the WebRTC component. Their contributions,
utilizing the Sora C++ SDK, have been instrumental in enhancing the functionality of our library.

* <b><a href="https://github.com/evgeny-nadymov">@evgeny-nadymov</a>:</b>
A heartfelt thank you to Evgeny Nadymov for graciously allowing us to use their code from telegram-react.
His contribution has been pivotal to the success of this project.

* <b><a href="https://github.com/morethanwords">@morethanwords</a>:</b>
We extend our special thanks to morethanwords for their invaluable help in integrating the connection to WebRTC with Telegram Web K.
Their assistance has been instrumental in enhancing the functionality of our library.


_We would like to extend a special thanks to <b><a href='https://github.com/doggyhaha'>@doggyhaha</a></b>
and <b><a href='https://github.com/branchscope'>@branchscope</a></b> for their valuable contributions to the testing phase of the library.
Their dedication to testing and optimizing the library has been instrumental in its success._

_Additionally, we extend our gratitude to all contributors for their exceptional work in making this project a reality._
4 changes: 2 additions & 2 deletions examples/go/ntgcalls/audio_description.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ type AudioDescription struct {
BitsPerSample, ChannelCount uint8
}

func (ctx *AudioDescription) ParseToC() C.ntgAudioDescription {
var x C.ntgAudioDescription
func (ctx *AudioDescription) ParseToC() C.ntg_audio_description_struct {
var x C.ntg_audio_description_struct
x.inputMode = ctx.InputMode.ParseToC()
x.input = C.CString(ctx.Input)
x.sampleRate = C.uint16_t(ctx.SampleRate)
Expand Down
4 changes: 2 additions & 2 deletions examples/go/ntgcalls/media_description.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ type MediaDescription struct {
Video *VideoDescription
}

func (ctx *MediaDescription) ParseToC() C.ntgMediaDescription {
var x C.ntgMediaDescription
func (ctx *MediaDescription) ParseToC() C.ntg_media_description_struct {
var x C.ntg_media_description_struct
if ctx.Audio != nil {
audio := ctx.Audio.ParseToC()
x.audio = &audio
Expand Down
10 changes: 5 additions & 5 deletions examples/go/ntgcalls/ntgcalls.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ntgcalls

//#include "ntgcalls.h"
//extern void handleStream(uint32_t uid, int64_t chatID, ntgStreamType streamType);
//extern void handleUpgrade(uint32_t uid, int64_t chatID, ntgMediaState state);
//extern void handleStream(uint32_t uid, int64_t chatID, ntg_stream_type_enum streamType);
//extern void handleUpgrade(uint32_t uid, int64_t chatID, ntg_media_state_struct state);
import "C"
import (
"fmt"
Expand All @@ -23,7 +23,7 @@ func NTgCalls() *Instance {
}

//export handleStream
func handleStream(uid C.uint32_t, chatID C.int64_t, streamType C.ntgStreamType) {
func handleStream(uid C.uint32_t, chatID C.int64_t, streamType C.ntg_stream_type_enum) {
goChatID := int64(chatID)
goUID := uint32(uid)
var goStreamType StreamType
Expand All @@ -40,7 +40,7 @@ func handleStream(uid C.uint32_t, chatID C.int64_t, streamType C.ntgStreamType)
}

//export handleUpgrade
func handleUpgrade(uid C.uint32_t, chatID C.int64_t, state C.ntgMediaState) {
func handleUpgrade(uid C.uint32_t, chatID C.int64_t, state C.ntg_media_state_struct) {
goChatID := int64(chatID)
goUID := uint32(uid)
goState := MediaState{
Expand Down Expand Up @@ -135,7 +135,7 @@ func (ctx *Instance) Calls() map[int64]StreamStatus {
mapReturn := make(map[int64]StreamStatus)

callSize := C.ntg_calls_count(C.uint32_t(ctx.uid))
buffer := make([]C.ntgGroupCall, callSize)
buffer := make([]C.ntg_group_call_struct, callSize)
C.ntg_calls(C.uint32_t(ctx.uid), &buffer[0], callSize)

for _, call := range buffer {
Expand Down
2 changes: 1 addition & 1 deletion examples/go/ntgcalls/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const (
IdlingStream
)

func (ctx InputMode) ParseToC() C.ntgInputMode {
func (ctx InputMode) ParseToC() C.ntg_input_mode_enum {
switch ctx {
case InputModeFile:
return C.NTG_FILE
Expand Down
4 changes: 2 additions & 2 deletions examples/go/ntgcalls/video_description.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ type VideoDescription struct {
Fps uint8
}

func (ctx *VideoDescription) ParseToC() C.ntgVideoDescription {
var x C.ntgVideoDescription
func (ctx *VideoDescription) ParseToC() C.ntg_video_description_struct {
var x C.ntg_video_description_struct
x.inputMode = ctx.InputMode.ParseToC()
x.input = C.CString(ctx.Input)
x.width = C.uint16_t(ctx.Width)
Expand Down
44 changes: 22 additions & 22 deletions include/ntgcalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,62 +39,62 @@ typedef enum {
NTG_FILE,
NTG_SHELL,
NTG_FFMPEG
} ntgInputMode;
} ntg_input_mode_enum;

typedef enum {
NTG_STREAM_AUDIO = 0,
NTG_STREAM_VIDEO = 1
} ntgStreamType;
NTG_STREAM_AUDIO,
NTG_STREAM_VIDEO
} ntg_stream_type_enum;

typedef enum {
NTG_PLAYING,
NTG_PAUSED,
NTG_IDLING
} ntgStreamStatus;
} ntg_stream_status_enum;

typedef struct {
ntgInputMode inputMode;
ntg_input_mode_enum inputMode;
char* input;
uint16_t sampleRate;
uint8_t bitsPerSample, channelCount;
} ntgAudioDescription;
} ntg_audio_description_struct;

typedef struct {
ntgInputMode inputMode;
ntg_input_mode_enum inputMode;
char* input;
uint16_t width, height;
uint8_t fps;
} ntgVideoDescription;
} ntg_video_description_struct;

typedef struct {
ntgAudioDescription* audio;
ntgVideoDescription* video;
} ntgMediaDescription;
ntg_audio_description_struct* audio;
ntg_video_description_struct* video;
} ntg_media_description_struct;

typedef struct {
int64_t chatId;
ntgStreamStatus status;
} ntgGroupCall;
ntg_stream_status_enum status;
} ntg_group_call_struct;

typedef struct {
bool muted;
bool videoPaused;
bool videoStopped;
} ntgMediaState;
} ntg_media_state_struct;

typedef void (*ntgStreamEndCallback)(uint32_t, int64_t, ntgStreamType);
typedef void (*ntg_stream_callback)(uint32_t, int64_t, ntg_stream_type_enum);

typedef void (*ntgUpgradeCallback)(uint32_t, int64_t, ntgMediaState);
typedef void (*ntg_upgrade_callback)(uint32_t, int64_t, ntg_media_state_struct);

NTG_C_EXPORT uint32_t ntg_init();

NTG_C_EXPORT int ntg_destroy(uint32_t uid);

NTG_C_EXPORT int ntg_get_params(uint32_t uid, int64_t chatID, ntgMediaDescription rep, char* buffer, int size);
NTG_C_EXPORT int ntg_get_params(uint32_t uid, int64_t chatID, ntg_media_description_struct rep, char* buffer, int size);

NTG_C_EXPORT int ntg_connect(uint32_t uid, int64_t chatID, char* params);

NTG_C_EXPORT int ntg_change_stream(uint32_t uid, int64_t chatID, ntgMediaDescription desc);
NTG_C_EXPORT int ntg_change_stream(uint32_t uid, int64_t chatID, ntg_media_description_struct desc);

NTG_C_EXPORT bool ntg_pause(uint32_t uid, int64_t chatID);

Expand All @@ -108,13 +108,13 @@ NTG_C_EXPORT int ntg_stop(uint32_t uid, int64_t chatID);

NTG_C_EXPORT uint64_t ntg_time(uint32_t uid, int64_t chatID);

NTG_C_EXPORT int ntg_calls(uint32_t uid, ntgGroupCall *buffer, int size);
NTG_C_EXPORT int ntg_calls(uint32_t uid, ntg_group_call_struct *buffer, int size);

NTG_C_EXPORT int ntg_calls_count(uint32_t uid);

NTG_C_EXPORT int ntg_on_stream_end(uint32_t uid, ntgStreamEndCallback callback);
NTG_C_EXPORT int ntg_on_stream_end(uint32_t uid, ntg_stream_callback callback);

NTG_C_EXPORT int ntg_on_upgrade(uint32_t uid, ntgUpgradeCallback callback);
NTG_C_EXPORT int ntg_on_upgrade(uint32_t uid, ntg_upgrade_callback callback);

#ifdef __cplusplus
}
Expand Down
Loading

0 comments on commit 77197b3

Please sign in to comment.