• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

libavformat/microdvdenc.c

Go to the documentation of this file.
00001 /*
00002  * MicroDVD subtitle muxer
00003  * Copyright (c) 2010  Aurelien Jacobs <aurel@gnuage.org>
00004  *
00005  * This file is part of FFmpeg.
00006  *
00007  * FFmpeg is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * FFmpeg is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with FFmpeg; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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 };

Generated on Fri Feb 22 2013 07:24:31 for FFmpeg by  doxygen 1.7.1