Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/libvlcpp
  • robUx4/libvlcpp
  • stolyarchuk/libvlcpp
  • hacker1024/libvlcpp
  • mfkl/libvlcpp
  • The-personified-devil/libvlcpp
  • chouquette/libvlcpp
  • aillean/libvlcpp
  • adtadas19/libvlcpp
  • aad9805066254/libvlcpp
  • asenat/libvlcpp
  • rovenmaburak/libvlcpp
  • mstorsjo/libvlcpp
  • ranjuranjith/libvlcpp
  • tguillem/libvlcpp
  • akbaralisalar/libvlcpp
  • king7532/libvlcpp
  • Skantes/libvlcpp
  • f45431082/libvlcpp
  • alexandre-janniaux/libvlcpp
  • deyayush6/libvlcpp
21 results
Show changes
Commits on Source (5)
......@@ -18,6 +18,7 @@ libvlcpp_HEADERS = \
vlcpp/MediaPlayer.hpp \
vlcpp/Dialog.hpp \
vlcpp/RendererDiscoverer.hpp \
vlcpp/Picture.hpp \
vlcpp/structures.hpp \
vlcpp/vlc.hpp \
$(NULL)
......
......@@ -371,6 +371,34 @@ class MediaEventManager : public EventManager
(*callback)( media != nullptr ? std::make_shared<Media>( media, true ) : nullptr );
});
}
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
/**
* \brief onThumbnailGenerated is invoked upon success & failure of a thumbnail generation
* \param A std::function<void(const Picture*)> (or an equivalent Callable type)
* The provided picture will be null if the thumbnail generation failed.
* In case of success, the thumbnail is only valid for the duration
* of the callback, but can be safely copied if needed.
*/
template <typename Func>
RegisteredEvent onThumbnailGenerated( Func&& f)
{
EXPECT_SIGNATURE(void(const Picture*));
return handle(libvlc_MediaThumbnailGenerated, std::forward<Func>( f ), [](const libvlc_event_t* e, void* data)
{
auto callback = static_cast<DecayPtr<Func>>(data);
auto pic = e->u.media_thumbnail_generated.p_thumbnail;
if ( pic != nullptr )
{
Picture p{ pic };
(*callback)( &p );
}
else
(*callback)( nullptr );
});
}
#endif
};
/**
......
......@@ -743,6 +743,48 @@ public:
return res;
}
#endif
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
using ThumbnailRequest = libvlc_media_thumbnail_request_t;
enum class ThumbnailSeekSpeed
{
Precise = libvlc_media_thumbnail_seek_precise,
Fast = libvlc_media_thumbnail_seek_fast,
};
ThumbnailRequest* thumbnailRequestByTime( libvlc_time_t time, ThumbnailSeekSpeed speed,
uint32_t width, uint32_t height,
Picture::Type type, libvlc_time_t timeout )
{
return libvlc_media_thumbnail_request_by_time( *this, time,
static_cast<libvlc_thumbnailer_seek_speed>( speed ), width,
height, static_cast<libvlc_picture_type_t>( type ), timeout );
}
ThumbnailRequest* thumbnailRequestByPos( float pos, ThumbnailSeekSpeed speed,
uint32_t width, uint32_t height,
Picture::Type type, libvlc_time_t timeout )
{
return libvlc_media_thumbnail_request_by_pos( *this, pos,
static_cast<libvlc_thumbnailer_seek_speed>( speed ), width,
height, static_cast<libvlc_picture_type_t>( type ), timeout );
}
/**
* @brief thumbnailCancel cancels a thumbnailing request
* @param request An opaque thumbnail request object.
*
* Cancelling the request will still cause onThumbnailGenerated callback
* to be invoked, with nullptr as the picture instance.
* If the request is cancelled after its completion, the behavior is undefined.
*/
void thumbnailCancel( ThumbnailRequest* request )
{
libvlc_media_thumbnail_cancel( request );
}
#endif
private:
......
......@@ -107,7 +107,7 @@ public:
{
}
/**
/**
* Create an empty VLC MediaPlayer instance.
*
* Calling any method on such an instance is undefined.
......
/*****************************************************************************
* Picture.hpp: Picture API
*****************************************************************************
* Copyright © 2018 libvlcpp authors & VideoLAN
*
* 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.
*****************************************************************************/
#ifndef LIBVLC_CXX_PICTURE_HPP
#define LIBVLC_CXX_PICTURE_HPP
#include "common.hpp"
#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
namespace VLC
{
class Picture : public Internal<libvlc_picture_t>
{
public:
enum class Type : uint8_t
{
Argb = libvlc_picture_Argb,
Jpg = libvlc_picture_Jpg,
Png = libvlc_picture_Png,
};
Picture() = default;
explicit Picture( Internal::InternalPtr ptr )
: Internal( ptr, libvlc_picture_release )
{
libvlc_picture_retain( ptr );
}
/**
* Saves this picture to a file. The image format is the same as the one
* returned by \link Picture::type() \endlink
*
* \param path The path to the generated file
* \return true in case of success, false otherwise
*/
bool save( const std::string& path ) const
{
return libvlc_picture_save( *this, path.c_str() ) == 0;
}
/**
* Returns the image internal buffer, including potential padding.
* The picture instance owns the returned buffer, which must not be modified
* nor freed.
*
* \param size A pointer to a size_t that will hold the size of the buffer [out] [required]
* \return A pointer to the internal buffer.
*/
const uint8_t* buffer( size_t* size ) const
{
return libvlc_picture_get_buffer( *this, size );
}
/**
* Returns the picture type
*
* \see Picture::Type
*/
Type type() const
{
return static_cast<Type>( libvlc_picture_type( *this ) );
}
/**
* Returns the image stride, ie. the number of bytes per line.
* This can only be called on images of type Picture::Type::Argb
*/
uint32_t stride() const
{
return libvlc_picture_get_stride( *this );
}
/**
* Returns the width of the image in pixels
*/
uint32_t width() const
{
return libvlc_picture_get_width( *this );
}
/**
* Returns the height of the image in pixels
*/
uint32_t height() const
{
return libvlc_picture_get_height( *this );
}
/**
* Returns the time at which this picture was generated, in milliseconds
*/
libvlc_time_t time() const
{
return libvlc_picture_get_time( *this );
}
};
}
#endif
#endif // LIBVLC_CXX_PICTURE_HPP
......@@ -29,6 +29,7 @@ using ssize_t = long int;
#endif
#include <vlc/vlc.h>
#include <vlc/libvlc_version.h>
#include <array>
#include <cassert>
#include <memory>
......
......@@ -27,7 +27,7 @@
#include <string>
#include "common.hpp"
#include <vlc/libvlc_version.h>
#include "Picture.hpp"
//FIXME:
//Should we make the constructors private again and implement our own vector allocator?
......@@ -693,7 +693,7 @@ public:
}
};
class RendererDiscovererDescription
class RendererDiscovererDescription
{
public:
explicit RendererDiscovererDescription( const libvlc_rd_description_t* d )
......
......@@ -28,6 +28,7 @@
#include "Equalizer.hpp"
#include "MediaListPlayer.hpp"
#include "MediaDiscoverer.hpp"
#include "Picture.hpp"
#include "Media.hpp"
#include "MediaList.hpp"
#include "RendererDiscoverer.hpp"
......