[vlmc-devel] [PATCH] Add and integrate libvlc producer/consumer submodule

yikei lu luyikei.qmltu at gmail.com
Mon Jul 25 17:52:39 CEST 2016


Hi

Thanks for doing this! I'll check it later.

Regards,

2016-07-25 21:24 GMT+09:00 golpaw1 <golpaw1 at gmail.com>:
> This is a temporary (not production ready) patch that enables libvlc
> consumer in VLMC.
>
> Basically something's messed up either with consumer or VLMC, and rendering
> to two windows at once
> causes CPU usage to go bonkers, so I'm trying to debug that, and if someone
> wants to test my consumer
> as well, here is a patch that allows to do that.
>
> I moved producer+consumer to separate repo which is added as submodule in
> this patch.
>
> Please check TODO comment before using this patch.
>
>
> Best,
> Paweł
>
> 2016-07-25 14:20 GMT+02:00 Pawel Golinski <golpaw1 at gmail.com>:
>>
>> ---
>>  .gitmodules                    |  3 +++
>>  src/Backend/MLT/MLTBackend.cpp | 15 +++++++++++++++
>>  src/Backend/MLT/MLTOutput.cpp  | 10 ++++++++--
>>  src/Backend/MLT/MLTOutput.h    |  2 +-
>>  src/Backend/libvlc-mlt         |  1 +
>>  src/CMakeLists.txt             |  4 ++++
>>  6 files changed, 32 insertions(+), 3 deletions(-)
>>  create mode 160000 src/Backend/libvlc-mlt
>>
>> diff --git a/.gitmodules b/.gitmodules
>> index e69de29..ed28514 100644
>> --- a/.gitmodules
>> +++ b/.gitmodules
>> @@ -0,0 +1,3 @@
>> +[submodule "src/Backend/libvlc-mlt"]
>> +       path = src/Backend/libvlc-mlt
>> +       url = https://github.com/qiubit/libvlc-mlt.git
>> diff --git a/src/Backend/MLT/MLTBackend.cpp
>> b/src/Backend/MLT/MLTBackend.cpp
>> index 3d39930..7eb4202 100644
>> --- a/src/Backend/MLT/MLTBackend.cpp
>> +++ b/src/Backend/MLT/MLTBackend.cpp
>> @@ -43,6 +43,15 @@ using namespace Backend::MLT;
>>  static Backend::IBackend::LogHandler    staticLogHandler;
>>  static std::mutex                       logMutex;
>>
>> +extern "C" mlt_consumer consumer_libvlc_init( mlt_profile profile,
>> mlt_service_type type, const char *id, const void *arg );
>> +
>> +static mlt_properties metadata( mlt_service_type type, const char *id,
>> void *data )
>> +{
>> +    char file[ 4096 ];
>> +    snprintf( file, 4096, "%s%s", LIBVLC_MLT_MODULES_PATH, (char*)data );
>> +    return mlt_properties_parse_yaml( file );
>> +}
>> +
>>  IBackend*
>>  Backend::instance()
>>  {
>> @@ -54,6 +63,12 @@ MLTBackend::MLTBackend()
>>      m_mltRepo = Mlt::Factory::init();
>>      m_profile.setFrameRate( 2997, 100 );
>>
>> +    m_mltRepo->register_service( consumer_type, "libvlc",
>> (mlt_register_callback)consumer_libvlc_init );
>> +    m_mltRepo->register_service( consumer_type, "libvlc_window",
>> (mlt_register_callback)consumer_libvlc_init );
>> +    m_mltRepo->register_metadata( consumer_type, "libvlc", metadata,
>> (void*)"/libvlc/consumer_libvlc.yml" );
>> +    m_mltRepo->register_metadata( consumer_type, "libvlc_window",
>> metadata, (void*)"/libvlc/consumer_libvlc_window.yml" );
>> +
>> +
>>      for ( int i = 0; i < m_mltRepo->filters()->count(); ++i )
>>      {
>>          auto pro = std::unique_ptr<Mlt::Properties>( m_mltRepo->metadata(
>> filter_type, m_mltRepo->filters()->get_name( i ) ) );
>> diff --git a/src/Backend/MLT/MLTOutput.cpp b/src/Backend/MLT/MLTOutput.cpp
>> index c99e850..6626a52 100644
>> --- a/src/Backend/MLT/MLTOutput.cpp
>> +++ b/src/Backend/MLT/MLTOutput.cpp
>> @@ -31,10 +31,12 @@
>>
>>  #include <cassert>
>>
>> +#include <stdio.h>
>> +
>>  using namespace Backend::MLT;
>>
>>  MLTOutput::MLTOutput()
>> -    : MLTOutput( Backend::instance()->profile(), "sdl" )
>> +    : MLTOutput( Backend::instance()->profile(), "libvlc_window" )
>>  {
>>
>>  }
>> @@ -159,7 +161,11 @@ MLTOutput::isConnected() const
>>  void
>>  MLTSdlOutput::setWindowId( intptr_t id )
>>  {
>> -    consumer()->set( "window_id", std::to_string( id ).c_str() );
>> +    consumer()->set( "output_dst", (void *)id, 0 );
>> +    // TODO: Only Qt knows, which window type it spawns,
>> +    // so this function should take window id AS WELL AS
>> +    // window_type. Workaround - set window_type manually here.
>> +    consumer()->set( "window_type", "nsobject" );
>>  }
>>
>>  void
>> diff --git a/src/Backend/MLT/MLTOutput.h b/src/Backend/MLT/MLTOutput.h
>> index 79dcd9e..c0e9188 100644
>> --- a/src/Backend/MLT/MLTOutput.h
>> +++ b/src/Backend/MLT/MLTOutput.h
>> @@ -81,7 +81,7 @@ class MLTSdlOutput : public MLTOutput
>>  {
>>      public:
>>          MLTSdlOutput()
>> -            : MLTOutput( Backend::instance()->profile(), "sdl" ) { }
>> +            : MLTOutput( Backend::instance()->profile(), "libvlc_window"
>> ) { }
>>
>>          void setWindowId( intptr_t id );
>>  };
>> diff --git a/src/Backend/libvlc-mlt b/src/Backend/libvlc-mlt
>> new file mode 160000
>> index 0000000..e13e8a0
>> --- /dev/null
>> +++ b/src/Backend/libvlc-mlt
>> @@ -0,0 +1 @@
>> +Subproject commit e13e8a017f78e22b84c8db27598541b8dba27b2e
>> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
>> index a85cf0a..48c4508 100644
>> --- a/src/CMakeLists.txt
>> +++ b/src/CMakeLists.txt
>> @@ -55,8 +55,12 @@ INCLUDE_DIRECTORIES(${FREI0R_INCLUDE_DIR})
>>  # Instruct CMake to run moc automatically when needed.
>>  SET(CMAKE_AUTOMOC ON)
>>
>> +SET(LIBVLC_MLT_MODULES Backend/libvlc-mlt)
>>
>> +ADD_DEFINITIONS(-DLIBVLC_MLT_MODULES_PATH="${CMAKE_CURRENT_BINARY_DIR}/src/${LIBVLC_MLT_MODULES}")
>> +
>>  SET(VLMC_SRCS
>>      Commands/Commands.cpp
>> +    Backend/libvlc-mlt/consumer_libvlc.c
>>      Backend/IBackend.h
>>      Backend/IOutput.h
>>      Backend/IInput.h
>> --
>> 2.7.4 (Apple Git-66)
>>
>
>
> _______________________________________________
> Vlmc-devel mailing list
> Vlmc-devel at videolan.org
> https://mailman.videolan.org/listinfo/vlmc-devel
>


More information about the Vlmc-devel mailing list