hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
 * Copyright 2015 Rockchip Electronics Co. LTD
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
#define MODULE_TAG "mpp_task"
 
#include <string.h>
 
#include "mpp_task.h"
#include "mpp_task_impl.h"
 
MPP_RET mpp_task_meta_set_s32(MppTask task, MppMetaKey key, RK_S32 val)
{
    if (check_mpp_task_name(task))
        return MPP_NOK;
 
    MppTaskImpl *impl = (MppTaskImpl *)task;
    return mpp_meta_set_s32(impl->meta, key, val);
}
 
MPP_RET mpp_task_meta_set_s64(MppTask task, MppMetaKey key, RK_S64 val)
{
    if (check_mpp_task_name(task))
        return MPP_NOK;
 
    MppTaskImpl *impl = (MppTaskImpl *)task;
    return mpp_meta_set_s64(impl->meta, key, val);
}
 
MPP_RET mpp_task_meta_set_ptr(MppTask task, MppMetaKey key, void  *val)
{
    if (check_mpp_task_name(task))
        return MPP_NOK;
 
    MppTaskImpl *impl = (MppTaskImpl *)task;
    return mpp_meta_set_ptr(impl->meta, key, val);
}
 
MPP_RET mpp_task_meta_set_frame(MppTask task, MppMetaKey key, MppFrame frame)
{
    if (check_mpp_task_name(task))
        return MPP_NOK;
 
    MppTaskImpl *impl = (MppTaskImpl *)task;
    return mpp_meta_set_frame(impl->meta, key, frame);
}
 
MPP_RET mpp_task_meta_set_packet(MppTask task, MppMetaKey key, MppPacket packet)
{
    if (check_mpp_task_name(task))
        return MPP_NOK;
 
    MppTaskImpl *impl = (MppTaskImpl *)task;
    return mpp_meta_set_packet(impl->meta, key, packet);
}
 
MPP_RET mpp_task_meta_set_buffer(MppTask task, MppMetaKey key, MppBuffer buffer)
{
    if (check_mpp_task_name(task))
        return MPP_NOK;
 
    MppTaskImpl *impl = (MppTaskImpl *)task;
    return mpp_meta_set_buffer(impl->meta, key, buffer);
}
 
MPP_RET mpp_task_meta_get_s32(MppTask task, MppMetaKey key, RK_S32 *val, RK_S32 default_val)
{
    if (check_mpp_task_name(task))
        return MPP_NOK;
 
    MppTaskImpl *impl = (MppTaskImpl *)task;
    MPP_RET ret = mpp_meta_get_s32(impl->meta, key, val);
    if (ret)
        *val = default_val;
    return ret;
}
 
MPP_RET mpp_task_meta_get_s64(MppTask task, MppMetaKey key, RK_S64 *val, RK_S64 default_val)
{
    if (check_mpp_task_name(task))
        return MPP_NOK;
 
    MppTaskImpl *impl = (MppTaskImpl *)task;
    MPP_RET ret = mpp_meta_get_s64(impl->meta, key, val);
    if (ret)
        *val = default_val;
    return ret;
}
 
MPP_RET mpp_task_meta_get_ptr(MppTask task, MppMetaKey key, void  **val, void *default_val)
{
    if (check_mpp_task_name(task))
        return MPP_NOK;
 
    MppTaskImpl *impl = (MppTaskImpl *)task;
    MPP_RET ret = mpp_meta_get_ptr(impl->meta, key, val);
    if (ret)
        *val = default_val;
    return ret;
}
 
MPP_RET mpp_task_meta_get_frame(MppTask task, MppMetaKey key, MppFrame *frame)
{
    if (check_mpp_task_name(task))
        return MPP_NOK;
 
    MppTaskImpl *impl = (MppTaskImpl *)task;
    MPP_RET ret = mpp_meta_get_frame(impl->meta, key, frame);
    if (ret)
        *frame = NULL;
    return ret;
}
 
MPP_RET mpp_task_meta_get_packet(MppTask task, MppMetaKey key, MppPacket *packet)
{
    if (check_mpp_task_name(task))
        return MPP_NOK;
 
    MppTaskImpl *impl = (MppTaskImpl *)task;
    MPP_RET ret = mpp_meta_get_packet(impl->meta, key, packet);
    if (ret)
        *packet = NULL;
    return ret;
}
 
MPP_RET mpp_task_meta_get_buffer(MppTask task, MppMetaKey key, MppBuffer *buffer)
{
    if (check_mpp_task_name(task))
        return MPP_NOK;
 
    MppTaskImpl *impl = (MppTaskImpl *)task;
    MPP_RET ret = mpp_meta_get_buffer(impl->meta, key, buffer);
    if (ret)
        *buffer = NULL;
    return ret;
}