00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #include "avformat.h"
00023 #include "rawenc.h"
00024 
00025 static int microdvd_write_header(struct AVFormatContext *s)
00026 {
00027     AVCodecContext *avctx = s->streams[0]->codec;
00028 
00029     if (s->nb_streams != 1 || avctx->codec_id != CODEC_ID_MICRODVD) {
00030         av_log(s, AV_LOG_ERROR, "Exactly one MicroDVD stream is needed.\n");
00031         return -1;
00032     }
00033 
00034     if (avctx->extradata && avctx->extradata_size > 0) {
00035         avio_write(s->pb, "{DEFAULT}{}", 11);
00036         avio_write(s->pb, avctx->extradata, avctx->extradata_size);
00037         avio_flush(s->pb);
00038     }
00039     return 0;
00040 }
00041 
00042 AVOutputFormat ff_microdvd_muxer = {
00043     .name           = "microdvd",
00044     .long_name      = NULL_IF_CONFIG_SMALL("MicroDVD subtitle format"),
00045     .mime_type      = "text/x-microdvd",
00046     .extensions     = "sub",
00047     .write_header   = microdvd_write_header,
00048     .write_packet   = ff_raw_write_packet,
00049     .flags          = AVFMT_NOTIMESTAMPS,
00050     .subtitle_codec = CODEC_ID_MICRODVD,
00051 };