Skip to content

Commit

Permalink
Split mplayer.c
Browse files Browse the repository at this point in the history
mplayer.c was a bit too big. Split it into multiple files. I hope the
way it's split makes sense. Maybe some things don't make too much sense,
or go against intuition. These will fixed as soon as I notice them.

Some files are a bit questionable (misc.c, osd.c, configfiles.c), and
suggestions how to organize this better are welcome.

Regressions are possible due to reorganized include statements.
Obviously I didn't just copy mplayer.c's orgy of include statements, but
recreated them for each file. It's easily possible that there are
oversights and mistakes, which will show up on other platforms.

There is one actual change: the public avutil.h include is removed from
encode.h, and I tried to replace most FFMIN/FFMAX/av_clip uses. I
consider using libavutil too much as dangerous, because the set of
include files they recursively pull in is rather arbitrary and is
different between FFmpeg and Libav.
  • Loading branch information
wm4 committed Oct 30, 2013
1 parent a84258d commit b19414f
Show file tree
Hide file tree
Showing 17 changed files with 5,400 additions and 5,084 deletions.
10 changes: 9 additions & 1 deletion Makefile
Expand Up @@ -209,9 +209,17 @@ SOURCES = audio/audio.c \
mpvcore/playlist_parser.c \
mpvcore/version.c \
mpvcore/input/input.c \
mpvcore/player/audio.c \
mpvcore/player/configfiles.c \
mpvcore/player/command.c \
mpvcore/player/mplayer.c \
mpvcore/player/loadfile.c \
mpvcore/player/main.c \
mpvcore/player/misc.c \
mpvcore/player/osd.c \
mpvcore/player/playloop.c \
mpvcore/player/screenshot.c \
mpvcore/player/sub.c \
mpvcore/player/video.c \
mpvcore/player/timeline/tl_edl.c \
mpvcore/player/timeline/tl_matroska.c \
mpvcore/player/timeline/tl_cue.c \
Expand Down
3 changes: 1 addition & 2 deletions mpvcore/encode.h
Expand Up @@ -2,7 +2,6 @@
#define MPLAYER_ENCODE_H

#include <stdbool.h>
#include <libavutil/avutil.h>

struct MPOpts;
struct encode_lavc_context;
Expand All @@ -15,7 +14,7 @@ void encode_lavc_free(struct encode_lavc_context *ctx);
void encode_lavc_discontinuity(struct encode_lavc_context *ctx);
bool encode_lavc_showhelp(struct MPOpts *opts);
int encode_lavc_getstatus(struct encode_lavc_context *ctx, char *buf, int bufsize, float relative_position);
void encode_lavc_expect_stream(struct encode_lavc_context *ctx, enum AVMediaType mt);
void encode_lavc_expect_stream(struct encode_lavc_context *ctx, int mt);
void encode_lavc_set_video_fps(struct encode_lavc_context *ctx, float fps);
bool encode_lavc_didfail(struct encode_lavc_context *ctx); // check if encoding failed

Expand Down
4 changes: 2 additions & 2 deletions mpvcore/encode_lavc.c
Expand Up @@ -20,6 +20,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include <libavutil/avutil.h>

#include "encode_lavc.h"
#include "mpvcore/mp_msg.h"
Expand Down Expand Up @@ -1033,8 +1034,7 @@ int encode_lavc_getstatus(struct encode_lavc_context *ctx,
return 0;
}

void encode_lavc_expect_stream(struct encode_lavc_context *ctx,
enum AVMediaType mt)
void encode_lavc_expect_stream(struct encode_lavc_context *ctx, int mt)
{
CHECK_FAIL(ctx, );

Expand Down
12 changes: 12 additions & 0 deletions mpvcore/path.c
Expand Up @@ -202,3 +202,15 @@ bool mp_is_url(bstr path)
}
return true;
}

void mp_mk_config_dir(char *subdir)
{
void *tmp = talloc_new(NULL);
char *confdir = talloc_steal(tmp, mp_find_user_config_file(""));
if (confdir) {
if (subdir)
confdir = mp_path_join(tmp, bstr0(confdir), bstr0(subdir));
mkdir(confdir, 0777);
}
talloc_free(tmp);
}
2 changes: 2 additions & 0 deletions mpvcore/path.h
Expand Up @@ -65,4 +65,6 @@ bool mp_path_isdir(const char *path);

bool mp_is_url(bstr path);

void mp_mk_config_dir(char *subdir);

#endif /* MPLAYER_PATH_H */

0 comments on commit b19414f

Please sign in to comment.