MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / mediacodec_encode

Function mediacodec_encode

libavcodec/mediacodecenc.c:839–883  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

837}
838
839static int mediacodec_encode(AVCodecContext *avctx, AVPacket *pkt)
840{
841 MediaCodecEncContext *s = avctx->priv_data;
842 int ret;
843
844 // Return on three case:
845 // 1. Serious error
846 // 2. Got a packet success
847 // 3. No AVFrame is available yet (don't return if get_frame return EOF)
848 while (1) {
849 if (s->bsf) {
850 ret = av_bsf_receive_packet(s->bsf, pkt);
851 if (!ret)
852 return 0;
853 if (ret != AVERROR(EAGAIN))
854 return ret;
855 }
856
857 ret = mediacodec_receive(avctx, pkt);
858 if (s->bsf) {
859 if (!ret || ret == AVERROR_EOF)
860 ret = av_bsf_send_packet(s->bsf, pkt);
861 } else {
862 if (!ret)
863 return 0;
864 }
865
866 if (ret < 0 && ret != AVERROR(EAGAIN))
867 return ret;
868
869 if (!s->frame->buf[0]) {
870 ret = ff_encode_get_frame(avctx, s->frame);
871 if (ret && ret != AVERROR_EOF)
872 return ret;
873 }
874
875 ret = mediacodec_send(avctx, s->frame->buf[0] ? s->frame : NULL);
876 if (!ret)
877 av_frame_unref(s->frame);
878 else if (ret != AVERROR(EAGAIN))
879 return ret;
880 }
881
882 return 0;
883}
884
885static int mediacodec_send_dummy_frame(AVCodecContext *avctx)
886{

Callers

nothing calls this directly

Calls 6

av_bsf_receive_packetFunction · 0.85
mediacodec_receiveFunction · 0.85
av_bsf_send_packetFunction · 0.85
ff_encode_get_frameFunction · 0.85
mediacodec_sendFunction · 0.85
av_frame_unrefFunction · 0.85

Tested by

no test coverage detected