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

yikei lu luyikei.qmltu at gmail.com
Tue Apr 12 15:24:04 CEST 2016


So you meant copying the value of the pointer to VLCSource and use an
unique_ptr in VmemRenderer?

2016-04-12 22:21 GMT+09:00 yikei lu <luyikei.qmltu at gmail.com>:
> Oh sorry I might have misread this...
>
> 2016-04-12 22:20 GMT+09:00 yikei lu <luyikei.qmltu at gmail.com>:
>> well it is used in VLCSource so there will be a problem if we use unique_ptr
>>
>> 2016-04-12 22:17 GMT+09:00 Hugo Beauzée-Luyssen <hugo at beauzee.fr>:
>>> 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.
>>> _______________________________________________
>>> Vlmc-devel mailing list
>>> Vlmc-devel at videolan.org
>>> https://mailman.videolan.org/listinfo/vlmc-devel


More information about the Vlmc-devel mailing list