[FFmpeg-devel] [PATCH] doc/examples/muxing: make compatible with C++

Michael Niedermayer michaelni at gmx.at
Thu Mar 13 18:03:49 CET 2014


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 doc/examples/muxing.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index ad8e027..4e1d72b 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -29,6 +29,11 @@
  * @example muxing.c
  */
 
+#ifdef __cplusplus
+    extern "C" {
+#endif
+#define __STDC_FORMAT_MACROS
+#define __STDC_CONSTANT_MACROS
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -40,6 +45,9 @@
 #include <libavformat/avformat.h>
 #include <libswscale/swscale.h>
 #include <libswresample/swresample.h>
+#ifdef __cplusplus
+    }   // extern "C"
+#endif
 
 static int audio_is_eof, video_is_eof;
 
@@ -63,8 +71,8 @@ static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt)
 static int write_frame(AVFormatContext *fmt_ctx, const AVRational *time_base, AVStream *st, AVPacket *pkt)
 {
     /* rescale output packet timestamp values from codec to stream timebase */
-    pkt->pts = av_rescale_q_rnd(pkt->pts, *time_base, st->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
-    pkt->dts = av_rescale_q_rnd(pkt->dts, *time_base, st->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
+    pkt->pts = av_rescale_q_rnd(pkt->pts, *time_base, st->time_base, (enum AVRounding)(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));
+    pkt->dts = av_rescale_q_rnd(pkt->dts, *time_base, st->time_base, (enum AVRounding)(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));
     pkt->duration = av_rescale_q(pkt->duration, *time_base, st->time_base);
     pkt->stream_index = st->index;
 
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list