1 /*
2 * Copyright (c) 2019, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23 //!
24 //! \file decode_marker.cpp
25 //! \brief Defines the common interface for decode marker
26 //! \details The decode marker interface implements the decode marker feature.
27 //!
28 #include "decode_marker.h"
29 #include "decode_utils.h"
30
31 namespace decode {
32
DecodeMarker(DecodeAllocator & allocator)33 DecodeMarker::DecodeMarker(DecodeAllocator& allocator) :
34 m_allocator(&allocator)
35 {
36 }
37
~DecodeMarker()38 DecodeMarker::~DecodeMarker()
39 {
40 MOS_Delete(m_markerBuffer);
41 }
42
Update(void * params)43 MOS_STATUS DecodeMarker::Update(void *params)
44 {
45 DECODE_FUNC_CALL();
46
47 DECODE_CHK_NULL(params);
48
49 CodechalDecodeParams* decodeParams = (CodechalDecodeParams*)params;
50 m_setMarkerEnabled = decodeParams->m_setMarkerEnabled;
51 m_setMarkerNumTs = decodeParams->setMarkerNumTs;
52
53 if (m_setMarkerEnabled)
54 {
55 DECODE_CHK_NULL(decodeParams->m_presSetMarker);
56 }
57
58 if (m_markerBuffer == nullptr)
59 {
60 m_markerBuffer = MOS_New(MOS_BUFFER);
61 }
62
63 if (decodeParams->m_presSetMarker != nullptr)
64 {
65 m_markerBuffer->OsResource = *decodeParams->m_presSetMarker;
66 }
67 else
68 {
69 MOS_ZeroMemory(m_markerBuffer, sizeof(MOS_BUFFER));
70 }
71
72 return MOS_STATUS_SUCCESS;
73 }
74
75 }
76