[FFmpeg-devel] [PATCH] doc/examples/muxing: make compatible with C++
Anshul
anshul.ffmpeg at gmail.com
Thu Mar 13 17:52:07 CET 2014
Michael Niedermayer <michaelni at gmx.at> wrote:
>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..2f26b42 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,
>(AVRounding)(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));
>+ pkt->dts = av_rescale_q_rnd(pkt->dts, *time_base, st->time_base,
>(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;
>
Its an program, which is written in *.c, I dont know how this whole example would be use by c++ code.
If you want to show how this library can be used by c++ code, then small cpp file just dumping information about stream or any other example written with cpp.
IMHO this increase the complexity.
-Anshul
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
More information about the ffmpeg-devel
mailing list