You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-11-29 05:57:37 +02:00
avutil/dict: Unavpriv avpriv_dict_set_timestamp()
And move it to lavf, its only user. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
committed by
James Almer
parent
b306683d12
commit
c389d9ac78
@@ -25,10 +25,8 @@
|
||||
#include "avassert.h"
|
||||
#include "avstring.h"
|
||||
#include "dict.h"
|
||||
#include "dict_internal.h"
|
||||
#include "error.h"
|
||||
#include "mem.h"
|
||||
#include "time_internal.h"
|
||||
#include "bprint.h"
|
||||
|
||||
struct AVDictionary {
|
||||
@@ -274,19 +272,3 @@ int av_dict_get_string(const AVDictionary *m, char **buffer,
|
||||
}
|
||||
return av_bprint_finalize(&bprint, buffer);
|
||||
}
|
||||
|
||||
int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp)
|
||||
{
|
||||
time_t seconds = timestamp / 1000000;
|
||||
struct tm *ptm, tmbuf;
|
||||
ptm = gmtime_r(&seconds, &tmbuf);
|
||||
if (ptm) {
|
||||
char buf[32];
|
||||
if (!strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S", ptm))
|
||||
return AVERROR_EXTERNAL;
|
||||
av_strlcatf(buf, sizeof(buf), ".%06dZ", (int)(timestamp % 1000000));
|
||||
return av_dict_set(dict, key, buf, 0);
|
||||
} else {
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_DICT_INTERNAL_H
|
||||
#define AVUTIL_DICT_INTERNAL_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "dict.h"
|
||||
|
||||
/**
|
||||
* Set a dictionary value to an ISO-8601 compliant timestamp string.
|
||||
*
|
||||
* @param dict pointer to a pointer to a dictionary struct. If *dict is NULL
|
||||
* a dictionary struct is allocated and put in *dict.
|
||||
* @param key metadata key
|
||||
* @param timestamp unix timestamp in microseconds
|
||||
* @return <0 on error
|
||||
*/
|
||||
int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp);
|
||||
|
||||
#endif /* AVUTIL_DICT_INTERNAL_H */
|
||||
Reference in New Issue
Block a user