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)
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;
}
......
......@@ -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++ )
......
......@@ -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;
......
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