MCPcopy Create free account
hub / github.com/MusicPlayerDaemon/MPD / FfmpegReceiveFrames

Function FfmpegReceiveFrames

src/decoder/plugins/FfmpegDecoderPlugin.cxx:223–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223static DecoderCommand
224FfmpegReceiveFrames(DecoderClient &client, InputStream *is,
225 AVCodecContext &codec_context,
226 AVFrame &frame,
227 size_t &skip_bytes,
228 FfmpegBuffer &buffer,
229 bool &eof)
230{
231 while (true) {
232 DecoderCommand cmd;
233
234 int err = avcodec_receive_frame(&codec_context, &frame);
235 switch (err) {
236 case 0:
237 cmd = FfmpegSendFrame(client, is, codec_context,
238 frame, skip_bytes,
239 buffer);
240 if (cmd != DecoderCommand::NONE)
241 return cmd;
242
243 break;
244
245 case AVERROR_EOF:
246 eof = true;
247 return DecoderCommand::NONE;
248
249 case AVERROR(EAGAIN):
250 /* need to call avcodec_send_packet() */
251 return DecoderCommand::NONE;
252
253 default:
254 {
255 char msg[256];
256 av_strerror(err, msg, sizeof(msg));
257 FmtWarning(ffmpeg_domain,
258 "avcodec_send_packet() failed: {}",
259 msg);
260 }
261
262 return DecoderCommand::STOP;
263 }
264 }
265}
266
267/**
268 * Decode an #AVPacket and send the resulting PCM data to the decoder

Callers 1

ffmpeg_send_packetFunction · 0.85

Calls 1

FfmpegSendFrameFunction · 0.85

Tested by

no test coverage detected