Commit be5a7a2e authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

Drop emotion "support"

parent f67f637e
......@@ -6,11 +6,6 @@ option(WITH_VLC "Include VLC metadata services" ON)
EnableCpp11()
include(FindPkgConfig)
pkg_check_modules(EMOTION emotion)
pkg_check_modules(ECOREEVAS ecore-evas)
pkg_check_modules(EVAS evas)
add_definitions("-Wall -Wextra -pedantic")
if(UNIX)
......@@ -81,12 +76,6 @@ list(APPEND SRC_LIST ${HEADERS_LIST}
logging/Logger.cpp
)
if (${EMOTION_FOUND})
list(APPEND SRC_LIST
metadata_services/emotion/Emotion.cpp
)
endif()
if (${WITH_VLC})
list(APPEND SRC_LIST
metadata_services/vlc/VLCMetadataService.cpp
......@@ -114,14 +103,6 @@ if (${WITH_VLC})
include_directories(${LIBVLCPP_DIR})
endif()
if (${EMOTION_FOUND})
include_directories(${EMOTION_INCLUDE_DIRS})
include_directories(${ECOREEVAS_INCLUDE_DIRS})
target_link_libraries( ${PROJECT_NAME} ${EMOTION_LIBRARIES} )
target_link_libraries( ${PROJECT_NAME} ${ECOREEVAS_LIBRARIES} )
target_link_libraries( ${PROJECT_NAME} ${EVAS_LIBRARIES} )
endif()
# Work around for tizen platform
if (NOT "${EXTRA_LIBS}" STREQUAL "")
target_link_libraries( ${PROJECT_NAME} ${EXTRA_LIBS} )
......
/*****************************************************************************
* Media Library
*****************************************************************************
* Copyright (C) 2015 Hugo Beauzée-Luyssen, Videolabs
*
* Authors: Hugo Beauzée-Luyssen<hugo@beauzee.fr>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "Emotion.h"
#include <iostream>
#include <Ecore.h>
#include <Evas.h>
#include <Ecore_Evas.h>
#include <Emotion.h>
#include "IFile.h"
EmotionMetadataService::EmotionMetadataService()
: m_initialized( false )
{
}
EmotionMetadataService::~EmotionMetadataService()
{
if ( m_initialized )
evas_shutdown();
}
bool EmotionMetadataService::initialize( IMetadataServiceCb *callback, IMediaLibrary *ml )
{
m_cb = callback;
m_ml = ml;
if ( ecore_evas_init() == 0 )
{
throw std::runtime_error( "Failed to initialize Evas" );
}
m_initialized = true;
return true;
}
unsigned int EmotionMetadataService::priority() const
{
return 1000;
}
bool EmotionMetadataService::run( FilePtr file, void *data )
{
auto evas = ecore_evas_new( nullptr, 0, 0, 10, 10, nullptr );
if ( evas == nullptr )
return false;
std::unique_ptr<Ecore_Evas, decltype(&ecore_evas_free)> evas_u( evas, &ecore_evas_free );
auto e = ecore_evas_get( evas );
auto em = emotion_object_add( e );
if ( emotion_object_init( em, "libvlc" ) != EINA_TRUE )
return false;
if ( emotion_object_file_set( em, file->mrl().c_str() ) != EINA_TRUE )
return false;
auto meta = emotion_object_meta_info_get( em, EMOTION_META_INFO_TRACK_ARTIST );
std::cout << "track album: " << meta << std::endl;
m_cb->done( file, StatusSuccess, data );
return true;
}
/*****************************************************************************
* Media Library
*****************************************************************************
* Copyright (C) 2015 Hugo Beauzée-Luyssen, Videolabs
*
* Authors: Hugo Beauzée-Luyssen<hugo@beauzee.fr>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#pragma once
#include "IMetadataService.h"
class EmotionMetadataService : public IMetadataService
{
public:
EmotionMetadataService();
virtual ~EmotionMetadataService();
virtual bool initialize(IMetadataServiceCb *callback, IMediaLibrary *ml) override;
virtual unsigned int priority() const override;
virtual bool run(FilePtr file, void *data) override;
private:
//FIXME: This should be a shared_ptr
IMetadataServiceCb* m_cb;
IMediaLibrary* m_ml;
bool m_initialized;
};
......@@ -57,12 +57,6 @@ list(APPEND TEST_SRCS
mocks/DiscovererCbMock.h
)
if (${EMOTION_FOUND})
list (APPEND TEST_SRCS
EmotionMetadataService_Test.cpp
)
endif()
add_executable(unittest ${TEST_SRCS})
add_dependencies(unittest gtest-dependency)
......
/*****************************************************************************
* Media Library
*****************************************************************************
* Copyright (C) 2015 Hugo Beauzée-Luyssen, Videolabs
*
* Authors: Hugo Beauzée-Luyssen<hugo@beauzee.fr>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "Tests.h"
#include <condition_variable>
#include <mutex>
#include "IFile.h"
#include "IMediaLibrary.h"
#include "metadata_services/emotion/Emotion.h"
class EmotionMetadataServiceCb : public IMetadataCb
{
public:
std::condition_variable waitCond;
std::mutex mutex;
virtual void onMetadataUpdated( FilePtr )
{
std::unique_lock<std::mutex> lock( mutex );
waitCond.notify_all();
}
};
class EmotionMetadataService_Tests : public Tests
{
protected:
static std::unique_ptr<EmotionMetadataServiceCb> cb;
public:
static void SetUpTestCase()
{
cb.reset( new EmotionMetadataServiceCb );
}
virtual void SetUp() override
{
Tests::Reload( nullptr, cb.get() );
auto emotionService = std::unique_ptr<EmotionMetadataService>( new EmotionMetadataService );
ml->addMetadataService( std::move( emotionService ) );
}
};
std::unique_ptr<EmotionMetadataServiceCb> EmotionMetadataService_Tests::cb;
TEST_F( EmotionMetadataService_Tests, ParseAudio )
{
std::unique_lock<std::mutex> lock( cb->mutex );
auto file = ml->addFile( "mr-zebra.mp3" );
bool res = cb->waitCond.wait_for( lock, std::chrono::seconds( 5 ), [&]{
return file->audioTracks().size() > 0;
} );
ASSERT_TRUE( res );
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment