FIRE-17812: Increase sounds length to 60s on OpenSim

master
Ansariel 2016-04-20 13:35:57 +02:00
parent 5a84fe5c44
commit f1469a95bb
15 changed files with 44 additions and 19 deletions

View File

@ -66,7 +66,10 @@
#endif
S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& error_msg)
// <FS:Ansariel> FIRE-17812: Increase sounds length to 60s on OpenSim
//S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& error_msg)
S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& error_msg, bool is_in_secondlife)
// </FS:Ansariel>
{
U16 num_channels = 0;
U32 sample_rate = 0;
@ -189,7 +192,10 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro
F32 clip_length = (F32)raw_data_length/(F32)bytes_per_sec;
if (clip_length > LLVORBIS_CLIP_MAX_TIME)
// <FS:Ansariel> FIRE-17812: Increase sounds length to 60s on OpenSim
//if (clip_length > LLVORBIS_CLIP_MAX_TIME)
if (clip_length > (is_in_secondlife ? LLVORBIS_CLIP_MAX_TIME : LLVORBIS_CLIP_MAX_TIME_OPENSIM))
// </FS:Ansariel>
{
error_msg = "SoundFileInvalidTooLong";
return(LLVORBISENC_CLIP_TOO_LONG);
@ -198,7 +204,10 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro
return(LLVORBISENC_NOERR);
}
S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname)
// <FS:Ansariel> FIRE-17812: Increase sounds length to 60s on OpenSim
//S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname)
S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname, bool is_in_secondlife)
// </FS:Ansariel>
{
#define READ_BUFFER 1024
unsigned char readbuffer[READ_BUFFER*4+44]; /* out of the data segment, not the stack */ /*Flawfinder: ignore*/
@ -222,7 +231,10 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname
S32 format_error = 0;
std::string error_msg;
if ((format_error = check_for_invalid_wav_formats(in_fname, error_msg)))
// <FS:Ansariel> FIRE-17812: Increase sounds length to 60s on OpenSim
//if ((format_error = check_for_invalid_wav_formats(in_fname, error_msg)))
if ((format_error = check_for_invalid_wav_formats(in_fname, error_msg, is_in_secondlife)))
// </FS:Ansariel>
{
LL_WARNS() << error_msg << ": " << in_fname << LL_ENDL;
return(format_error);

View File

@ -41,6 +41,7 @@ const S32 LLVORBISENC_CLIP_TOO_LONG = 10; // source file is too l
const S32 LLVORBISENC_CHUNK_SIZE_ERR = 11; // chunk size is wrong
const F32 LLVORBIS_CLIP_MAX_TIME = 10.0f;
const F32 LLVORBIS_CLIP_MAX_TIME_OPENSIM = 60.0f; // <FS:Ansariel> FIRE-17812: Increase sounds length to 60s on OpenSim
const U8 LLVORBIS_CLIP_MAX_CHANNELS = 2;
const U32 LLVORBIS_CLIP_SAMPLE_RATE = 44100;
const U32 LLVORBIS_CLIP_MAX_SAMPLES_PER_CHANNEL = (U32)(LLVORBIS_CLIP_MAX_TIME * LLVORBIS_CLIP_SAMPLE_RATE);
@ -52,8 +53,12 @@ const size_t LLVORBIS_CLIP_MAX_SAMPLE_DATA = LLVORBIS_CLIP_MAX_SAMPL
const size_t LLVORBIS_CLIP_REJECT_SAMPLES = LLVORBIS_CLIP_MAX_SAMPLES * 3;
const size_t LLVORBIS_CLIP_REJECT_SIZE = LLVORBIS_CLIP_MAX_SAMPLE_DATA * 3;
S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& error_msg);
S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname);
// <FS:Ansariel> FIRE-17812: Increase sounds length to 60s on OpenSim
//S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& error_msg);
//S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname);
S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& error_msg, bool is_in_secondlife);
S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname, bool is_in_secondlife);
// </FS:Ansariel>
#endif

View File

@ -51,6 +51,8 @@
#include "llpreviewgesture.h"
#include "llcoproceduremanager.h"
#include "llviewernetwork.h"
void dialog_refresh_all();
LLResourceUploadInfo::LLResourceUploadInfo(LLTransactionID transactId,
@ -392,7 +394,10 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile()
LL_INFOS() << "Attempting to encode wav as an ogg file" << LL_ENDL;
encodeResult = encode_vorbis_file(getFileName(), filename);
// <FS:Ansariel> FIRE-17812: Increase sounds length to 60s on OpenSim
//encodeResult = encode_vorbis_file(getFileName(), filename);
encodeResult = encode_vorbis_file(getFileName(), filename, LLGridManager::instance().isInSecondLife());
// </FS:Ansariel>
if (LLVORBISENC_NOERR != encodeResult)
{

View File

@ -80,6 +80,8 @@
#include "llinventorydefines.h"
#include "llviewernetwork.h"
class LLFileEnableUpload : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@ -465,11 +467,12 @@ static void show_floater_callback(const std::string& floater, const std::string&
{
// pre-qualify wavs to make sure the format is acceptable
std::string error_msg;
if (check_for_invalid_wav_formats(filename,error_msg))
if (check_for_invalid_wav_formats(filename, error_msg, LLGridManager::instance().isInSecondLife()))
{
LL_INFOS() << error_msg << ": " << filename << LL_ENDL;
LLSD args;
args["FILE"] = filename;
args["MAX_LENGTH"] = llformat("%.0f", (LLGridManager::instance().isInSecondLife() ? LLVORBIS_CLIP_MAX_TIME : LLVORBIS_CLIP_MAX_TIME_OPENSIM));
LLNotificationsUtil::add( error_msg, args );
return;
}

View File

@ -836,7 +836,7 @@ Erwartet wurde [VALIDS]
[FILE]
</notification>
<notification name="SoundFileInvalidTooLong">
Audiodatei ist zu lang (max. 10 Sekunden):
Audiodatei ist zu lang (max. [MAX_LENGTH] Sekunden):
[FILE]
</notification>
<notification name="ProblemWithFile">

View File

@ -2144,7 +2144,7 @@ Wrong chunk size in WAV file:
icon="alertmodal.tga"
name="SoundFileInvalidTooLong"
type="alertmodal">
Audio file is too long (10 second maximum):
Audio file is too long ([MAX_LENGTH] second maximum):
[FILE]
<tag>fail</tag>
</notification>

View File

@ -839,7 +839,7 @@ Se admiten [VALIDS]
[FILE]
</notification>
<notification name="SoundFileInvalidTooLong">
El archivo de audio es demasiado largo (debe ser como máximo de10 segundos):
El archivo de audio es demasiado largo (debe ser como máximo de [MAX_LENGTH] segundos):
[FILE]
</notification>
<notification name="ProblemWithFile">

View File

@ -602,7 +602,7 @@ Wrong chunk size in WAV file:
[FILE]
</notification>
<notification name="SoundFileInvalidTooLong">
Audio file is too long (10 second maximum):
Audio file is too long ([MAX_LENGTH] second maximum):
[FILE]
</notification>
<notification name="ProblemWithFile">

View File

@ -796,7 +796,7 @@ Attese [VALIDS]
[FILE]
</notification>
<notification name="SoundFileInvalidTooLong">
Il file audio è troppo lungo (deve essere al massimo 10 secondi):
Il file audio è troppo lungo (deve essere al massimo [MAX_LENGTH] secondi):
[FILE]
</notification>
<notification name="ProblemWithFile">

View File

@ -834,7 +834,7 @@ L$ が不足しているのでこのグループに参加することができ
[FILE]
</notification>
<notification name="SoundFileInvalidTooLong">
オーディオファイルが長すぎます。(最大 10 秒):
オーディオファイルが長すぎます。(最大 [MAX_LENGTH] 秒):
[FILE]
</notification>
<notification name="ProblemWithFile">

View File

@ -759,7 +759,7 @@ Oczekiwane: [VALIDS]
[FILE]
</notification>
<notification name="SoundFileInvalidTooLong">
Plik audio jest zbyt długi (10 sekund maksimum):
Plik audio jest zbyt długi ([MAX_LENGTH] sekund maksimum):
[FILE]
</notification>
<notification name="ProblemWithFile">

View File

@ -792,7 +792,7 @@ Esperada [VALIDS]
[FILE]
</notification>
<notification name="SoundFileInvalidTooLong">
Arquivo de áudio é muito longo (no máximo 10 segundos):
Arquivo de áudio é muito longo (no máximo [MAX_LENGTH] segundos):
[FILE]
</notification>
<notification name="ProblemWithFile">

View File

@ -840,7 +840,7 @@
[FILE]
</notification>
<notification name="SoundFileInvalidTooLong">
Аудиофайл слишком длинный (максимум 10 секунд):
Аудиофайл слишком длинный (максимум [MAX_LENGTH] секунд):
[FILE]
</notification>
<notification name="ProblemWithFile">

View File

@ -798,7 +798,7 @@ Beklenen [VALIDS]
[FILE]
</notification>
<notification name="SoundFileInvalidTooLong">
Ses dosyası çok uzun (En fazla 10 saniye olmalı):
Ses dosyası çok uzun (En fazla [MAX_LENGTH] saniye olmalı):
[FILE]
</notification>
<notification name="ProblemWithFile">

View File

@ -798,7 +798,7 @@
[FILE]
</notification>
<notification name="SoundFileInvalidTooLong">
音頻檔太長(最大值 10 秒):
音頻檔太長(最大值 [MAX_LENGTH] 秒):
[FILE]
</notification>
<notification name="ProblemWithFile">