static int check_packet(AVFormatContext *s, AVPacket *pkt)
{
- if (!pkt)
- return 0;
-
if (pkt->stream_index < 0 || pkt->stream_index >= s->nb_streams) {
av_log(s, AV_LOG_ERROR, "Invalid packet stream index: %d\n",
pkt->stream_index);
{
int ret;
- ret = prepare_input_packet(s, pkt);
- if (ret < 0)
- return ret;
-
if (!pkt) {
if (s->oformat->flags & AVFMT_ALLOW_FLUSH) {
ret = s->oformat->write_packet(s, NULL);
return 1;
}
+ ret = prepare_input_packet(s, pkt);
+ if (ret < 0)
+ return ret;
+
ret = do_packet_auto_bsf(s, pkt);
if (ret <= 0)
return ret;
{
int ret, flush = 0;
- ret = prepare_input_packet(s, pkt);
- if (ret < 0)
- goto fail;
-
if (pkt) {
AVStream *st = s->streams[pkt->stream_index];
+ ret = prepare_input_packet(s, pkt);
+ if (ret < 0)
+ goto fail;
+
ret = do_packet_auto_bsf(s, pkt);
if (ret == 0)
return 0;