MCPcopy Create free account
hub / github.com/apache/nuttx / openh264_decoder_enqueue

Function openh264_decoder_enqueue

arch/sim/src/sim/sim_openh264dec.c:116–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116int openh264_decoder_enqueue(struct openh264_decoder_s *decoder,
117 void *data, int64_t pts, int size)
118{
119 DECODING_STATE state;
120
121 memset(&decoder->bufinfo, 0, sizeof(SBufferInfo));
122 memset(decoder->pdst, 0, sizeof(decoder->pdst));
123
124 if (decoder->remaining_frames == 0)
125 {
126 /* When data is NULL and remaining_frames has
127 * not been assigned, call DecodeFrame2 to obtain
128 * the pending buffer.
129 */
130
131 decoder->bufinfo.uiInBsTimeStamp = pts;
132 state = (*decoder->dec)->DecodeFrame2(decoder->dec,
133 data,
134 size,
135 decoder->pdst,
136 &decoder->bufinfo);
137 if (state != dsErrorFree)
138 {
139 syslog(LOG_ERR, "hostdec - decode failed 0x%04x\n", state);
140 return -EINVAL;
141 }
142
143 if (data == NULL)
144 {
145 (*decoder->dec)->GetOption(decoder->dec,
146 DECODER_OPTION_NUM_OF_FRAMES_REMAINING_IN_BUFFER,
147 &decoder->remaining_frames);
148 }
149 }
150 else
151 {
152 /* When remaining_frames is assigned and greater than
153 * zero, call FlushFrame to get the last buffers.
154 */
155
156 state = (*decoder->dec)->FlushFrame(decoder->dec,
157 decoder->pdst,
158 &decoder->bufinfo);
159 if (state != dsErrorFree)
160 {
161 syslog(LOG_ERR, "hostdec - flush failed 0x%04x\n", state);
162 return -EINVAL;
163 }
164
165 decoder->remaining_frames--;
166 }
167
168 return decoder->bufinfo.iBufferStatus;
169}
170
171int openh264_decoder_dequeue(struct openh264_decoder_s *decoder,
172 void *data, int64_t *pts, uint32_t *size)

Callers 1

sim_decoder_processFunction · 0.85

Calls 2

memsetFunction · 0.50
syslogFunction · 0.50

Tested by

no test coverage detected