On 9/25/18 12:28 AM, James Courtier-Dutton wrote: > On 24 September 2018 at 13:48, Moritz Barsnick <barsn...@gmx.net> wrote: > >> On Mon, Sep 24, 2018 at 12:39:42 +0100, James Courtier-Dutton wrote: >> >>> Automatically create sub-directories if needed based on date. >>> E.g. >>> ffmpeg ... -timelimit 2147483647 -f segment -strftime 1 -segment_time 10 >> "%Y/%m/%d/%Y-%m-%d_%H-%M-%S.mkv" >> [...] >>> +static int mkdir_p(const char *path) { >> >> Is this code duplicated from libavformat/hlsenc.c? >> >> I don't know what the policy is, and how code from hls vs. segment has >> been deduplicated previously, but it seems like this is a candidate for >> being careful. >> >> > It is a duplicate from hisenc.c. hisenc already has this "create > sub-directories" feature, but I needed it for the segment use case. > I made it static so that it would be treated as local to the .c file. > I don't know ffmpeg well enough to know how best to de-duplicate it. > I am happy to update my patch, if someone can give me a pointer as to what > to do.
When faced with a similar situation, I created a new file(.c and .h) with those function made global within libavformat(prefix it with ff_). Then these functions could be used by both hlsenc.c and other files inside the libavformat library. You could refer to below commit as a pointer https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/da49cdf6401ea3caa616c226f24dfb407633acd0 > > Kind Regards > > James > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel