Skip to content

Commit

Permalink
ios: clean up log level
Browse files Browse the repository at this point in the history
  • Loading branch information
bbcallen committed Jun 26, 2015
1 parent 34ae5ad commit eb90855
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 21 deletions.
13 changes: 7 additions & 6 deletions ijkmedia/ijkplayer/ff_ffplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -2835,10 +2835,10 @@ static int lockmgr(void **mtx, enum AVLockOp op)

static bool g_ffmpeg_global_inited = false;

inline static int av_log_level_to_ffp_log_level(int av_log_level)
inline static int log_level_av_to_ffp(int av_log_level)
{
int ffplv = IJK_LOG_VERBOSE;
if (av_log_level <= AV_LOG_ERROR) ffplv = IJK_LOG_ERROR;
if (av_log_level <= AV_LOG_ERROR) ffplv = IJK_LOG_ERROR;
else if (av_log_level <= AV_LOG_WARNING) ffplv = IJK_LOG_WARN;
else if (av_log_level <= AV_LOG_INFO) ffplv = IJK_LOG_INFO;
else if (av_log_level <= AV_LOG_VERBOSE) ffplv = IJK_LOG_VERBOSE;
Expand All @@ -2849,19 +2849,20 @@ inline static int av_log_level_to_ffp_log_level(int av_log_level)

static void ffp_log_callback_brief(void *ptr, int level, const char *fmt, va_list vl)
{
int ffplv __unused = av_log_level_to_ffp_log_level(level);
if (level > av_log_get_level())
return;

int ffplv __unused = log_level_av_to_ffp(level);
VLOG(ffplv, IJK_LOG_TAG, fmt, vl);
}

static void ffp_log_callback_report(void *ptr, int level, const char *fmt, va_list vl)
{
int ffplv __unused = av_log_level_to_ffp_log_level(level);
if (level > av_log_get_level())
return;

int ffplv __unused = log_level_av_to_ffp(level);

va_list vl2;
char line[1024];
static int print_prefix = 1;
Expand Down Expand Up @@ -2915,7 +2916,7 @@ void ffp_global_uninit()
g_ffmpeg_global_inited = false;
}

void ffp_global_set_log_report(int use_report)
void ffp_global_set_ff_log_report(int use_report)
{
if (use_report) {
av_log_set_callback(ffp_log_callback_report);
Expand All @@ -2924,7 +2925,7 @@ void ffp_global_set_log_report(int use_report)
}
}

void ffp_global_set_log_level(int log_level)
void ffp_global_set_ff_log_level(int log_level)
{
av_log_set_level(log_level);
}
Expand Down
4 changes: 2 additions & 2 deletions ijkmedia/ijkplayer/ff_ffplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

void ffp_global_init();
void ffp_global_uninit();
void ffp_global_set_log_report(int use_report);
void ffp_global_set_log_level(int log_level);
void ffp_global_set_ff_log_report(int use_report);
void ffp_global_set_ff_log_level(int log_level);
void ffp_io_stat_register(void (*cb)(const char *url, int type, int bytes));
void ffp_io_stat_complete_register(void (*cb)(const char *url,
int64_t read_bytes, int64_t total_size,
Expand Down
8 changes: 4 additions & 4 deletions ijkmedia/ijkplayer/ijkplayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ void ijkmp_global_uninit()
ffp_global_uninit();
}

void ijkmp_global_set_log_report(int use_report)
void ijkmp_global_set_ff_log_report(int use_report)
{
ffp_global_set_log_report(use_report);
ffp_global_set_ff_log_report(use_report);
}

void ijkmp_global_set_log_level(int log_level)
void ijkmp_global_set_ff_log_level(int log_level)
{
ffp_global_set_log_level(log_level);
ffp_global_set_ff_log_level(log_level);
}

void ijkmp_io_stat_register(void (*cb)(const char *url, int type, int bytes))
Expand Down
6 changes: 3 additions & 3 deletions ijkmedia/ijkplayer/ijkplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "ijkmeta.h"

#ifndef MPTRACE
#define MPTRACE ALOGW
#define MPTRACE ALOGD
#endif

typedef struct IjkMediaPlayer IjkMediaPlayer;
Expand Down Expand Up @@ -152,8 +152,8 @@ typedef struct SDL_Vout SDL_Vout;

void ijkmp_global_init();
void ijkmp_global_uninit();
void ijkmp_global_set_log_report(int use_report);
void ijkmp_global_set_log_level(int log_level);
void ijkmp_global_set_ff_log_report(int use_report);
void ijkmp_global_set_ff_log_level(int log_level); // log_level = AV_LOG_xxx
void ijkmp_io_stat_register(void (*cb)(const char *url, int type, int bytes));
void ijkmp_io_stat_complete_register(void (*cb)(const char *url,
int64_t read_bytes, int64_t total_size,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ typedef enum IJKAVLogLevel {
- (void)setPauseInBackground:(BOOL)pause;
- (BOOL)isVideoToolboxOpen;

+ (void)setLogReport:(BOOL)preferLogReport;
+ (void)setLogLevel:(IJKAVLogLevel)logLevel;
+ (void)setFFLogReport:(BOOL)preferLogReport;
+ (void)setFFLogLevel:(IJKAVLogLevel)logLevel;

@property(nonatomic, readonly) CGFloat fpsInMeta;
@property(nonatomic, readonly) CGFloat fpsAtOutput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,14 +346,14 @@ - (void)setOptionIntValue:(NSInteger)value
ijkmp_set_option_int(_mediaPlayer, getPlayerOption(category), [key UTF8String], value);
}

+ (void)setLogReport:(BOOL)preferLogReport
+ (void)setFFLogReport:(BOOL)preferLogReport
{
ijkmp_global_set_log_report(preferLogReport ? 1 : 0);
ijkmp_global_set_ff_log_report(preferLogReport ? 1 : 0);
}

+ (void)setLogLevel:(IJKAVLogLevel)logLevel
+ (void)setFFLogLevel:(IJKAVLogLevel)logLevel
{
ijkmp_global_set_log_level(logLevel);
ijkmp_global_set_ff_log_level(logLevel);
}

- (void)shutdown
Expand Down

0 comments on commit eb90855

Please sign in to comment.