Commit 9ce4212b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

libav: use vlc_strerror_c()

parent a059cf56
...@@ -163,8 +163,8 @@ int OpenAvio(vlc_object_t *object) ...@@ -163,8 +163,8 @@ int OpenAvio(vlc_object_t *object)
av_dict_free(&options); av_dict_free(&options);
#endif #endif
if (ret < 0) { if (ret < 0) {
errno = AVUNERROR(ret); msg_Err(access, "Failed to open %s: %s", url,
msg_Err(access, "Failed to open %s: %m", url); vlc_strerror_c(AVUNERROR(ret)));
free(url); free(url);
goto error; goto error;
} }
...@@ -319,22 +319,20 @@ static ssize_t Write(sout_access_out_t *p_access, block_t *p_buffer) ...@@ -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; access_sys_t *p_sys = (access_sys_t*)p_access->p_sys;
size_t i_write = 0; size_t i_write = 0;
int val;
while (p_buffer != NULL) { while (p_buffer != NULL) {
block_t *p_next = p_buffer->p_next; block_t *p_next = p_buffer->p_next;
#if LIBAVFORMAT_VERSION_MAJOR < 54 #if LIBAVFORMAT_VERSION_MAJOR < 54
int written = url_write(p_sys->context, p_buffer->p_buffer, p_buffer->i_buffer); val = url_write(p_sys->context, p_buffer->p_buffer, p_buffer->i_buffer);
if (written < 0) { if (val < 0)
errno = AVUNERROR(written);
goto error; goto error;
}
i_write += written; i_write += written;
#else #else
avio_write(p_sys->context, p_buffer->p_buffer, p_buffer->i_buffer); avio_write(p_sys->context, p_buffer->p_buffer, p_buffer->i_buffer);
avio_flush(p_sys->context); avio_flush(p_sys->context);
if (p_sys->context->error) { if ((val = p_sys->context->error) != 0) {
errno = AVUNERROR(p_sys->context->error);
p_sys->context->error = 0; /* FIXME? */ p_sys->context->error = 0; /* FIXME? */
goto error; goto error;
} }
...@@ -349,7 +347,8 @@ static ssize_t Write(sout_access_out_t *p_access, block_t *p_buffer) ...@@ -349,7 +347,8 @@ static ssize_t Write(sout_access_out_t *p_access, block_t *p_buffer)
return i_write; return i_write;
error: 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 ); block_ChainRelease( p_buffer );
return i_write; return i_write;
} }
...@@ -368,8 +367,8 @@ static int Seek(access_t *access, uint64_t position) ...@@ -368,8 +367,8 @@ static int Seek(access_t *access, uint64_t position)
else else
ret = avio_seek(sys->context, position, SEEK_SET); ret = avio_seek(sys->context, position, SEEK_SET);
if (ret < 0) { if (ret < 0) {
errno = AVUNERROR(ret); msg_Err(access, "Seek to %"PRIu64" failed: %s", position,
msg_Err(access, "Seek to %"PRIu64" failed: %m", position); vlc_strerror_c(AVUNERROR(ret)));
if (sys->size == 0 || position != sys->size) if (sys->size == 0 || position != sys->size)
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
...@@ -223,8 +223,8 @@ int OpenDemux( vlc_object_t *p_this ) ...@@ -223,8 +223,8 @@ int OpenDemux( vlc_object_t *p_this )
if( error < 0 ) if( error < 0 )
{ {
errno = AVUNERROR(error); msg_Err( p_demux, "Could not open %s: %s", psz_url,
msg_Err( p_demux, "Could not open %s: %m", psz_url ); vlc_strerror_c(AVUNERROR(error)) );
p_sys->ic = NULL; p_sys->ic = NULL;
free( psz_url ); free( psz_url );
CloseDemux( p_this ); CloseDemux( p_this );
...@@ -266,8 +266,8 @@ int OpenDemux( vlc_object_t *p_this ) ...@@ -266,8 +266,8 @@ int OpenDemux( vlc_object_t *p_this )
if( error < 0 ) if( error < 0 )
{ {
errno = AVUNERROR(error); msg_Warn( p_demux, "Could not find stream info: %s",
msg_Warn( p_demux, "Could not find stream info: %m" ); vlc_strerror_c(AVUNERROR(error)) );
} }
for( i = 0; i < p_sys->ic->nb_streams; i++ ) for( i = 0; i < p_sys->ic->nb_streams; i++ )
......
...@@ -340,8 +340,8 @@ static int Mux( sout_mux_t *p_mux ) ...@@ -340,8 +340,8 @@ static int Mux( sout_mux_t *p_mux )
av_dict_free(&options); av_dict_free(&options);
if( error < 0 ) if( error < 0 )
{ {
errno = AVUNERROR(error); msg_Err( p_mux, "could not write header: %s",
msg_Err( p_mux, "could not write header: %m" ); vlc_strerror_c(AVUNERROR(error)) );
p_sys->b_write_header = false; p_sys->b_write_header = false;
p_sys->b_error = true; p_sys->b_error = true;
return VLC_EGENERIC; return VLC_EGENERIC;
......
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