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 "internal.h"
00024
00025 static int write_header(AVFormatContext *s)
00026 {
00027 static const char *header = "# timecode format v2\n";
00028 avio_write(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 avio_write(s->pb, buf, strlen(buf));
00040 avio_flush(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 };