Skip to content

Commit

Permalink
Changes per pull request #39
Browse files Browse the repository at this point in the history
  • Loading branch information
h4tr3d committed Oct 9, 2019
1 parent 7da2645 commit 0d12d83
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/codeccontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ using namespace std;
namespace av {
namespace {

std::pair<ssize_t, const error_category*>
std::pair<int, const error_category*>
make_error_pair(Errors errc)
{
return make_pair(static_cast<ssize_t>(errc), &avcpp_category());
return make_pair(static_cast<int>(errc), &avcpp_category());
}

std::pair<ssize_t, const error_category*>
make_error_pair(ssize_t status)
std::pair<int, const error_category*>
make_error_pair(int status)
{
if (status < 0)
return make_pair(status, &ffmpeg_category());
Expand Down Expand Up @@ -757,7 +757,7 @@ void CodecContext2::open(const Codec &codec, AVDictionary **options, OptionalErr
throws_if(ec, stat, ffmpeg_category());
}

std::pair<ssize_t, const error_category *> CodecContext2::decodeCommon(AVFrame *outFrame, const Packet &inPacket, size_t offset, int &frameFinished, int (*decodeProc)(AVCodecContext *, AVFrame *, int *, const AVPacket *)) noexcept
std::pair<int, const error_category *> CodecContext2::decodeCommon(AVFrame *outFrame, const Packet &inPacket, size_t offset, int &frameFinished, int (*decodeProc)(AVCodecContext *, AVFrame *, int *, const AVPacket *)) noexcept
{
if (!isValid())
return make_error_pair(Errors::CodecInvalid);
Expand All @@ -781,7 +781,7 @@ std::pair<ssize_t, const error_category *> CodecContext2::decodeCommon(AVFrame *
return make_error_pair(decoded);
}

std::pair<ssize_t, const error_category *> CodecContext2::encodeCommon(Packet &outPacket, const AVFrame *inFrame, int &gotPacket, int (*encodeProc)(AVCodecContext *, AVPacket *, const AVFrame *, int *)) noexcept
std::pair<int, const error_category *> CodecContext2::encodeCommon(Packet &outPacket, const AVFrame *inFrame, int &gotPacket, int (*encodeProc)(AVCodecContext *, AVPacket *, const AVFrame *, int *)) noexcept
{
if (!isValid()) {
fflog(AV_LOG_ERROR, "Invalid context\n");
Expand Down
8 changes: 4 additions & 4 deletions src/codeccontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,25 +129,25 @@ class CodecContext2 : public FFWrapperPtr<AVCodecContext>, public noncopyable
void open(const Codec &codec, AVDictionary **options, OptionalErrorCode ec);


std::pair<ssize_t, const std::error_category*>
std::pair<int, const std::error_category*>
decodeCommon(AVFrame *outFrame, const class Packet &inPacket, size_t offset, int &frameFinished,
int (*decodeProc)(AVCodecContext*, AVFrame*,int *, const AVPacket *)) noexcept;

std::pair<ssize_t, const std::error_category*>
std::pair<int, const std::error_category*>
encodeCommon(class Packet &outPacket, const AVFrame *inFrame, int &gotPacket,
int (*encodeProc)(AVCodecContext*, AVPacket*,const AVFrame*, int*)) noexcept;

public:
template<typename T>
std::pair<ssize_t, const std::error_category*>
std::pair<int, const std::error_category*>
decodeCommon(T &outFrame,
const class Packet &inPacket,
size_t offset,
int &frameFinished,
int (*decodeProc)(AVCodecContext *, AVFrame *, int *, const AVPacket *));

template<typename T>
std::pair<ssize_t, const std::error_category*>
std::pair<int, const std::error_category*>
encodeCommon(class Packet &outPacket,
const T &inFrame,
int &gotPacket,
Expand Down
2 changes: 1 addition & 1 deletion src/formatcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ void FormatContext::closeCodecContexts()
#endif
}

ssize_t FormatContext::checkPbError(ssize_t stat)
int FormatContext::checkPbError(int stat)
{
// WORKAROUND: a lot of format specific writer_packet() functions always return zero code
// and av_write_frame() in FFMPEG prio 1.0 does not contain follow wrapper
Expand Down
6 changes: 3 additions & 3 deletions src/formatcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ using AvioInterruptCb = std::function<int()>;
struct CustomIO
{
virtual ~CustomIO() {}
virtual ssize_t write(const uint8_t *data, size_t size)
virtual int write(const uint8_t *data, size_t size)
{
static_cast<void>(data);
static_cast<void>(size);
return -1;
}
virtual ssize_t read(uint8_t *data, size_t size)
virtual int read(uint8_t *data, size_t size)
{
static_cast<void>(data);
static_cast<void>(size);
Expand Down Expand Up @@ -202,7 +202,7 @@ class FormatContext : public FFWrapperPtr<AVFormatContext>, public noncopyable
void resetSocketAccess();
void findStreamInfo(AVDictionary **options, size_t optionsCount, OptionalErrorCode ec);
void closeCodecContexts();
ssize_t checkPbError(ssize_t stat);
int checkPbError(int stat);

void openCustomIO(CustomIO *io, size_t internalBufferSize, bool isWritable, OptionalErrorCode ec);
void openCustomIOInput(CustomIO *io, size_t internalBufferSize, OptionalErrorCode ec);
Expand Down

0 comments on commit 0d12d83

Please sign in to comment.