Go to the documentation of this file.
51 uint32_t info1, info2;
61 if (encoded_buf_size !=
pkt->
size && (
pkt->
size % encoded_buf_size) != 0) {
128 av_log(format_context,
AV_LOG_ERROR,
"Sega FILM allows a maximum of one audio stream.\n");
133 "Incompatible audio stream format.\n");
141 av_log(format_context,
AV_LOG_ERROR,
"Sega FILM allows a maximum of one video stream.\n");
147 "Incompatible video stream format.\n");
152 "Pixel format must be rgb24.\n");
171 unsigned header_size)
174 int64_t
pos, pos_end;
185 read_size[1] = header_size;
193 "write the header\n", format_context->
url);
200 pos_end =
avio_tell(format_context->
pb) + header_size;
209 read_size[read_buf_id] =
avio_read(read_pb, read_buf[read_buf_id],
212 n = read_size[read_buf_id];
215 avio_write(format_context->
pb, read_buf[read_buf_id], n);
217 }
while (
pos < pos_end);
227 unsigned stabsize, headersize, packet_count;
235 if (headersize < 64) {
239 packet_count = (headersize - 64) / 16;
240 stabsize = 16 + 16 * packet_count;
248 bytestream_put_be32(&ptr,
MKBETAG(
'F',
'I',
'L',
'M'));
249 bytestream_put_be32(&ptr, headersize);
252 bytestream_put_be32(&ptr,
MKBETAG(
'1',
'.',
'0',
'9'));
257 bytestream_put_be32(&ptr,
MKBETAG(
'F',
'D',
'S',
'C'));
258 bytestream_put_be32(&ptr, 0x20);
263 switch (
video->codecpar->codec_id) {
265 bytestream_put_be32(&ptr,
MKBETAG(
'c',
'v',
'i',
'd'));
268 bytestream_put_be32(&ptr,
MKBETAG(
'r',
'a',
'w',
' '));
272 bytestream_put_be32(&ptr,
video->codecpar->height);
273 bytestream_put_be32(&ptr,
video->codecpar->width);
274 bytestream_put_byte(&ptr, 24);
282 bytestream_put_byte(&ptr, audio_codec);
287 ptr += 1 + 1 + 1 + 2;
294 bytestream_put_be32(&ptr,
MKBETAG(
'S',
'T',
'A',
'B'));
295 bytestream_put_be32(&ptr, stabsize);
307 bytestream_put_be32(&ptr, packet_count);
static av_cold int init(AVCodecContext *avctx)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
enum AVMediaType codec_type
General type of the encoded data.
static int film_init(AVFormatContext *format_context)
AVStream ** streams
A list of all streams in the file.
@ AV_CODEC_ID_PCM_S16BE_PLANAR
int error
contains the error code or 0 if no error happened
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
static int film_write_packet(AVFormatContext *format_context, AVPacket *pkt)
int avio_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
static int get_audio_codec_id(enum AVCodecID codec_id)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
void avio_flush(AVIOContext *s)
Force flushing of buffered data.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
static int write_trailer(AVFormatContext *s1)
AVIOContext * pb
I/O context.
int sample_rate
Audio only.
static int write_header(AVFormatContext *format_context, uint8_t *header, unsigned header_size)
AVCodecID
Identify the syntax and semantics of the bitstream.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
char * url
input or output URL.
#define MKBETAG(a, b, c, d)
static const uint8_t header[24]
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
void avio_wb32(AVIOContext *s, unsigned int val)
int flags
A combination of AV_PKT_FLAG values.
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
AVOutputFormat ff_segafilm_muxer
static void film_deinit(AVFormatContext *format_context)
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
A Quick Description Of Rate Distortion Theory We want to encode a video
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int(* io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
A callback for opening new IO streams.
#define AVIO_FLAG_READ
read-only
int bits_per_coded_sample
The number of bits per sample in the codedwords.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
@ AV_CODEC_ID_PCM_S8_PLANAR
static int film_write_header(AVFormatContext *format_context)
void ffio_fill(AVIOContext *s, int b, int count)
void avio_wb16(AVIOContext *s, unsigned int val)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
void * priv_data
Format private data.