diff --git a/app/src/main/cpp/CMakeLists.txt b/app/src/main/cpp/CMakeLists.txt index 45192aa..7446bf6 100644 --- a/app/src/main/cpp/CMakeLists.txt +++ b/app/src/main/cpp/CMakeLists.txt @@ -45,7 +45,7 @@ add_library( # Sets the name of the library. common_media_jni.cpp ff_audio_player.cpp audio_player_jni.cpp - ff_http_pusher.cpp + ff_rtmp_pusher.cpp ffmpeg_pusher_jni.cpp ) diff --git a/app/src/main/cpp/ff_http_pusher.cpp b/app/src/main/cpp/ff_rtmp_pusher.cpp similarity index 96% rename from app/src/main/cpp/ff_http_pusher.cpp rename to app/src/main/cpp/ff_rtmp_pusher.cpp index 6f56473..400f36c 100644 --- a/app/src/main/cpp/ff_http_pusher.cpp +++ b/app/src/main/cpp/ff_rtmp_pusher.cpp @@ -2,11 +2,11 @@ // Created by xu fulong on 2022/9/9. // -#include "ff_http_pusher.h" +#include "ff_rtmp_pusher.h" #define PUSH_TAG "HttpPusher" -int FFHttpPusher::open(const char *inputPath, const char *outputPath) { +int FFRtmpPusher::open(const char *inputPath, const char *outputPath) { int ret; avformat_network_init(); @@ -69,7 +69,7 @@ void rescale(AVFormatContext *in_format_ctx, AVFormatContext *out_format_ctx, AV packet->pos = -1; } -int FFHttpPusher::push() { +int FFRtmpPusher::push() { int ret; int64_t startTime = av_gettime(); @@ -105,7 +105,7 @@ int FFHttpPusher::push() { return ret; } -void FFHttpPusher::close() { +void FFRtmpPusher::close() { if (outFormatCtx) { av_write_trailer(outFormatCtx); avformat_close_input(&outFormatCtx); diff --git a/app/src/main/cpp/ff_http_pusher.h b/app/src/main/cpp/ff_rtmp_pusher.h similarity index 83% rename from app/src/main/cpp/ff_http_pusher.h rename to app/src/main/cpp/ff_rtmp_pusher.h index 212125e..7765624 100644 --- a/app/src/main/cpp/ff_http_pusher.h +++ b/app/src/main/cpp/ff_rtmp_pusher.h @@ -2,8 +2,8 @@ // Created by xu fulong on 2022/9/9. // -#ifndef FF_HTTP_PUSHER_H -#define FF_HTTP_PUSHER_H +#ifndef FF_RTMP_PUSHER_H +#define FF_RTMP_PUSHER_H #include "ffmpeg_jni_define.h" @@ -17,7 +17,7 @@ extern "C" { } #endif -class FFHttpPusher { +class FFRtmpPusher { private: AVFormatContext *inFormatCtx; AVFormatContext *outFormatCtx; @@ -36,4 +36,4 @@ public: }; -#endif //FF_HTTP_PUSHER_H +#endif //FF_RTMP_PUSHER_H diff --git a/app/src/main/cpp/ffmpeg_pusher_jni.cpp b/app/src/main/cpp/ffmpeg_pusher_jni.cpp index bbcbf1c..928134e 100644 --- a/app/src/main/cpp/ffmpeg_pusher_jni.cpp +++ b/app/src/main/cpp/ffmpeg_pusher_jni.cpp @@ -3,21 +3,21 @@ // #include -#include "ff_http_pusher.h" +#include "ff_rtmp_pusher.h" PUSHER_FUNC(int, pushStream, jstring inputPath, jstring outputPath) { int ret; const char *input_path = env->GetStringUTFChars(inputPath, JNI_FALSE); const char *output_path = env->GetStringUTFChars(outputPath, JNI_FALSE); - auto *httpPusher = new FFHttpPusher(); - ret = httpPusher->open(input_path, output_path); + auto *rtmpPusher = new FFRtmpPusher(); + ret = rtmpPusher->open(input_path, output_path); if (ret < 0) { LOGE("HttpPusher", "open error=%d", ret); return ret; } - ret = httpPusher->push(); + ret = rtmpPusher->push(); - httpPusher->close(); + rtmpPusher->close(); env->ReleaseStringUTFChars(inputPath, input_path); env->ReleaseStringUTFChars(outputPath, output_path);