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

libavformat/mkvtimestamp_v2.c

Go to the documentation of this file.
00001 /*
00002  * extract pts as timecode v2, as defined by mkvtoolnix
00003  * Copyright (c) 2009 David Conrad
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 "internal.h"
00024 
00025 static int write_header(AVFormatContext *s)
00026 {
00027     static const char *header = "# timecode format v2\n";
00028     put_buffer(s->pb, header, strlen(header));
00029     avpriv_set_pts_info(s->streams[0], 64, 1, 1000);
00030     return 0;
00031 }
00032 
00033 static int write_packet(AVFormatContext *s, AVPacket *pkt)
00034 {
00035     char buf[256];
00036     if (pkt->stream_index)
00037         av_log(s, AV_LOG_WARNING, "More than one stream unsupported\n");
00038     snprintf(buf, sizeof(buf), "%" PRId64 "\n", pkt->dts);
00039     put_buffer(s->pb, buf, strlen(buf));
00040     put_flush_packet(s->pb);
00041     return 0;
00042 }
00043 
00044 AVOutputFormat ff_mkvtimestamp_v2_muxer = {
00045     .name         = "mkvtimestamp_v2",
00046     .long_name    = NULL_IF_CONFIG_SMALL("extract pts as timecode v2 format, as defined by mkvtoolnix"),
00047     .audio_codec  = CODEC_ID_NONE,
00048     .video_codec  = CODEC_ID_RAWVIDEO,
00049     .write_header = write_header,
00050     .write_packet = write_packet,
00051 };
Generated on Fri Feb 1 2013 14:34:52 for FFmpeg by doxygen 1.7.1