mirror of
https://github.com/mpv-player/mpv
synced 2025-01-01 04:36:24 +01:00
af_fmt2str fixes (remove trailing space, call with size of buffer, not size-1)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14400 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
5817da7f59
commit
ba2f41e733
@ -164,6 +164,9 @@ char* af_fmt2str(int format, char* str, int size)
|
|||||||
i+=snprintf(&str[i],size-i,"int ");
|
i+=snprintf(&str[i],size-i,"int ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// remove trailing space
|
||||||
|
if (i > 0 && str[i - 1] == ' ')
|
||||||
|
i--;
|
||||||
str[i] = 0; // make sure it is 0 terminated.
|
str[i] = 0; // make sure it is 0 terminated.
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@ -268,7 +271,7 @@ static int check_format(int format)
|
|||||||
case(AF_FORMAT_MPEG2):
|
case(AF_FORMAT_MPEG2):
|
||||||
case(AF_FORMAT_AC3):
|
case(AF_FORMAT_AC3):
|
||||||
af_msg(AF_MSG_ERROR,"[format] Sample format %s not yet supported \n",
|
af_msg(AF_MSG_ERROR,"[format] Sample format %s not yet supported \n",
|
||||||
af_fmt2str(format,buf,255));
|
af_fmt2str(format,buf,256));
|
||||||
return AF_ERROR;
|
return AF_ERROR;
|
||||||
}
|
}
|
||||||
return AF_OK;
|
return AF_OK;
|
||||||
@ -295,9 +298,9 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
|
|||||||
(AF_OK != check_format(af->data->format)))
|
(AF_OK != check_format(af->data->format)))
|
||||||
return AF_ERROR;
|
return AF_ERROR;
|
||||||
|
|
||||||
af_msg(AF_MSG_VERBOSE,"[format] Changing sample format from %sto %s \n",
|
af_msg(AF_MSG_VERBOSE,"[format] Changing sample format from %s to %s\n",
|
||||||
af_fmt2str(((af_data_t*)arg)->format,buf1,255),
|
af_fmt2str(((af_data_t*)arg)->format,buf1,256),
|
||||||
af_fmt2str(af->data->format,buf2,255));
|
af_fmt2str(af->data->format,buf2,256));
|
||||||
|
|
||||||
af->data->rate = ((af_data_t*)arg)->rate;
|
af->data->rate = ((af_data_t*)arg)->rate;
|
||||||
af->data->nch = ((af_data_t*)arg)->nch;
|
af->data->nch = ((af_data_t*)arg)->nch;
|
||||||
@ -316,17 +319,17 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
|
|||||||
if ((data->format == AF_FORMAT_FLOAT_NE) &&
|
if ((data->format == AF_FORMAT_FLOAT_NE) &&
|
||||||
(af->data->format == AF_FORMAT_S16_NE))
|
(af->data->format == AF_FORMAT_S16_NE))
|
||||||
{
|
{
|
||||||
af_msg(AF_MSG_VERBOSE,"[format] Accelerated %sto %sconversion\n",
|
af_msg(AF_MSG_VERBOSE,"[format] Accelerated %s to %s conversion\n",
|
||||||
af_fmt2str(((af_data_t*)arg)->format,buf1,255),
|
af_fmt2str(((af_data_t*)arg)->format,buf1,256),
|
||||||
af_fmt2str(af->data->format,buf2,255));
|
af_fmt2str(af->data->format,buf2,256));
|
||||||
af->play = play_float_s16;
|
af->play = play_float_s16;
|
||||||
}
|
}
|
||||||
if ((data->format == AF_FORMAT_S16_NE) &&
|
if ((data->format == AF_FORMAT_S16_NE) &&
|
||||||
(af->data->format == AF_FORMAT_FLOAT_NE))
|
(af->data->format == AF_FORMAT_FLOAT_NE))
|
||||||
{
|
{
|
||||||
af_msg(AF_MSG_VERBOSE,"[format] Accelerated %sto %sconversion\n",
|
af_msg(AF_MSG_VERBOSE,"[format] Accelerated %s to %s conversion\n",
|
||||||
af_fmt2str(((af_data_t*)arg)->format,buf1,255),
|
af_fmt2str(((af_data_t*)arg)->format,buf1,256),
|
||||||
af_fmt2str(af->data->format,buf2,255));
|
af_fmt2str(af->data->format,buf2,256));
|
||||||
af->play = play_s16_float;
|
af->play = play_s16_float;
|
||||||
}
|
}
|
||||||
return AF_OK;
|
return AF_OK;
|
||||||
|
Loading…
Reference in New Issue
Block a user