mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
avformat/filmstripenc: Use ff_raw_write_packet()
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.rheinhardt@gmail.com>
This commit is contained in:
parent
2cae3f60bf
commit
40a9363033
@ -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 \
|
||||
|
@ -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,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user