-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streaming server MVP #8
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если я правильно понял, получилось сделать только получение информации о потоках видео/аудио. Оцениваю на 15
|
||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
find_package(Boost 1.82.0 REQUIRED COMPONENTS filesystem) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
используйте лучше std::filesystem если оно подходит по ваши нужды
include_directories(boost_test ${Boost_INCLUDE_DIRS}) | ||
find_package(Threads REQUIRED) | ||
|
||
set(FFMPEG_LIBRARIES "/usr/lib/x86_64-linux-gnu/libavcodec.so;/usr/lib/x86_64-linux-gnu/libavformat.so;/usr/lib/x86_64-linux-gnu/libavutil.so;/usr/lib/x86_64-linux-gnu/libswscale.so") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это можно делать через PkgConfig
find_package(PkgConfig REQUIRED)
pkg_check_modules(AVCODEC REQUIRED IMPORTED_TARGET libavcodec)
target_link_libraries(server PUBLIC
PkgConfig::AVCODEC)
|
||
set(FFMPEG_LIBRARIES "/usr/lib/x86_64-linux-gnu/libavcodec.so;/usr/lib/x86_64-linux-gnu/libavformat.so;/usr/lib/x86_64-linux-gnu/libavutil.so;/usr/lib/x86_64-linux-gnu/libswscale.so") | ||
|
||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-pthread добавит Threads
|
||
# Set include directories | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/VideoStream/include) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
target
|
||
# Add source files | ||
set(SOURCES | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMAKE_CURRENT_SOURCE_DIR можно не писать, относительные пути работают от CMAKE_CURRENT_SOURCE_DIR
|
||
class AudioEncoder : IEncoder { | ||
public: | ||
AudioEncoder() = delete; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
удаляется сам, когда вы объявляете любой конструктор
class IEncoder { | ||
public: | ||
virtual ~IEncoder() = default; | ||
virtual std::vector<uint8_t> encode(const uint8_t* data) = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а как понять размер data
|
||
class VideoStream { | ||
public: | ||
const std::string DEFAULT_CODEC = "H264"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
зачем держать это в классе - оно потребляет память. Вынесите в константу в CPP файл
} | ||
|
||
void VideoStream::open(const std::string& filename) { | ||
_video_encoder = std::make_shared<VideoEncoder>(1920, 1080, 30, 10000000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше принимать IEncoder или IVideoEncoder как параметр, тогда это будет Dependency Injection, код будет меньше связан
bool findStreamInfo(); | ||
|
||
std::string file_path_; | ||
AVFormatContext* format_context_ = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше сделать под такие данные C++ RAII обертки, чтобы правильно из создавать и уничтожать
No description provided.