History

Merge commit '6dd93ee6f1b050ad7c4b247899e83efa293ee405'

* commit '6dd93ee6f1b050ad7c4b247899e83efa293ee405': hlsenc: check append_entry return value hlsenc: use the basename to generate the list entries avstring: add av_basename and av_dirname Conflicts: Changelog doc/APIchanges libavutil/version.h

Michael Niedermayer committed 13 years ago

Commit 2ce43b32 parents 613001d 6dd93ee6 files · +70 −5Browse files

Unified · Split

6 files
  1. Changelog +1 −0
  2. doc/APIchanges +3 −0
  3. libavformat/hlsenc.c +8 −4
  4. libavutil/avstring.c +41 −0
  5. libavutil/avstring.h +16 −0
  6. libavutil/version.h +1 −1
Changelog+1−0
@@ -50,6 +50,7 @@ version <next>: · 49 unmodified lines
50- documentation split into per-component manuals50- documentation split into per-component manuals
51- pp (postproc) filter ported from MPlayer51- pp (postproc) filter ported from MPlayer
52- NIST Sphere demuxer52- NIST Sphere demuxer
53- av_basename and av_dirname
53 54
54 55
55version 1.0:56version 1.0:
doc/APIchanges+3−0
@@ -132,6 +132,9 @@ API changes, most recent first: · 131 unmodified lines
1322012-03-26 - a67d9cf - lavfi 2.66.1001322012-03-26 - a67d9cf - lavfi 2.66.100
133 Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.133 Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
134 134
1352012-xx-xx - xxxxxxx - lavu 52.2.1 - avstring.h
136 Add av_basename() and av_dirname().
137
1352012-11-10 - 5980f5dd - lavu 52.2.0 - audioconvert.h1382012-11-10 - 5980f5dd - lavu 52.2.0 - audioconvert.h
136 Rename audioconvert.h to channel_layout.h. audioconvert.h is now deprecated.139 Rename audioconvert.h to channel_layout.h. audioconvert.h is now deprecated.
137 140
libavformat/hlsenc.c+8−4
@@ -85,7 +85,8 @@ static int append_entry(HLSContext *hls, uint64_t duration) · 84 unmodified lines
85 if (!en)85 if (!en)
86 return AVERROR(ENOMEM);86 return AVERROR(ENOMEM);
87 87
88 av_get_frame_filename(en->name, sizeof(en->name), hls->basename,88 av_get_frame_filename(en->name, sizeof(en->name),
89 av_basename(hls->basename),
89 hls->number -1);90 hls->number -1);
90 91
91 en->duration = duration;92 en->duration = duration;
@@ -260,9 +261,12 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) · 168 unmodified lines
260 av_compare_ts(pkt->pts, st->time_base, end_pts, AV_TIME_BASE_Q) >= 0 &&261 av_compare_ts(pkt->pts, st->time_base, end_pts, AV_TIME_BASE_Q) >= 0 &&
261 pkt->flags & AV_PKT_FLAG_KEY) {262 pkt->flags & AV_PKT_FLAG_KEY) {
262 263
263 append_entry(hls, av_rescale(pkt->pts - hls->end_pts,264 ret = append_entry(hls, av_rescale(pkt->pts - hls->end_pts,
264 st->time_base.num,265 st->time_base.num,
265 st->time_base.den));266 st->time_base.den));
267 if (ret)
268 return ret;
269
266 hls->end_pts = pkt->pts;270 hls->end_pts = pkt->pts;
267 271
268 av_write_frame(oc, NULL); /* Flush any buffered data */272 av_write_frame(oc, NULL); /* Flush any buffered data */
libavutil/avstring.c+41−0
@@ -25,6 +25,8 @@ · 24 unmodified lines
25#include <string.h>25#include <string.h>
26#include <ctype.h>26#include <ctype.h>
27#include "avstring.h"27#include "avstring.h"
28#include "config.h"
29#include "common.h"
28#include "mem.h"30#include "mem.h"
29 31
30int av_strstart(const char *str, const char *pfx, const char **ptr)32int av_strstart(const char *str, const char *pfx, const char **ptr)
@@ -211,6 +213,45 @@ int av_strncasecmp(const char *a, const char *b, size_t n) · 180 unmodified lines
211 return c1 - c2;213 return c1 - c2;
212}214}
213 215
216const char *av_basename(const char *path)
217{
218 char *p = strrchr(path, '/');
219
220#if HAVE_DOS_PATHS
221 char *q = strrchr(path, '\\');
222 char *d = strchr(path, ':');
223
224 p = FFMAX3(p, q, d);
225#endif
226
227 if (!p)
228 return path;
229
230 return p + 1;
231}
232
233const char *av_dirname(char *path)
234{
235 char *p = strrchr(path, '/');
236
237#if HAVE_DOS_PATHS
238 char *q = strrchr(path, '\\');
239 char *d = strchr(path, ':');
240
241 d = d ? d + 1 : d;
242
243 p = FFMAX3(p, q, d);
244#endif
245
246 if (!p)
247 return ".";
248
249 *p = '\0';
250
251 return path;
252}
253
254
214#ifdef TEST255#ifdef TEST
215 256
216#include "common.h"257#include "common.h"
libavutil/avstring.h+16−0
@@ -202,6 +202,22 @@ int av_strcasecmp(const char *a, const char *b); · 201 unmodified lines
202 */202 */
203int av_strncasecmp(const char *a, const char *b, size_t n);203int av_strncasecmp(const char *a, const char *b, size_t n);
204 204
205
206/**
207 * Thread safe basename.
208 * @param path the path, on DOS both \ and / are considered separators.
209 * @return pointer to the basename substring.
210 */
211const char *av_basename(const char *path);
212
213/**
214 * Thread safe dirname.
215 * @param path the path, on DOS both \ and / are considered separators.
216 * @return the path with the separator replaced by the string terminator or ".".
217 * @note the function may change the input string.
218 */
219const char *av_dirname(char *path);
220
205/**221/**
206 * @}222 * @}
207 */223 */
libavutil/version.h+1−1
@@ -75,7 +75,7 @@ · 74 unmodified lines
75 */75 */
76 76
77#define LIBAVUTIL_VERSION_MAJOR 5277#define LIBAVUTIL_VERSION_MAJOR 52
78#define LIBAVUTIL_VERSION_MINOR 1278#define LIBAVUTIL_VERSION_MINOR 13
79#define LIBAVUTIL_VERSION_MICRO 10079#define LIBAVUTIL_VERSION_MICRO 100
80 80
81#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \81#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t