[vlmc-devel] [PATCH 2/5] VLCSource, VmemRenderer: Use const uint8_t* snapshot

Hugo Beauzée-Luyssen hugo at beauzee.fr
Tue Apr 12 15:17:57 CEST 2016


On 04/12/2016 03:09 PM, Yikai Lu wrote:
> ---
>   src/Backend/VLC/VLCSource.h         | 2 +-
>   src/Backend/VLC/VLCVmemRenderer.cpp | 2 +-
>   src/Backend/VLC/VLCVmemRenderer.h   | 2 +-
>   3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/Backend/VLC/VLCSource.h b/src/Backend/VLC/VLCSource.h
> index 10a7d08..b2262df 100644
> --- a/src/Backend/VLC/VLCSource.h
> +++ b/src/Backend/VLC/VLCSource.h
> @@ -69,7 +69,7 @@ private:
>       unsigned int                m_nbVideoTracks;
>       unsigned int                m_nbAudioTracks;
>       int64_t                     m_length; //in milliseconds.
> -    uint8_t*                    m_snapshot;
> +    const uint8_t*              m_snapshot;
>       bool                        m_isParsed;
>       int64_t                     m_nbFrames;
>   };
> diff --git a/src/Backend/VLC/VLCVmemRenderer.cpp b/src/Backend/VLC/VLCVmemRenderer.cpp
> index d062bbe..8312ecd 100644
> --- a/src/Backend/VLC/VLCVmemRenderer.cpp
> +++ b/src/Backend/VLC/VLCVmemRenderer.cpp
> @@ -68,7 +68,7 @@ VmemRenderer::mediaPlayer()
>       return m_mediaPlayer;
>   }
>
> -uint8_t*
> +const uint8_t*
>   VmemRenderer::waitSnapshot()
>   {
>       QMutexLocker lock( &m_mutex );
> diff --git a/src/Backend/VLC/VLCVmemRenderer.h b/src/Backend/VLC/VLCVmemRenderer.h
> index 89b105d..b7a765e 100644
> --- a/src/Backend/VLC/VLCVmemRenderer.h
> +++ b/src/Backend/VLC/VLCVmemRenderer.h
> @@ -47,7 +47,7 @@ public:
>        *  the caller.
>        * @return
>        */
> -    uint8_t *waitSnapshot();
> +    const uint8_t *waitSnapshot();
>
>   private:
>       void*    vmemLock( void **planes );
>
Oh, I meant use uint8_t* as the exposed return value (which means that 
the called doesn't own this value, and that it's bound to the lifetime 
of the VmemRenderer, or shorter), and use a unique_ptr internally, so it 
gets automatically released when the VmemRenderer gets deleted.


More information about the Vlmc-devel mailing list