[vlc-commits] libav: use vlc_strerror_c()
Rémi Denis-Courmont
git at videolan.org
Sun Dec 29 15:16:26 CET 2013
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Dec 28 19:04:13 2013 +0200| [9ce4212b20f17e6879d3084ec1d7b3c76bc870d5] | committer: Rémi Denis-Courmont
libav: use vlc_strerror_c()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9ce4212b20f17e6879d3084ec1d7b3c76bc870d5
---
modules/access/avio.c | 21 ++++++++++-----------
modules/demux/avformat/demux.c | 8 ++++----
modules/demux/avformat/mux.c | 4 ++--
3 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/modules/access/avio.c b/modules/access/avio.c
index 6b2276d..380d20d 100644
--- a/modules/access/avio.c
+++ b/modules/access/avio.c
@@ -163,8 +163,8 @@ int OpenAvio(vlc_object_t *object)
av_dict_free(&options);
#endif
if (ret < 0) {
- errno = AVUNERROR(ret);
- msg_Err(access, "Failed to open %s: %m", url);
+ msg_Err(access, "Failed to open %s: %s", url,
+ vlc_strerror_c(AVUNERROR(ret)));
free(url);
goto error;
}
@@ -319,22 +319,20 @@ static ssize_t Write(sout_access_out_t *p_access, block_t *p_buffer)
{
access_sys_t *p_sys = (access_sys_t*)p_access->p_sys;
size_t i_write = 0;
+ int val;
while (p_buffer != NULL) {
block_t *p_next = p_buffer->p_next;
#if LIBAVFORMAT_VERSION_MAJOR < 54
- int written = url_write(p_sys->context, p_buffer->p_buffer, p_buffer->i_buffer);
- if (written < 0) {
- errno = AVUNERROR(written);
+ val = url_write(p_sys->context, p_buffer->p_buffer, p_buffer->i_buffer);
+ if (val < 0)
goto error;
- }
i_write += written;
#else
avio_write(p_sys->context, p_buffer->p_buffer, p_buffer->i_buffer);
avio_flush(p_sys->context);
- if (p_sys->context->error) {
- errno = AVUNERROR(p_sys->context->error);
+ if ((val = p_sys->context->error) != 0) {
p_sys->context->error = 0; /* FIXME? */
goto error;
}
@@ -349,7 +347,8 @@ static ssize_t Write(sout_access_out_t *p_access, block_t *p_buffer)
return i_write;
error:
- msg_Err(p_access, "Wrote only %zu bytes (%m)", i_write);
+ msg_Err(p_access, "Wrote only %zu bytes: %s", i_write,
+ vlc_strerror_c(AVUNERROR(val)));
block_ChainRelease( p_buffer );
return i_write;
}
@@ -368,8 +367,8 @@ static int Seek(access_t *access, uint64_t position)
else
ret = avio_seek(sys->context, position, SEEK_SET);
if (ret < 0) {
- errno = AVUNERROR(ret);
- msg_Err(access, "Seek to %"PRIu64" failed: %m", position);
+ msg_Err(access, "Seek to %"PRIu64" failed: %s", position,
+ vlc_strerror_c(AVUNERROR(ret)));
if (sys->size == 0 || position != sys->size)
return VLC_EGENERIC;
}
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 501003d..40d9e07 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -223,8 +223,8 @@ int OpenDemux( vlc_object_t *p_this )
if( error < 0 )
{
- errno = AVUNERROR(error);
- msg_Err( p_demux, "Could not open %s: %m", psz_url );
+ msg_Err( p_demux, "Could not open %s: %s", psz_url,
+ vlc_strerror_c(AVUNERROR(error)) );
p_sys->ic = NULL;
free( psz_url );
CloseDemux( p_this );
@@ -266,8 +266,8 @@ int OpenDemux( vlc_object_t *p_this )
if( error < 0 )
{
- errno = AVUNERROR(error);
- msg_Warn( p_demux, "Could not find stream info: %m" );
+ msg_Warn( p_demux, "Could not find stream info: %s",
+ vlc_strerror_c(AVUNERROR(error)) );
}
for( i = 0; i < p_sys->ic->nb_streams; i++ )
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index c422492..f451eae 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -340,8 +340,8 @@ static int Mux( sout_mux_t *p_mux )
av_dict_free(&options);
if( error < 0 )
{
- errno = AVUNERROR(error);
- msg_Err( p_mux, "could not write header: %m" );
+ msg_Err( p_mux, "could not write header: %s",
+ vlc_strerror_c(AVUNERROR(error)) );
p_sys->b_write_header = false;
p_sys->b_error = true;
return VLC_EGENERIC;
More information about the vlc-commits
mailing list