[FFmpeg-devel] [PATCH] lavd/avfoundation: Use internal av_strtok instead of std lib strtok

Thilo Borgmann thilo.borgmann at mail.de
Mon Nov 10 20:36:37 CET 2014


Hi,

proposed on github. I don't see any reason why not to stick to internal variants
if we have one.

-Thilo
-------------- next part --------------
>From ae4efc96a742ede2fa59ca6cc59ffc1979c75f72 Mon Sep 17 00:00:00 2001
From: Thilo Borgmann <thilo.borgmann at mail.de>
Date: Mon, 10 Nov 2014 20:31:14 +0100
Subject: [PATCH] lavd/avfoundation: Use internal av_strtok instead of std lib
 strtok

---
 libavdevice/avfoundation.m | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index 5e5f70b..e756225 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -30,6 +30,7 @@
 
 #include "libavutil/pixdesc.h"
 #include "libavutil/opt.h"
+#include "libavutil/avstring.h"
 #include "libavformat/internal.h"
 #include "libavutil/internal.h"
 #include "libavutil/time.h"
@@ -253,12 +254,13 @@ static void parse_device_name(AVFormatContext *s)
 {
     AVFContext *ctx = (AVFContext*)s->priv_data;
     char *tmp = av_strdup(s->filename);
+    char *save;
 
     if (tmp[0] != ':') {
-        ctx->video_filename = strtok(tmp,  ":");
-        ctx->audio_filename = strtok(NULL, ":");
+        ctx->video_filename = av_strtok(tmp,  ":", &save);
+        ctx->audio_filename = av_strtok(NULL, ":", &save);
     } else {
-        ctx->audio_filename = strtok(tmp,  ":");
+        ctx->audio_filename = av_strtok(tmp,  ":", &save);
     }
 }
 
-- 
1.8.3.2



More information about the ffmpeg-devel mailing list