| 97 | }; |
| 98 | |
| 99 | int enc_alloc(Encoder **penc, const AVCodec *codec, |
| 100 | Scheduler *sch, unsigned sch_idx, void *log_parent) |
| 101 | { |
| 102 | EncoderPriv *ep; |
| 103 | int ret = 0; |
| 104 | |
| 105 | *penc = NULL; |
| 106 | |
| 107 | ep = av_mallocz(sizeof(*ep)); |
| 108 | if (!ep) |
| 109 | return AVERROR(ENOMEM); |
| 110 | |
| 111 | ep->e.class = &enc_class; |
| 112 | ep->log_parent = log_parent; |
| 113 | |
| 114 | ep->sch = sch; |
| 115 | ep->sch_idx = sch_idx; |
| 116 | |
| 117 | snprintf(ep->log_name, sizeof(ep->log_name), "enc:%s", codec->name); |
| 118 | |
| 119 | ep->e.enc_ctx = avcodec_alloc_context3(codec); |
| 120 | if (!ep->e.enc_ctx) { |
| 121 | ret = AVERROR(ENOMEM); |
| 122 | goto fail; |
| 123 | } |
| 124 | |
| 125 | *penc = &ep->e; |
| 126 | |
| 127 | return 0; |
| 128 | fail: |
| 129 | enc_free((Encoder**)&ep); |
| 130 | return ret; |
| 131 | } |
| 132 | |
| 133 | static int hw_device_setup_for_encode(Encoder *e, AVCodecContext *enc_ctx, |
| 134 | AVBufferRef *frames_ref) |
no test coverage detected