summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2010-05-21 07:07:57 +0000
committerMartin Storsjö <martin@martin.st>2010-05-21 07:07:57 +0000
commit9a761250699dc179c8e31caa55b1a785a5601e5e (patch)
treebac7f4d7c0a6016bc975b4194bb6fbd48a317a3f /libavformat/utils.c
parent6531b5c9f4388d28183be8f04d6cf2b42a2eee93 (diff)
Add a libavformat internal function ff_write_chained
Originally committed as revision 23207 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 9b5ae5dffa..435720f4a4 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3591,3 +3591,22 @@ int ff_url_join(char *str, int size, const char *proto,
}
return strlen(str);
}
+
+int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt,
+ AVFormatContext *src)
+{
+ AVPacket local_pkt;
+
+ local_pkt = *pkt;
+ local_pkt.stream_index = dst_stream;
+ if (pkt->pts != AV_NOPTS_VALUE)
+ local_pkt.pts = av_rescale_q(pkt->pts,
+ src->streams[pkt->stream_index]->time_base,
+ dst->streams[dst_stream]->time_base);
+ if (pkt->dts != AV_NOPTS_VALUE)
+ local_pkt.dts = av_rescale_q(pkt->dts,
+ src->streams[pkt->stream_index]->time_base,
+ dst->streams[dst_stream]->time_base);
+ return av_write_frame(dst, &local_pkt);
+}
+