The only difference of the currently used write_packet()-function to ff_raw_write_packet() is that the former also counts the number of frames. Yet doing so in the muxer itself is unnecessary as this is already done generically in write_packet() in libavformat/mux.c.
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com> --- Note: The generic counter is only incremented when no write error happens. I doubt it matters. libavformat/Makefile | 2 +- libavformat/filmstripenc.c | 19 +++---------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index 554b0bfbf8..d4bed3c113 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -179,7 +179,7 @@ OBJS-$(CONFIG_FFMETADATA_MUXER) += ffmetaenc.o OBJS-$(CONFIG_FIFO_MUXER) += fifo.o OBJS-$(CONFIG_FIFO_TEST_MUXER) += fifo_test.o OBJS-$(CONFIG_FILMSTRIP_DEMUXER) += filmstripdec.o -OBJS-$(CONFIG_FILMSTRIP_MUXER) += filmstripenc.o +OBJS-$(CONFIG_FILMSTRIP_MUXER) += filmstripenc.o rawenc.o OBJS-$(CONFIG_FITS_DEMUXER) += fitsdec.o OBJS-$(CONFIG_FITS_MUXER) += fitsenc.o OBJS-$(CONFIG_FLAC_DEMUXER) += flacdec.o rawdec.o \ diff --git a/libavformat/filmstripenc.c b/libavformat/filmstripenc.c index 8ead696360..83faf29556 100644 --- a/libavformat/filmstripenc.c +++ b/libavformat/filmstripenc.c @@ -26,13 +26,10 @@ #include "libavutil/intreadwrite.h" #include "avformat.h" +#include "rawenc.h" #define RAND_TAG MKBETAG('R','a','n','d') -typedef struct FilmstripMuxContext { - int nb_frames; -} FilmstripMuxContext; - static int write_header(AVFormatContext *s) { if (s->streams[0]->codecpar->format != AV_PIX_FMT_RGBA) { @@ -42,23 +39,14 @@ static int write_header(AVFormatContext *s) return 0; } -static int write_packet(AVFormatContext *s, AVPacket *pkt) -{ - FilmstripMuxContext *film = s->priv_data; - avio_write(s->pb, pkt->data, pkt->size); - film->nb_frames++; - return 0; -} - static int write_trailer(AVFormatContext *s) { - FilmstripMuxContext *film = s->priv_data; AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; int i; avio_wb32(pb, RAND_TAG); - avio_wb32(pb, film->nb_frames); + avio_wb32(pb, st->nb_frames); avio_wb16(pb, 0); // packing method avio_wb16(pb, 0); // reserved avio_wb16(pb, st->codecpar->width); @@ -76,10 +64,9 @@ AVOutputFormat ff_filmstrip_muxer = { .name = "filmstrip", .long_name = NULL_IF_CONFIG_SMALL("Adobe Filmstrip"), .extensions = "flm", - .priv_data_size = sizeof(FilmstripMuxContext), .audio_codec = AV_CODEC_ID_NONE, .video_codec = AV_CODEC_ID_RAWVIDEO, .write_header = write_header, - .write_packet = write_packet, + .write_packet = ff_raw_write_packet, .write_trailer = write_trailer, }; -- 2.20.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".