-
- eof = 0;
- idx = 1;
- while (idx) {
- /* get a packet from the previous filter up the chain */
- ret = av_bsf_receive_packet(ost->bsf_ctx[idx - 1], pkt);
- if (ret == AVERROR(EAGAIN)) {
- ret = 0;
- idx--;
- continue;
- } else if (ret == AVERROR_EOF) {
- eof = 1;
- } else if (ret < 0)
- goto finish;
-
- /* send it to the next filter down the chain or to the muxer */
- if (idx < ost->nb_bitstream_filters) {
- ret = av_bsf_send_packet(ost->bsf_ctx[idx], eof ? NULL : pkt);
- if (ret < 0)
- goto finish;
- idx++;
- eof = 0;
- } else if (eof)
- goto finish;
- else
- write_packet(of, pkt, ost, 0);
- }
+ while ((ret = av_bsf_receive_packet(ost->bsf_ctx, pkt)) >= 0)
+ write_packet(of, pkt, ost, 0);
+ if (ret == AVERROR(EAGAIN))
+ ret = 0;