OSDN Git Service

コンパイルが通ったバージョン。まだ全然できていない。 master
authorsfpg <sfpg@users.sourceforge.jp>
Mon, 18 Feb 2013 21:24:35 +0000 (06:24 +0900)
committersfpg <sfpg@users.sourceforge.jp>
Mon, 18 Feb 2013 21:24:35 +0000 (06:24 +0900)
SF.props
mfsample/mfsample.vcxproj
mfsample/player.cpp
mfsample/player.h
mfsample/stdafx.h
mfsample/toplevel_window.cpp

index 34bcf5b..0760ec7 100644 (file)
--- a/SF.props
+++ b/SF.props
@@ -3,7 +3,7 @@
   <ImportGroup Label="PropertySheets" />
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
-    <IncludePath>H:\libs\DirectXTK\Inc;H:\libs\boost\include\boost-1_52;H:\libs\xbyak\xbyak;H:\libs\zlib125\zlib-1.2.5;H:\libs\lpng150\lpng150;$(IncludePath)</IncludePath>
+    <IncludePath>H:\libs\DirectXTK\Inc;H:\libs\boost\include\boost-1_53;H:\libs\xbyak\xbyak;H:\libs\zlib125\zlib-1.2.5;H:\libs\lpng150\lpng150;$(IncludePath)</IncludePath>
   </PropertyGroup>
   <PropertyGroup>
     <LibraryPath>H:\libs\zlib125\zlib-1.2.5;H:\libs\boost\lib;$(LibraryPath)</LibraryPath>
index 20902e6..a5cadf9 100644 (file)
     <ClCompile Include="info_tab_dialog.cpp" />
     <ClCompile Include="jumplist.cpp" />
     <ClCompile Include="logger.cpp" />
+    <ClCompile Include="media_foundation.cpp" />
     <ClCompile Include="player.cpp" />
+    <ClCompile Include="sfmf.cpp" />
     <ClCompile Include="sf_com.cpp" />
     <ClCompile Include="sf_windows.cpp" />
     <ClCompile Include="stdafx.cpp">
     <ClInclude Include="info_tab_dialog.h" />
     <ClInclude Include="jumplist.h" />
     <ClInclude Include="logger.h" />
+    <ClInclude Include="media_foundation.h" />
     <ClInclude Include="message_loop.h" />
     <ClInclude Include="player.h" />
     <ClInclude Include="resource.h" />
+    <ClInclude Include="sfmf.h" />
     <ClInclude Include="sf_com.h" />
     <ClInclude Include="sf_memory.h" />
     <ClInclude Include="sf_windows.h" />
index 8a2f885..18cab3a 100644 (file)
@@ -9,6 +9,7 @@
 #include "stdafx.h"
 #include "Player.h"
 #include <assert.h>
+#include <iostream>
 
 #if _DEBUG
 #define _CRTDBG_MAP_ALLOC
 #define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
 #endif
 
-#pragma comment(lib, "shlwapi")
-#pragma comment(lib,"Mfplat.lib")
-#pragma comment(lib,"Mf.lib")
-#pragma comment(lib,"Mfuuid.lib")
-#pragma comment(lib,"Strmiids.lib")
+#include "sf_memory.h"
 
 //Mf.lib Mfidl.h
 namespace sf {
   namespace player {
-    template <class Q>
-    HRESULT GetEventObject(IMFMediaEvent *pEvent, Q **ppObject)
-    {
-      *ppObject = NULL;   // zero output
+    void print_mft();
 
-      PROPVARIANT var;
-      HRESULT hr = pEvent->GetValue(&var);
-      if (SUCCEEDED(hr))
-      {
-        if (var.vt == VT_UNKNOWN)
-        {
-          hr = var.punkVal->QueryInterface(ppObject);
-        }
-        else
-        {
-          hr = MF_E_INVALIDTYPE;
-        }
-        PropVariantClear(&var);
-      }
-      return hr;
-    }
 
     IMFMediaSourcePtr CreateMediaSource(const std::wstring& pszURL);
 
@@ -66,6 +44,7 @@ namespace sf {
         throw win32_error_exception(E_OUTOFMEMORY);
       }
       p->process_event(ev::Init());
+      print_mft();
 //      p->processInitialize();
       return p;
     }
@@ -180,7 +159,6 @@ namespace sf {
 //      {
 //       throw win32_error_exception(E_UNEXPECTED);
 //      }
-
       THROW_IF_ERR(m_pSession->Pause());
       OnPause()(static_cast<this_type&>(*this));
       
@@ -678,5 +656,69 @@ namespace sf {
       // Return the IMFTopology pointer to the caller.
       return pTopology;
     }
+
+  void print_mft_(const GUID& guid,std::wfstream& out)
+  {
+    co_task_memory<IMFActivate*> activate;
+
+    UINT32 count = 0;
+    
+    HRESULT hr = MFTEnumEx(guid,MFT_ENUM_FLAG_ALL,NULL,NULL,&activate,&count);
+    
+    if(SUCCEEDED(hr) && count > 0)
+    {
+      for(int i = 0; i < count;++i)
+      {
+        UINT32 l = 0;
+        UINT32 l1 = 0;
+        activate.get()[i]->GetStringLength(MFT_FRIENDLY_NAME_Attribute,&l);
+        std::unique_ptr<wchar_t[]> name(new wchar_t[l+1]);
+        memset(name.get(),0,l+1);
+        hr = activate.get()[i]->GetString(MFT_FRIENDLY_NAME_Attribute,name.get(),l+1,&l1);
+        out << name.get() << std::endl;
+        activate.get()[i]->Release();
+      }
+      //CoTaskMemFree(activate);
+    }
   }
+
+  void print_mft()
+  {
+    std::wfstream out(L"MFT.txt",std::ios_base::out | std::ios_base::trunc);
+
+    out << std::endl << "**" << L"MFT_CATEGORY_AUDIO_DECODER" << L"**" << std::endl << std::endl;
+
+    print_mft_(MFT_CATEGORY_AUDIO_DECODER,out);
+
+    out << std::endl << L"**" << L"MFT_CATEGORY_AUDIO_EFFECT" << L"**" << std::endl << std::endl;
+    print_mft_(MFT_CATEGORY_AUDIO_EFFECT,out);
+
+    out << std::endl << L"**" << L"MFT_CATEGORY_AUDIO_ENCODER" << L"**" << std::endl << std::endl;
+    print_mft_(MFT_CATEGORY_AUDIO_ENCODER,out);
+
+    out << std::endl << L"**" << L"MFT_CATEGORY_DEMULTIPLEXER" << L"**" << std::endl << std::endl;
+    print_mft_(MFT_CATEGORY_DEMULTIPLEXER,out);
+
+    out << std::endl << L"**" << L"MFT_CATEGORY_MULTIPLEXER" << L"**" << std::endl << std::endl;
+    print_mft_(MFT_CATEGORY_MULTIPLEXER,out);
+
+    out << std::endl << L"**" << L"MFT_CATEGORY_OTHER" << L"**" << std::endl << std::endl;
+    print_mft_(MFT_CATEGORY_OTHER,out);
+
+    out << std::endl << L"**" << L"MFT_CATEGORY_VIDEO_DECODER" << L"**" << std::endl << std::endl;
+    print_mft_(MFT_CATEGORY_VIDEO_DECODER,out);
+
+    out << std::endl << L"**" << L"MFT_CATEGORY_VIDEO_EFFECT" << L"**" << std::endl << std::endl;
+    print_mft_(MFT_CATEGORY_VIDEO_EFFECT,out);
+
+    out << std::endl << L"**" << L"MFT_CATEGORY_VIDEO_ENCODER" << L"**" << std::endl << std::endl;
+    print_mft_(MFT_CATEGORY_VIDEO_ENCODER,out);
+
+    out << std::endl << L"**" << L"MFT_CATEGORY_VIDEO_PROCESSOR" << L"**" << std::endl << std::endl;
+    print_mft_(MFT_CATEGORY_VIDEO_PROCESSOR,out);
+
+    out.close();
+  }
+}
+
 }
\ No newline at end of file
index 6bf1051..789b91c 100644 (file)
 #include <assert.h>\r
 #include <strsafe.h>\r
 \r
-// Media Foundation headers\r
-#include <mfapi.h>\r
-#include <mfidl.h>\r
-#include <mferror.h>\r
-#include <evr.h>\r
+#include "sfmf.h"\r
 \r
 #include "resource.h"\r
 \r
 #include <boost/msm/back/state_machine.hpp>\r
 #include <boost/msm/front/state_machine_def.hpp>\r
 \r
-_WRL_PTR_TYPEDEF(IMFMediaSession);\r
-_WRL_PTR_TYPEDEF(IMFMediaSource);\r
-_WRL_PTR_TYPEDEF(IMFVideoDisplayControl);\r
-_WRL_PTR_TYPEDEF(IMFTopology);\r
-_WRL_PTR_TYPEDEF(IMFPresentationDescriptor);\r
-_WRL_PTR_TYPEDEF(IMFMediaEvent);\r
-_WRL_PTR_TYPEDEF(IMFSourceResolver);\r
-_WRL_PTR_TYPEDEF(IMFStreamDescriptor);\r
-_WRL_PTR_TYPEDEF(IMFTopologyNode);\r
-_WRL_PTR_TYPEDEF(IMFActivate);\r
-_WRL_PTR_TYPEDEF(IMFMediaTypeHandler);\r
-//_WRL_PTR_TYPEDEF();\r
-//_WRL_PTR_TYPEDEF();\r
-\r
 namespace sf {\r
   namespace player {\r
     namespace msmf = boost::msm::front;\r
@@ -62,30 +44,6 @@ namespace sf {
     struct Stopped : msmf::state<> {};// \83Z\83b\83V\83\87\83\93\82Í\92â\8e~\82µ\82Ä\82¢\82é\81i\89\89\91t\89Â\94\\8fó\91Ô\82Å\82 \82é\81j\81B\r
     struct Closing : msmf::state<> {};// \83A\83v\83\8a\83P\81[\83V\83\87\83\93\82Í\83Z\83b\83V\83\87\83\93\82ð\95Â\82\82½\82ª\81AMESessionClosed\8fó\91Ô\82ð\91Ò\82Á\82Ä\82¢\82é\81B\r
 \r
-    // \83v\83\8d\83p\83e\83B\97p\83o\83\8a\83A\83\93\83g\82Ì\83\89\83b\83p\r
-    struct prop_variant \r
-    {\r
-      prop_variant()\r
-      {\r
-        PropVariantInit(&value_);// \r
-      }\r
-\r
-      ~prop_variant()\r
-      {\r
-        PropVariantClear(&value_);\r
-      }\r
-\r
-      PROPVARIANT* get(){ return &value_;};\r
-\r
-      PROPVARIANT* operator &(){return get();}\r
-\r
-      operator PROPVARIANT*() {return get();}\r
-\r
-    private:\r
-      PROPVARIANT value_;\r
-    };\r
-\r
-\r
     namespace ev \r
     {\r
       struct Init {}; // \8f\89\8aú\89»\83C\83x\83\93\83g\r
@@ -166,12 +124,13 @@ namespace sf {
 \r
       // Playback\r
       void initialize( ev::Init const& ev);\r
-      void       open_url( ev::OpenURL const& openurl);\r
-      void       play( ev::Play const& ev);\r
-      void       pause( ev::Pause const& ev);\r
-      void       stop( ev::Stop const& ev);\r
-      void       shutdown( ev::Close const& ev);\r
-      void  open_complete(ev::OpenComplete const&)\r
+      void open_url( ev::OpenURL const& openurl);\r
+      void play( ev::Play const& ev);\r
+      void resume( ev::Pause const& ev){play(ev::Play());};\r
+      void pause( ev::Pause const& ev);\r
+      void stop( ev::Stop const& ev);\r
+      void shutdown( ev::Close const& ev);\r
+      void open_complete(ev::OpenComplete const&)\r
       {\r
         OnOpenComplete()(static_cast<this_type&>(*this));\r
       }\r
@@ -220,11 +179,11 @@ struct transition_table : boost::mpl::vector
     a_row       <Started       ,ev::Pause         ,Paused         ,&sf::player::Player_::pause           >,\r
     a_row       <Started       ,ev::Stop          ,Stopped        ,&sf::player::Player_::stop            >,\r
     _row        <Started       ,ev::End           ,Stopped        >,\r
-    a_row       <Paused        ,ev::Play          ,Started        ,&sf::player::Player_::play            >,\r
+    a_row       <Paused        ,ev::Pause         ,Started        ,&sf::player::Player_::resume            >,\r
     a_row       <Paused        ,ev::Stop          ,Stopped        ,&sf::player::Player_::stop            >,\r
     a_row       <Stopped       ,ev::Play          ,Started        ,&sf::player::Player_::play            >,\r
     a_row       <Stopped       ,ev::OpenURL       ,OpenPending    ,&sf::player::Player_::open_url        >//,\r
//   a_row       <msmf::none    ,ev::Close         ,Closed         ,&Player_::shutdown>\r
  // a_row       <msmf::interrupt_state    ,ev::Close         ,Closed         ,&Player_::shutdown>\r
   >\r
 {};\r
       typedef Closed initial_state;\r
@@ -236,6 +195,12 @@ struct transition_table : boost::mpl::vector
         throw exception(L"No Transition");\r
       }\r
 \r
+      template <class FSM>\r
+      void no_transition(ev::Close const& e, FSM&,int state)\r
+      {\r
+        shutdown(ev::Close());\r
+      }\r
+\r
     };\r
 \r
     typedef boost::msm::back::state_machine< Player_ > Player;\r
index 49c1ccf..7736f98 100644 (file)
 #include <agents.h>\r
 \r
 #define _WRL_PTR_TYPEDEF(x) typedef Microsoft::WRL::ComPtr<x> x ## Ptr\r
+\r
+\r
+//_WRL_PTR_TYPEDEF();\r
+//_WRL_PTR_TYPEDEF();\r
index 11bc752..5101e8e 100644 (file)
@@ -371,21 +371,21 @@ namespace sf
       sf::player::PlayerPtr player = application::instance()->Player();\r
       player->OnOpenComplete().connect([this](sf::player::Player &) -> void\r
       {\r
-        this->player_ready();\r
+        player_ready();\r
       }\r
         );\r
 \r
       // 再生時イベントの処理\r
       player->OnStart().connect([this](sf::player::Player &) -> void \r
       {\r
-        this->play_();\r
+        play_();\r
       }\r
         );\r
 \r
       // Pauseイベントの処理\r
       player->OnPause().connect([this](sf::player::Player &) -> void \r
       {\r
-        this->pause_();\r
+        pause_();\r
       }\r
         );\r
 \r