00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "libavcodec/avcodec.h"
00023 #include "libavcodec/a64enc.h"
00024 #include "libavcodec/bytestream.h"
00025 #include "avformat.h"
00026 #include "rawenc.h"
00027
00028 static int a64_write_header(struct AVFormatContext *s)
00029 {
00030 AVCodecContext *avctx = s->streams[0]->codec;
00031 uint8_t header[5] = {
00032 0x00,
00033 0x40,
00034 0x00,
00035 0x00,
00036 0x00
00037 };
00038 switch (avctx->codec->id) {
00039 case AV_CODEC_ID_A64_MULTI:
00040 header[2] = 0x00;
00041 header[3] = AV_RB32(avctx->extradata+0);
00042 header[4] = 2;
00043 break;
00044 case AV_CODEC_ID_A64_MULTI5:
00045 header[2] = 0x01;
00046 header[3] = AV_RB32(avctx->extradata+0);
00047 header[4] = 3;
00048 break;
00049 default:
00050 return AVERROR(EINVAL);
00051 }
00052 avio_write(s->pb, header, 2);
00053 return 0;
00054 }
00055
00056 AVOutputFormat ff_a64_muxer = {
00057 .name = "a64",
00058 .long_name = NULL_IF_CONFIG_SMALL("a64 - video for Commodore 64"),
00059 .extensions = "a64, A64",
00060 .video_codec = AV_CODEC_ID_A64_MULTI,
00061 .write_header = a64_write_header,
00062 .write_packet = ff_raw_write_packet,
00063 };