Commit 12ba1957 authored by Max Kellermann's avatar Max Kellermann

input/ffmpeg: use "auto"

parent 9b9d189a
...@@ -101,9 +101,9 @@ input_ffmpeg_open(const char *uri, ...@@ -101,9 +101,9 @@ input_ffmpeg_open(const char *uri,
return nullptr; return nullptr;
AVIOContext *h; AVIOContext *h;
int ret = avio_open(&h, uri, AVIO_FLAG_READ); auto result = avio_open(&h, uri, AVIO_FLAG_READ);
if (ret != 0) { if (result != 0) {
error.Set(ffmpeg_domain, ret, error.Set(ffmpeg_domain, result,
"libavformat failed to open the URI"); "libavformat failed to open the URI");
return nullptr; return nullptr;
} }
...@@ -114,17 +114,17 @@ input_ffmpeg_open(const char *uri, ...@@ -114,17 +114,17 @@ input_ffmpeg_open(const char *uri,
size_t size_t
FfmpegInputStream::Read(void *ptr, size_t read_size, Error &error) FfmpegInputStream::Read(void *ptr, size_t read_size, Error &error)
{ {
int ret = avio_read(h, (unsigned char *)ptr, read_size); auto result = avio_read(h, (unsigned char *)ptr, read_size);
if (ret <= 0) { if (result <= 0) {
if (ret < 0) if (result < 0)
error.Set(ffmpeg_domain, "avio_read() failed"); error.Set(ffmpeg_domain, "avio_read() failed");
eof = true; eof = true;
return false; return false;
} }
offset += ret; offset += result;
return (size_t)ret; return (size_t)result;
} }
bool bool
...@@ -136,9 +136,9 @@ FfmpegInputStream::IsEOF() ...@@ -136,9 +136,9 @@ FfmpegInputStream::IsEOF()
bool bool
FfmpegInputStream::Seek(offset_type new_offset, Error &error) FfmpegInputStream::Seek(offset_type new_offset, Error &error)
{ {
int64_t ret = avio_seek(h, new_offset, SEEK_SET); auto result = avio_seek(h, new_offset, SEEK_SET);
if (ret >= 0) { if (result >= 0) {
eof = false; eof = false;
return true; return true;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment