• Marton Balint's avatar
    avformat/utils: return pending IO error on EOF in av_read_frame() · ce1fcc8c
    Marton Balint authored
    avio_feof() returns true both in case of actual EOF and in case of IO errors.
    Some demuxers (matroska) have special handling to be able to return the proper
    error for this exact reason, e.g.:
    
    if (avio_feof(pb)) {
         if (pb->error) {
             return pb->error;
         } else {
             return AVERROR_EOF;
         }
    }
    
    However, most of the demuxers do not, and they simply return AVERROR_EOF if
    avio_feof() is true, so there is a real chance that IO errors are mistaken for
    EOF.
    
    We might just say that the API user should always check the IO context error
    attribute on EOF to make sure no IO errors happened, but not even ffmpeg.c does
    this. It should be more intuitive to the API user if we simply return the IO
    error as the return value of av_read_frame() instead of AVERROR_EOF.
    Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
    ce1fcc8c
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
ffbuild Loading commit data...
fftools Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING.md Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL.md Loading commit data...
LICENSE.md Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
configure Loading commit data...