Skip to content
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

add and modify some file to fit linux platform #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions source/ffmpeg-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 3.5)
project(ffmpeg-cpp)

SET(CMAKE_CXX_STANDARD 11)

set (CXX_FLAGS
-g
-fPIC
-Wall
-Wno-unused-parameter
-Wno-unused-function
-Wunused-variable
-Wunused-value
-Wshadow
-Wcast-qual
-Wcast-align
-Wwrite-strings
-Wsign-compare
-Winvalid-pch
-fms-extensions
-Wfloat-equal
-Wextra
-std=c++11
)

SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -ggdb -D_DEBUG")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -ggdb -DNDEBUG")

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/3rd/ffmpeg/include)
LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/3rd/ffmpeg/lib)

include_directories(ffmpeg-cpp)

file(GLOB_RECURSE ffmpeg-cpp-srcs ffmpeg-cpp/*.cpp *.h)

add_library(ffmpeg-cpp ${ffmpeg-cpp-srcs})
target_link_libraries(ffmpeg-cpp avcodec avdevice avfilter avformat avutil postproc swresample swscale)
4 changes: 4 additions & 0 deletions source/ffmpeg-cpp/ffmpeg-cpp/AudioFormatConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#include "ffmpeg.h"
#include "ConvertedAudioProcessor.h"

#ifndef nullptr
#define nullptr NULL
#endif

namespace ffmpegcpp
{
class AudioFormatConverter
Expand Down
1 change: 1 addition & 0 deletions source/ffmpeg-cpp/ffmpeg-cpp/CodecDeducer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "CodecDeducer.h"
#include "FFmpegException.h"
#include <string>

using namespace std;

Expand Down
3 changes: 2 additions & 1 deletion source/ffmpeg-cpp/ffmpeg-cpp/Codecs/VideoCodec.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <limits>
#include "VideoCodec.h"
#include "FFmpegException.h"

Expand Down Expand Up @@ -102,7 +103,7 @@ namespace ffmpegcpp
while (p->num)
{
double pVal = av_q2d(*p);
double diff = abs(pVal - fVal);
double diff = fabs(pVal - fVal);
if (diff < bestDiff)
{
bestDiff = diff;
Expand Down
5 changes: 1 addition & 4 deletions source/ffmpeg-cpp/ffmpeg-cpp/FFmpegException.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ using namespace std;

namespace ffmpegcpp
{
FFmpegException::FFmpegException(string error) : exception(error.c_str())
FFmpegException::FFmpegException(string error)
{
}

FFmpegException::FFmpegException(string error, int returnValue)
: exception(
(error + ": " + av_make_error_string(this->error, AV_ERROR_MAX_STRING_SIZE, returnValue)).c_str()
)
{
}
}
2 changes: 1 addition & 1 deletion source/ffmpeg-cpp/ffmpeg-cpp/FFmpegException.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace ffmpegcpp

FFmpegException(std::string error, int returnValue);

virtual char const* what() const
virtual char const* what() throw()
{
return std::exception::what();
}
Expand Down
2 changes: 1 addition & 1 deletion source/ffmpeg-cpp/ffmpeg-cpp/Frame Sinks/FrameSinkStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "ffmpeg.h"
#include "FrameWriter.h"
#include "Demuxing/Streamdata.h"
#include "Demuxing/StreamData.h"

namespace ffmpegcpp
{
Expand Down
2 changes: 1 addition & 1 deletion source/ffmpeg-cpp/ffmpeg-cpp/codecs/H264NVEncCodec.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "VideoCodec.h"
#include "Codecs/VideoCodec.h"

namespace ffmpegcpp
{
Expand Down
2 changes: 1 addition & 1 deletion source/ffmpeg-cpp/ffmpeg-cpp/codecs/H265NVEncCodec.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "VideoCodec.h"
#include "Codecs/VideoCodec.h"

namespace ffmpegcpp
{
Expand Down
5 changes: 4 additions & 1 deletion source/ffmpeg-cpp/ffmpeg-cpp/ffmpeg.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#pragma once

#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <stdlib.h>

#ifdef _WIN32
#include <crtdbg.h>
#endif

extern "C" {
#include <libavcodec/avcodec.h>
Expand Down