@@ -2737,6 +2737,10 @@ static int do_decode(AVCodecContext *avctx,
AVPacket *pkt)
} else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
ret = avcodec_decode_audio4(avctx, avctx->internal->buffer_frame,
&got_frame, pkt);
+ } else if (avctx->codec_type == AVMEDIA_TYPE_DATA) {
+ ret = avctx->codec->decode(avctx,
avctx->internal->buffer_frame, &got_frame, pkt);
+ if (ret == 0 && got_frame)
+ ret = pkt->size;
} else {
ret = AVERROR(EINVAL);
}
commit ebfceb706d8c8d0dbfe64ebe06d218aaa8807e43
Author: Erkki Seppälä <erkki.seppala.ext@nokia.com>
Date: Thu Aug 25 10:22:19 2016 +0300
fixup! doc/examples/extract_timed_metadata: added a bare-bones
metadata extractor; find only the frames
b/doc/examples/extract_timed_metadata.c
@@ -184,16 +183,15 @@ int main(int argc, char **argv)
for (i = 0; metadata_stream_indices[i] >= 0; i++) {
if (packet.stream_index == metadata_stream_indices[i]) {
- got_frame = 0;
-
- ret = dec_ctx[i]->codec->decode(dec_ctx[i], metadata,
&got_frame, &packet);
+ ret = avcodec_send_packet(dec_ctx[i], &packet);
+ // We always empty decoded frames so we don't handle
AVERROR(EAGAIN) here
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error decoding meta
data\n");
break;
}
- if (got_frame) {
+ while (avcodec_receive_frame(dec_ctx[i], metadata) == 0) {