static int parse_packet(AVFormatContext *s, AVPacket *pkt,
int stream_index, int flush)
{
- AVPacket out_pkt = { 0 };
+ AVPacket out_pkt;
AVStream *st = s->streams[stream_index];
uint8_t *data = pkt->data;
int size = pkt->size;
int ret = 0, got_output = flush;
- av_init_packet(&out_pkt);
-
- if (!size && !flush && st->parser->flags & PARSER_FLAG_COMPLETE_FRAMES) {
+ if (size || flush) {
+ av_init_packet(&out_pkt);
+ } else if (st->parser->flags & PARSER_FLAG_COMPLETE_FRAMES) {
// preserve 0-size sync packets
compute_pkt_fields(s, st, st->parser, pkt, AV_NOPTS_VALUE, AV_NOPTS_VALUE);
}
static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
{
- int ret = 0, i, got_packet = 0;
+ int ret, i, got_packet = 0;
AVDictionary *metadata = NULL;
- av_init_packet(pkt);
-
while (!got_packet && !s->internal->parse_queue) {
AVStream *st;