| 163 | static int decoder_thread(void *arg); |
| 164 | |
| 165 | static int dec_alloc(DecoderPriv **pdec, Scheduler *sch, int send_end_ts) |
| 166 | { |
| 167 | DecoderPriv *dp; |
| 168 | int ret = 0; |
| 169 | |
| 170 | *pdec = NULL; |
| 171 | |
| 172 | dp = av_mallocz(sizeof(*dp)); |
| 173 | if (!dp) |
| 174 | return AVERROR(ENOMEM); |
| 175 | |
| 176 | dp->frame = av_frame_alloc(); |
| 177 | if (!dp->frame) |
| 178 | goto fail; |
| 179 | |
| 180 | dp->pkt = av_packet_alloc(); |
| 181 | if (!dp->pkt) |
| 182 | goto fail; |
| 183 | |
| 184 | dp->index = -1; |
| 185 | dp->dec.class = &dec_class; |
| 186 | dp->last_filter_in_rescale_delta = AV_NOPTS_VALUE; |
| 187 | dp->last_frame_pts = AV_NOPTS_VALUE; |
| 188 | dp->last_frame_tb = (AVRational){ 1, 1 }; |
| 189 | dp->hwaccel_pix_fmt = AV_PIX_FMT_NONE; |
| 190 | |
| 191 | ret = sch_add_dec(sch, decoder_thread, dp, send_end_ts); |
| 192 | if (ret < 0) |
| 193 | goto fail; |
| 194 | dp->sch = sch; |
| 195 | dp->sch_idx = ret; |
| 196 | |
| 197 | *pdec = dp; |
| 198 | |
| 199 | return 0; |
| 200 | fail: |
| 201 | dec_free((Decoder**)&dp); |
| 202 | return ret >= 0 ? AVERROR(ENOMEM) : ret; |
| 203 | } |
| 204 | |
| 205 | static AVRational audio_samplerate_update(DecoderPriv *dp, |
| 206 | const AVFrame *frame) |
no test coverage detected