]> git.sesse.net Git - casparcg/commitdiff
2.0 NTSC audio plays but is distorted.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 23 Jun 2011 09:56:42 +0000 (09:56 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 23 Jun 2011 09:56:42 +0000 (09:56 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@945 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

core/video_format.cpp
modules/decklink/interop/DeckLinkAPI_h.h
modules/decklink/interop/DeckLinkAPI_i.c
modules/ffmpeg/producer/audio/audio_decoder.cpp
modules/oal/consumer/oal_consumer.cpp
modules/silverlight/silverlight.vcxproj

index e9a62d36e88a7bf1c135e9bb48a685cc9f45db54..4d6f100dde97145afe597f6c1cdc6771ad0f1853 100644 (file)
@@ -41,7 +41,7 @@
        (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
index 9218a2e6544ba7b64bb9213ef839e0caa66aaf33..43245135a701d9a74c00de329965eceff9e6a813 100644 (file)
@@ -4,7 +4,7 @@
 \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
index d1fba2e09753764066805b14c4ef56d2c9d47475..fe72b1cbe7a967f77513d2814dbeb8acd4f0c818 100644 (file)
@@ -6,7 +6,7 @@
 \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
index 0aab9c8958bef33d2c162a8fa9b19d685edcc9de..4144922db99b5eba7b31b285616b111c1c5aeec7 100644 (file)
@@ -43,9 +43,13 @@ struct audio_decoder::implementation : boost::noncopyable
        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
@@ -53,6 +57,7 @@ public:
                , 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
@@ -91,12 +96,9 @@ public:
 \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_, &current_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
@@ -105,7 +107,7 @@ public:
                                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
index 9b60f725be5a94615b44630eeedeafcf3dd8e0b3..d09c0865777cc8ef74860a4dab70e447a2218d2f 100644 (file)
@@ -78,14 +78,14 @@ public:
        {                       \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
index 2bdaa32bf36dc873d55261b81344386ac7b46ed4..a9bfe5c86ea2d13d7f045fd956abc17fab64260b 100644 (file)
     <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