/*1* a64 muxer2* Copyright (c) 2009 Tobias Bindhammer3*4* This file is part of FFmpeg.5*6* FFmpeg is free software; you can redistribute it and/or7* modify it under the terms of the GNU Lesser General Public8* License as published by the Free Software Foundation; either9* version 2.1 of the License, or (at your option) any later version.10*11* FFmpeg is distributed in the hope that it will be useful,12* but WITHOUT ANY WARRANTY; without even the implied warranty of13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU14* Lesser General Public License for more details.15*16* You should have received a copy of the GNU Lesser General Public17* License along with FFmpeg; if not, write to the Free Software18* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA19*/2021#include "libavcodec/avcodec.h"22#include "libavcodec/bytestream.h"23#include "avformat.h"24#include "rawenc.h"2526static int a64_write_header(AVFormatContext *s)27{28AVCodecContext *avctx = s->streams[0]->codec;29uint8_t header[5] = {300x00, //load310x40, //address320x00, //mode330x00, //charset_lifetime (multi only)340x00 //fps in 50/fps;35};3637if (avctx->extradata_size < 4) {38av_log(s, AV_LOG_ERROR, "Missing extradata\n");39return AVERROR_INVALIDDATA;40}4142switch (avctx->codec_id) {43case AV_CODEC_ID_A64_MULTI:44header[2] = 0x00;45header[3] = AV_RB32(avctx->extradata+0);46header[4] = 2;47break;48case AV_CODEC_ID_A64_MULTI5:49header[2] = 0x01;50header[3] = AV_RB32(avctx->extradata+0);51header[4] = 3;52break;53default:54return AVERROR_INVALIDDATA;55}56avio_write(s->pb, header, 2);57return 0;58}5960AVOutputFormat ff_a64_muxer = {61.name = "a64",62.long_name = NULL_IF_CONFIG_SMALL("a64 - video for Commodore 64"),63.extensions = "a64, A64",64.video_codec = AV_CODEC_ID_A64_MULTI,65.write_header = a64_write_header,66.write_packet = ff_raw_write_packet,67};686970