On Wed, 4 Apr 2018 01:30:54 -0300 James Almer <jamr...@gmail.com> wrote:
> From: Rodger Combs <rodger.co...@gmail.com> > > Signed-off-by: James Almer <jamr...@gmail.com> > --- > Now using the packet list API instead of duplicating the code locally. > > libavformat/flacenc.c | 274 > +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, > 238 insertions(+), 36 deletions(-) > > diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c > index b894f9ef61..99f4ce7bad 100644 >[snip] > - c->streaminfo = av_malloc(FLAC_STREAMINFO_SIZE); > - if (!c->streaminfo) > - return AVERROR(ENOMEM); > - memcpy(c->streaminfo, streaminfo, FLAC_STREAMINFO_SIZE); > + /* warn only once for each stream */ > + if (s->streams[pkt->stream_index]->nb_frames == 1) { > + av_log(s, AV_LOG_WARNING, "Got more than one picture in > stream %d," > + " ignoring.\n", pkt->stream_index); > + } > + if (!c->waiting_pics || > s->streams[pkt->stream_index]->nb_frames >= 1) > + return 0; > + > + if (index > c->audio_stream_idx) > + index--; > + > + if ((ret = av_packet_ref(&c->pics[index], pkt)) < 0) > + return ret; > + c->waiting_pics--; > + > + /* flush the buffered audio packets */ > + if (!c->waiting_pics && > + (ret = flac_queue_flush(s)) < 0) > + return ret; > } > > - if (pkt->size) > - avio_write(s->pb, pkt->data, pkt->size); > return 0; > } > I've submitted attached picture support to movenc just now. Instead of defining separate pictures queue, I'm reusing the AVStream.attached_pic to hold it. Would it make sense to share this small piece of code in some utility function (and use also AVStream.attached_pic here)? See: https://ffmpeg.org/pipermail/ffmpeg-devel/2018-April/227708.html _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel