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)
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);
265 bytestream_put_be32(&ptr,
MKBETAG(
'c',
'v',
'i',
'd'));
268 bytestream_put_be32(&ptr,
MKBETAG(
'r',
'a',
'w',
' '));
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);
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
void avio_wb32(AVIOContext *s, unsigned int val)
void avio_wb16(AVIOContext *s, unsigned int val)
#define AVIO_FLAG_READ
read-only
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
void avio_flush(AVIOContext *s)
Force flushing of buffered data.
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
int avio_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
void ffio_fill(AVIOContext *s, int b, int count)
static av_cold int init(AVCodecContext *avctx)
#define MKBETAG(a, b, c, d)
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
AVCodecID
Identify the syntax and semantics of the bitstream.
@ AV_CODEC_ID_PCM_S16BE_PLANAR
@ AV_CODEC_ID_PCM_S8_PLANAR
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
static const uint8_t header[24]
static void film_deinit(AVFormatContext *format_context)
static int get_audio_codec_id(enum AVCodecID codec_id)
static int film_write_packet(AVFormatContext *format_context, AVPacket *pkt)
static int film_write_header(AVFormatContext *format_context)
static int film_init(AVFormatContext *format_context)
static int write_header(AVFormatContext *format_context, uint8_t *header, unsigned header_size)
AVOutputFormat ff_segafilm_muxer
int bits_per_coded_sample
The number of bits per sample in the codedwords.
enum AVMediaType codec_type
General type of the encoded data.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
Audio only.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
AVIOContext * pb
I/O context.
char * url
input or output URL.
void * priv_data
Format private data.
AVStream ** streams
A list of all streams in the file.
int(* io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
A callback for opening new IO streams.
int error
contains the error code or 0 if no error happened
This structure stores compressed data.
int flags
A combination of AV_PKT_FLAG values.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
static int write_trailer(AVFormatContext *s1)