diff options
author | cboesch <cboesch@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-11-16 21:06:52 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-12-16 03:59:37 +0200 |
commit | e8757fb88311329a35d874b43ff1aaf095ed4147 (patch) | |
tree | d8818a6042537bcc393f368349a2303c6fdcca52 /mplayer.c | |
parent | 970d02c79189ce1c0037fac80bde93f0fa0cb693 (diff) | |
download | mpv-e8757fb88311329a35d874b43ff1aaf095ed4147.tar.bz2 mpv-e8757fb88311329a35d874b43ff1aaf095ed4147.tar.xz |
path.c: add function for mp_basename, remove duplicated macros
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32630 b3059339-0415-0410-9bf9-f77b7e298cf2
Fix crash on path without directories.
Regression introduced in r32630. Patch by Yuriy Kaminskiy yumkam at mail ru.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32631 b3059339-0415-0410-9bf9-f77b7e298cf2
Handle correctly paths with mixed '/' and '\' in it.
Patch by Yuriy Kaminskiy (yumkam at mail ru)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32632 b3059339-0415-0410-9bf9-f77b7e298cf2
Handle ':' on systems with DOS paths: it allows paths like C:foo.avi.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32642 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mplayer.c')
-rw-r--r-- | mplayer.c | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -361,8 +361,6 @@ int use_filename_title; #include "metadata.h" -#define mp_basename2(s) (strrchr(s,'/')==NULL?(char*)s:(strrchr(s,'/')+1)) - const void *mpctx_get_video_out(MPContext *mpctx) { return mpctx->video_out; @@ -477,7 +475,7 @@ char *get_metadata(struct MPContext *mpctx, metadata_t type) { case META_NAME: { - return strdup (mp_basename2 (mpctx->filename)); + return strdup(mp_basename(mpctx->filename)); } case META_VIDEO_CODEC: @@ -1082,8 +1080,6 @@ static int libmpdemux_was_interrupted(struct MPContext *mpctx, int stop_play) return stop_play; } -#define mp_basename(s) (strrchr(s,'\\')==NULL?(mp_basename2(s)):(strrchr(s,'\\')+1)) - static int playtree_add_playlist(struct MPContext *mpctx, play_tree_t* entry) { play_tree_add_bpf(entry,mpctx->filename); @@ -3661,7 +3657,7 @@ while (opts->player_idle_mode && !mpctx->filename) { mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"\nPlaying %s.\n", filename_recode(mpctx->filename)); if(use_filename_title && opts->vo_wintitle == NULL) - opts->vo_wintitle = strdup(mp_basename2(mpctx->filename)); + opts->vo_wintitle = strdup(mp_basename(mpctx->filename)); } if (edl_filename) { @@ -3857,7 +3853,8 @@ if (mpctx->demuxer && mpctx->demuxer->type==DEMUXER_TYPE_PLAYLIST) current_module="handle_demux_playlist"; while (ds_get_packet(mpctx->demuxer->video,&playlist_entry)>0) { - char *temp, *bname; + char *temp; + const char *bname; mp_msg(MSGT_CPLAYER,MSGL_V,"Adding file %s to element entry.\n", filename_recode(playlist_entry)); |