(2),\\r
(48000),\\r
(2),\\r
- (static_cast<size_t>(48000.0*2.0/((double)scale/(double)duration)))\\r
+ (static_cast<size_t>(48000.0*2.0/((double)scale/(double)duration)+0.99))\\r
}\r
\r
namespace caspar { namespace core {\r
\r
\r
/* File created by MIDL compiler version 7.00.0555 */\r
-/* at Tue Jun 21 16:03:08 2011\r
+/* at Thu Jun 23 10:58:47 2011\r
*/\r
/* Compiler settings for interop\DeckLinkAPI.idl:\r
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 \r
\r
\r
/* File created by MIDL compiler version 7.00.0555 */\r
-/* at Tue Jun 21 16:03:08 2011\r
+/* at Thu Jun 23 10:58:47 2011\r
*/\r
/* Compiler settings for interop\DeckLinkAPI.idl:\r
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 \r
input& input_;\r
AVCodecContext& codec_context_; \r
const core::video_format_desc format_desc_;\r
- std::vector<int16_t> current_chunk_; \r
+\r
+ std::vector<int16_t, tbb::cache_aligned_allocator<int16_t>> current_chunk_; \r
+\r
size_t frame_number_;\r
bool wait_for_eof_;\r
+\r
+ std::vector<int16_t, tbb::cache_aligned_allocator<int16_t>> buffer_;\r
public:\r
explicit implementation(input& input, const core::video_format_desc& format_desc) \r
: input_(input)\r
, format_desc_(format_desc) \r
, frame_number_(0)\r
, wait_for_eof_(false)\r
+ , buffer_(4*format_desc_.audio_sample_rate*2+FF_INPUT_BUFFER_PADDING_SIZE/2, 0)\r
{\r
if(codec_context_.sample_rate != static_cast<int>(format_desc_.audio_sample_rate) || \r
codec_context_.channels != static_cast<int>(format_desc_.audio_channels))\r
\r
if(wait_for_eof_)\r
return result;\r
- \r
- auto s = current_chunk_.size();\r
- current_chunk_.resize(s + 4*format_desc_.audio_sample_rate*2+FF_INPUT_BUFFER_PADDING_SIZE/2, 0);\r
- \r
- int written_bytes = (current_chunk_.size() - s)*2 - FF_INPUT_BUFFER_PADDING_SIZE;\r
- const int errn = avcodec_decode_audio3(&codec_context_, ¤t_chunk_[s], &written_bytes, audio_packet.get());\r
+ \r
+ int written_bytes = buffer_.size();\r
+ const int errn = avcodec_decode_audio3(&codec_context_, buffer_.data(), &written_bytes, audio_packet.get());\r
if(errn < 0)\r
{ \r
BOOST_THROW_EXCEPTION(\r
boost::errinfo_errno(AVUNERROR(errn)));\r
}\r
\r
- current_chunk_.resize(s + written_bytes/2);\r
+ current_chunk_.insert(current_chunk_.begin(), buffer_.begin(), buffer_.begin() + written_bytes/2);\r
\r
const auto last = current_chunk_.end() - current_chunk_.size() % format_desc_.audio_samples_per_frame;\r
\r
{ \r
if(preroll_count_ < input_.capacity())\r
{\r
- while(input_.try_push(std::vector<short>(static_cast<size_t>(48000.0f/format_desc_.fps)*2, 0)))\r
+ while(input_.try_push(std::vector<short>(format_desc_.audio_samples_per_frame, 0)))\r
++preroll_count_;\r
}\r
\r
if(!frame->audio_data().empty())\r
input_.push(std::vector<short>(frame->audio_data().begin(), frame->audio_data().end())); \r
else\r
- input_.push(std::vector<short>(3840, 0)); //static_cast<size_t>(48000.0f/format_desc_.fps)*2\r
+ input_.push(std::vector<short>(format_desc_.audio_samples_per_frame, 0)); //static_cast<size_t>(48000.0f/format_desc_.fps)*2\r
}\r
\r
size_t buffer_depth() const{return 3;}\r
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)tmp\$(Configuration)\</IntDir>\r
<IntDir Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">$(ProjectDir)tmp\$(Configuration)\</IntDir>\r
<IntDir Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">$(ProjectDir)tmp\$(Configuration)\</IntDir>\r
- <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\;..\..\dependencies\boost_1_44_0\;..\..\dependencies\ffmpeg 0.6\include\;..\..\dependencies\tbb\include\;..\..\dependencies\SFML-1.6\include\;$(IncludePath)</IncludePath>\r
- <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\;..\..\dependencies\boost_1_44_0\;..\..\dependencies\ffmpeg 0.6\include\;..\..\dependencies\tbb\include\;..\..\dependencies\SFML-1.6\include\;$(IncludePath)</IncludePath>\r
- <IncludePath Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">..\..\;..\..\dependencies\boost_1_44_0\;..\..\dependencies\ffmpeg 0.6\include\;..\..\dependencies\tbb\include\;..\..\dependencies\SFML-1.6\include\;$(IncludePath)</IncludePath>\r
- <IncludePath Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">..\..\;..\..\dependencies\boost_1_44_0\;..\..\dependencies\ffmpeg 0.6\include\;..\..\dependencies\tbb\include\;..\..\dependencies\SFML-1.6\include\;$(IncludePath)</IncludePath>\r
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\dependencies\boost_1_44_0\stage\lib\;..\..\dependencies\ffmpeg 0.6\lib\;..\..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>\r
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\dependencies\boost_1_44_0\stage\lib\;..\..\dependencies\ffmpeg 0.6\lib\;..\..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>\r
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">..\..\dependencies\boost_1_44_0\stage\lib\;..\..\dependencies\ffmpeg 0.6\lib\;..\..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>\r
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">..\..\dependencies\boost_1_44_0\stage\lib\;..\..\dependencies\ffmpeg 0.6\lib\;..\..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>\r
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\;..\..\dependencies\boost_1_44_0\;..\..\dependencies\ffmpeg 0.7\include\;..\..\dependencies\tbb\include\;..\..\dependencies\SFML-1.6\include\;$(IncludePath)</IncludePath>\r
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\;..\..\dependencies\boost_1_44_0\;..\..\dependencies\ffmpeg 0.7\include\;..\..\dependencies\tbb\include\;..\..\dependencies\SFML-1.6\include\;$(IncludePath)</IncludePath>\r
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">..\..\;..\..\dependencies\boost_1_44_0\;..\..\dependencies\ffmpeg 0.7\include\;..\..\dependencies\tbb\include\;..\..\dependencies\SFML-1.6\include\;$(IncludePath)</IncludePath>\r
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">..\..\;..\..\dependencies\boost_1_44_0\;..\..\dependencies\ffmpeg 0.7\include\;..\..\dependencies\tbb\include\;..\..\dependencies\SFML-1.6\include\;$(IncludePath)</IncludePath>\r
+ <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\dependencies\boost_1_44_0\stage\lib\;..\..\dependencies\ffmpeg 0.7\lib\;..\..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>\r
+ <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\dependencies\boost_1_44_0\stage\lib\;..\..\dependencies\ffmpeg 0.7\lib\;..\..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>\r
+ <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">..\..\dependencies\boost_1_44_0\stage\lib\;..\..\dependencies\ffmpeg 0.7\lib\;..\..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>\r
+ <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">..\..\dependencies\boost_1_44_0\stage\lib\;..\..\dependencies\ffmpeg 0.7\lib\;..\..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>\r
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)bin\$(Configuration)\</OutDir>\r
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)bin\$(Configuration)\</OutDir>\r
<OutDir Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">$(ProjectDir)bin\$(Configuration)\</OutDir>\r