summaryrefslogtreecommitdiffstats
path: root/command.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-08-07 04:45:40 +0300
committerUoti Urpala <uau@mplayer2.org>2011-08-07 04:57:16 +0300
commitd52acba688a0fceff93888097951d8bd61f3bc7e (patch)
tree28da555d2cc2d852f145efd4231b664d28cf7a27 /command.c
parent0fd7e6ec93c54b5f22c6e8730448cc9170ae7d99 (diff)
downloadmpv-d52acba688a0fceff93888097951d8bd61f3bc7e.tar.bz2
mpv-d52acba688a0fceff93888097951d8bd61f3bc7e.tar.xz
cleanup: reformat command.c
Diffstat (limited to 'command.c')
-rw-r--r--command.c2036
1 files changed, 1014 insertions, 1022 deletions
diff --git a/command.c b/command.c
index cd1750ca54..48f3a7e6b4 100644
--- a/command.c
+++ b/command.c
@@ -80,9 +80,11 @@ static void rescale_input_coordinates(struct MPContext *mpctx, int ix, int iy,
struct vo *vo = mpctx->video_out;
//remove the borders, if any, and rescale to the range [0,1],[0,1]
if (vo_fs) { //we are in full-screen mode
- if (opts->vo_screenwidth > vo->dwidth) //there are borders along the x axis
+ if (opts->vo_screenwidth > vo->dwidth)
+ // there are borders along the x axis
ix -= (opts->vo_screenwidth - vo->dwidth) / 2;
- if (opts->vo_screenheight > vo->dheight) //there are borders along the y axis (usual way)
+ if (opts->vo_screenheight > vo->dheight)
+ // there are borders along the y axis (usual way)
iy -= (opts->vo_screenheight - vo->dheight) / 2;
if (ix < 0 || ix > vo->dwidth) {
@@ -214,20 +216,12 @@ static void log_sub(struct MPContext *mpctx)
fprintf(f, "N: %s S: %ld E: %ld\n", mpctx->filename,
vo_sub_last->start, vo_sub_last->end);
}
- for (i = 0; i < vo_sub_last->lines; i++) {
+ for (i = 0; i < vo_sub_last->lines; i++)
fprintf(f, "%s\n", vo_sub_last->text[i]);
- }
fclose(f);
}
-/// \defgroup Properties
-///@{
-
-/// \defgroup GeneralProperties General properties
-/// \ingroup Properties
-///@{
-
static int mp_property_generic_option(struct m_option *prop, int action,
void *arg, MPContext *mpctx)
{
@@ -276,11 +270,12 @@ static int mp_property_loop(m_option_t *prop, int action, void *arg,
struct MPOpts *opts = &mpctx->opts;
switch (action) {
case M_PROPERTY_PRINT:
- if (!arg) return M_PROPERTY_ERROR;
+ if (!arg)
+ return M_PROPERTY_ERROR;
if (opts->loop_times < 0)
- *(char**)arg = talloc_strdup(NULL, "off");
+ *(char **)arg = talloc_strdup(NULL, "off");
else if (opts->loop_times == 0)
- *(char**)arg = talloc_strdup(NULL, "inf");
+ *(char **)arg = talloc_strdup(NULL, "inf");
else
break;
return M_PROPERTY_OK;
@@ -304,7 +299,7 @@ static int mp_property_playback_speed(m_option_t *prop, int action,
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
opts->playback_speed += (arg ? *(float *) arg : 0.1) *
- (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
+ (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
M_PROPERTY_CLAMP(prop, opts->playback_speed);
reinit_audio_chain(mpctx);
return M_PROPERTY_OK;
@@ -431,23 +426,25 @@ static int mp_property_length(m_option_t *prop, int action, void *arg,
/// Current position in percent (RW)
static int mp_property_percent_pos(m_option_t *prop, int action,
- void *arg, MPContext *mpctx) {
+ void *arg, MPContext *mpctx)
+{
int pos;
if (!mpctx->demuxer)
return M_PROPERTY_UNAVAILABLE;
- switch(action) {
+ switch (action) {
case M_PROPERTY_SET:
- if(!arg) return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(int*)arg);
- pos = *(int*)arg;
+ if (!arg)
+ return M_PROPERTY_ERROR;
+ M_PROPERTY_CLAMP(prop, *(int *)arg);
+ pos = *(int *)arg;
break;
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
pos = get_percent_pos(mpctx);
- pos += (arg ? *(int*)arg : 10) *
- (action == M_PROPERTY_STEP_UP ? 1 : -1);
+ pos += (arg ? *(int *)arg : 10) *
+ (action == M_PROPERTY_STEP_UP ? 1 : -1);
M_PROPERTY_CLAMP(prop, pos);
break;
default:
@@ -460,19 +457,21 @@ static int mp_property_percent_pos(m_option_t *prop, int action,
/// Current position in seconds (RW)
static int mp_property_time_pos(m_option_t *prop, int action,
- void *arg, MPContext *mpctx) {
+ void *arg, MPContext *mpctx)
+{
if (!(mpctx->sh_video || mpctx->sh_audio))
return M_PROPERTY_UNAVAILABLE;
- switch(action) {
+ switch (action) {
case M_PROPERTY_SET:
- if(!arg) return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(double*)arg);
- queue_seek(mpctx, MPSEEK_ABSOLUTE, *(double*)arg, 0);
+ if (!arg)
+ return M_PROPERTY_ERROR;
+ M_PROPERTY_CLAMP(prop, *(double *)arg);
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, *(double *)arg, 0);
return M_PROPERTY_OK;
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
- queue_seek(mpctx, MPSEEK_RELATIVE, (arg ? *(double*)arg : 10.0) *
+ queue_seek(mpctx, MPSEEK_RELATIVE, (arg ? *(double *)arg : 10.0) *
(action == M_PROPERTY_STEP_UP ? 1.0 : -1.0), 0);
return M_PROPERTY_OK;
}
@@ -511,13 +510,13 @@ static int mp_property_chapter(m_option_t *prop, int action, void *arg,
case M_PROPERTY_SET:
if (!arg)
return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(int*)arg);
+ M_PROPERTY_CLAMP(prop, *(int *)arg);
step_all = *(int *)arg - chapter;
chapter += step_all;
break;
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN: {
- step_all = (arg && *(int*)arg != 0 ? *(int*)arg : 1)
+ step_all = (arg && *(int *)arg != 0 ? *(int *)arg : 1)
* (action == M_PROPERTY_STEP_UP ? 1 : -1);
chapter += step_all;
if (chapter < 0)
@@ -548,18 +547,19 @@ static int mp_property_chapter(m_option_t *prop, int action, void *arg,
/// Number of chapters in file
static int mp_property_chapters(m_option_t *prop, int action, void *arg,
- MPContext *mpctx)
+ MPContext *mpctx)
{
if (!mpctx->demuxer)
return M_PROPERTY_UNAVAILABLE;
if (mpctx->demuxer->num_chapters == 0)
- stream_control(mpctx->demuxer->stream, STREAM_CTRL_GET_NUM_CHAPTERS, &mpctx->demuxer->num_chapters);
+ stream_control(mpctx->demuxer->stream, STREAM_CTRL_GET_NUM_CHAPTERS,
+ &mpctx->demuxer->num_chapters);
return m_property_int_ro(prop, action, arg, mpctx->demuxer->num_chapters);
}
/// Current dvd angle (RW)
static int mp_property_angle(m_option_t *prop, int action, void *arg,
- MPContext *mpctx)
+ MPContext *mpctx)
{
struct MPOpts *opts = &mpctx->opts;
int angle = -1;
@@ -594,9 +594,9 @@ static int mp_property_angle(m_option_t *prop, int action, void *arg,
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN: {
int step = 0;
- if(arg)
- step = *(int*)arg;
- if(!step)
+ if (arg)
+ step = *(int *)arg;
+ if (!step)
step = 1;
step *= (action == M_PROPERTY_STEP_UP ? 1 : -1);
angle += step;
@@ -627,32 +627,39 @@ static int mp_property_angle(m_option_t *prop, int action, void *arg,
/// Demuxer meta data
static int mp_property_metadata(m_option_t *prop, int action, void *arg,
- MPContext *mpctx) {
- m_property_action_t* ka;
- char* meta;
+ MPContext *mpctx)
+{
+ m_property_action_t *ka;
+ char *meta;
static const m_option_t key_type =
- { "metadata", NULL, CONF_TYPE_STRING, 0, 0, 0, NULL };
+ {
+ "metadata", NULL, CONF_TYPE_STRING, 0, 0, 0, NULL
+ };
if (!mpctx->demuxer)
return M_PROPERTY_UNAVAILABLE;
- switch(action) {
+ switch (action) {
case M_PROPERTY_GET:
- if(!arg) return M_PROPERTY_ERROR;
- *(char***)arg = mpctx->demuxer->info;
+ if (!arg)
+ return M_PROPERTY_ERROR;
+ *(char ***)arg = mpctx->demuxer->info;
return M_PROPERTY_OK;
case M_PROPERTY_KEY_ACTION:
- if(!arg) return M_PROPERTY_ERROR;
+ if (!arg)
+ return M_PROPERTY_ERROR;
ka = arg;
- if(!(meta = demux_info_get(mpctx->demuxer,ka->key)))
+ if (!(meta = demux_info_get(mpctx->demuxer, ka->key)))
return M_PROPERTY_UNKNOWN;
- switch(ka->action) {
+ switch (ka->action) {
case M_PROPERTY_GET:
- if(!ka->arg) return M_PROPERTY_ERROR;
- *(char**)ka->arg = meta;
+ if (!ka->arg)
+ return M_PROPERTY_ERROR;
+ *(char **)ka->arg = meta;
return M_PROPERTY_OK;
case M_PROPERTY_GET_TYPE:
- if(!ka->arg) return M_PROPERTY_ERROR;
- *(const m_option_t**)ka->arg = &key_type;
+ if (!ka->arg)
+ return M_PROPERTY_ERROR;
+ *(const m_option_t **)ka->arg = &key_type;
return M_PROPERTY_OK;
}
}
@@ -668,15 +675,14 @@ static int mp_property_pause(m_option_t *prop, int action, void *arg,
case M_PROPERTY_SET:
if (!arg)
return M_PROPERTY_ERROR;
- if (mpctx->paused == (bool)*(int *) arg)
+ if (mpctx->paused == (bool) * (int *)arg)
return M_PROPERTY_OK;
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
if (mpctx->paused) {
unpause_player(mpctx);
mpctx->osd_function = OSD_PLAY;
- }
- else {
+ } else {
pause_player(mpctx);
mpctx->osd_function = OSD_PAUSE;
}
@@ -687,12 +693,6 @@ static int mp_property_pause(m_option_t *prop, int action, void *arg,
}
-///@}
-
-/// \defgroup AudioProperties Audio properties
-/// \ingroup Properties
-///@{
-
/// Volume (RW)
static int mp_property_volume(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
@@ -707,13 +707,13 @@ static int mp_property_volume(m_option_t *prop, int action, void *arg,
return M_PROPERTY_ERROR;
mixer_getbothvolume(&mpctx->mixer, arg);
return M_PROPERTY_OK;
- case M_PROPERTY_PRINT:{
- float vol;
- if (!arg)
- return M_PROPERTY_ERROR;
- mixer_getbothvolume(&mpctx->mixer, &vol);
- return m_property_float_range(prop, action, arg, &vol);
- }
+ case M_PROPERTY_PRINT: {
+ float vol;
+ if (!arg)
+ return M_PROPERTY_ERROR;
+ mixer_getbothvolume(&mpctx->mixer, &vol);
+ return m_property_float_range(prop, action, arg, &vol);
+ }
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
case M_PROPERTY_SET:
@@ -797,14 +797,14 @@ static int mp_property_audio_delay(m_option_t *prop, int action,
case M_PROPERTY_SET:
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN: {
- int ret;
- float delay = audio_delay;
- ret = m_property_delay(prop, action, arg, &audio_delay);
- if (ret != M_PROPERTY_OK)
- return ret;
- if (mpctx->sh_audio)
- mpctx->delay -= audio_delay - delay;
- }
+ int ret;
+ float delay = audio_delay;
+ ret = m_property_delay(prop, action, arg, &audio_delay);
+ if (ret != M_PROPERTY_OK)
+ return ret;
+ if (mpctx->sh_audio)
+ mpctx->delay -= audio_delay - delay;
+ }
return M_PROPERTY_OK;
default:
return m_property_delay(prop, action, arg, &audio_delay);
@@ -826,7 +826,8 @@ static int mp_property_audio_codec(m_option_t *prop, int action,
{
if (!mpctx->sh_audio || !mpctx->sh_audio->codec)
return M_PROPERTY_UNAVAILABLE;
- return m_property_string_ro(prop, action, arg, mpctx->sh_audio->codec->name);
+ return m_property_string_ro(prop, action, arg,
+ mpctx->sh_audio->codec->name);
}
/// Audio bitrate (RO)
@@ -844,11 +845,12 @@ static int mp_property_samplerate(m_option_t *prop, int action, void *arg,
{
if (!mpctx->sh_audio)
return M_PROPERTY_UNAVAILABLE;
- switch(action) {
+ switch (action) {
case M_PROPERTY_PRINT:
- if(!arg) return M_PROPERTY_ERROR;
- *(char**)arg = talloc_asprintf(NULL, "%d kHz",
- mpctx->sh_audio->samplerate/1000);
+ if (!arg)
+ return M_PROPERTY_ERROR;
+ *(char **)arg = talloc_asprintf(NULL, "%d kHz",
+ mpctx->sh_audio->samplerate / 1000);
return M_PROPERTY_OK;
}
return m_property_int_ro(prop, action, arg, mpctx->sh_audio->samplerate);
@@ -882,7 +884,7 @@ static int mp_property_channels(m_option_t *prop, int action, void *arg,
/// Balance (RW)
static int mp_property_balance(m_option_t *prop, int action, void *arg,
- MPContext *mpctx)
+ MPContext *mpctx)
{
float bal;
@@ -896,36 +898,36 @@ static int mp_property_balance(m_option_t *prop, int action, void *arg,
mixer_getbalance(&mpctx->mixer, arg);
return M_PROPERTY_OK;
case M_PROPERTY_PRINT: {
- char** str = arg;
- if (!arg)
- return M_PROPERTY_ERROR;
- mixer_getbalance(&mpctx->mixer, &bal);
- if (bal == 0.f)
- *str = talloc_strdup(NULL, "center");
- else if (bal == -1.f)
- *str = talloc_strdup(NULL, "left only");
- else if (bal == 1.f)
- *str = talloc_strdup(NULL, "right only");
- else {
- unsigned right = (bal + 1.f) / 2.f * 100.f;
- *str = talloc_asprintf(NULL, "left %d%%, right %d%%",
- 100 - right, right);
- }
- return M_PROPERTY_OK;
+ char **str = arg;
+ if (!arg)
+ return M_PROPERTY_ERROR;
+ mixer_getbalance(&mpctx->mixer, &bal);
+ if (bal == 0.f)
+ *str = talloc_strdup(NULL, "center");
+ else if (bal == -1.f)
+ *str = talloc_strdup(NULL, "left only");
+ else if (bal == 1.f)
+ *str = talloc_strdup(NULL, "right only");
+ else {
+ unsigned right = (bal + 1.f) / 2.f * 100.f;
+ *str = talloc_asprintf(NULL, "left %d%%, right %d%%",
+ 100 - right, right);
}
+ return M_PROPERTY_OK;
+ }
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
mixer_getbalance(&mpctx->mixer, &bal);
- bal += (arg ? *(float*)arg : .1f) *
- (action == M_PROPERTY_STEP_UP ? 1.f : -1.f);
+ bal += (arg ? *(float *)arg : .1f) *
+ (action == M_PROPERTY_STEP_UP ? 1.f : -1.f);
M_PROPERTY_CLAMP(prop, bal);
mixer_setbalance(&mpctx->mixer, bal);
return M_PROPERTY_OK;
case M_PROPERTY_SET:
if (!arg)
return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(float*)arg);
- mixer_setbalance(&mpctx->mixer, *(float*)arg);
+ M_PROPERTY_CLAMP(prop, *(float *)arg);
+ mixer_setbalance(&mpctx->mixer, *(float *)arg);
return M_PROPERTY_OK;
}
return M_PROPERTY_NOT_IMPLEMENTED;
@@ -964,7 +966,7 @@ static int mp_property_audio(m_option_t *prop, int action, void *arg,
} else {
char lang[40];
strncpy(lang, mp_gtext("unknown"), sizeof(lang));
- if (0);
+ if (0) ;
#ifdef CONFIG_DVDREAD
else if (mpctx->stream->type == STREAMTYPE_DVD) {
int code = dvd_lang_from_aid(mpctx->stream, current_id);
@@ -1073,13 +1075,13 @@ static int mp_property_program(m_option_t *prop, int action, void *arg,
prog.progid = *((int *) arg);
else
prog.progid = -1;
- if (demux_control
- (mpctx->demuxer, DEMUXER_CTRL_IDENTIFY_PROGRAM,
- &prog) == DEMUXER_CTRL_NOTIMPL)
+ if (demux_control(mpctx->demuxer, DEMUXER_CTRL_IDENTIFY_PROGRAM,
+ &prog) == DEMUXER_CTRL_NOTIMPL)
return M_PROPERTY_ERROR;
if (prog.aid < 0 && prog.vid < 0) {
- mp_msg(MSGT_CPLAYER, MSGL_ERR, "Selected program contains no audio or video streams!\n");
+ mp_msg(MSGT_CPLAYER, MSGL_ERR,
+ "Selected program contains no audio or video streams!\n");
return M_PROPERTY_ERROR;
}
mp_property_do("switch_audio", M_PROPERTY_SET, &prog.aid, mpctx);
@@ -1091,11 +1093,6 @@ static int mp_property_program(m_option_t *prop, int action, void *arg,
}
}
-///@}
-
-/// \defgroup VideoProperties Video properties
-/// \ingroup Properties
-///@{
/// Fullscreen state (RW)
static int mp_property_fullscreen(m_option_t *prop, int action, void *arg,
@@ -1156,7 +1153,7 @@ static int mp_property_deinterlace(m_option_t *prop, int action,
}
static int mp_property_yuv_colorspace(m_option_t *prop, int action,
- void *arg, MPContext *mpctx)
+ void *arg, MPContext *mpctx)
{
if (!mpctx->sh_video || !mpctx->sh_video->vfilter)
return M_PROPERTY_UNAVAILABLE;
@@ -1175,11 +1172,13 @@ static int mp_property_yuv_colorspace(m_option_t *prop, int action,
return M_PROPERTY_ERROR;
if (vf->control(vf, VFCTRL_GET_YUV_COLORSPACE, &colorspace) != true)
return M_PROPERTY_UNAVAILABLE;
- char * const names[] = {"BT.601 (SD)", "BT.709 (HD)", "SMPTE-240M"};
+ char *const names[] = {
+ "BT.601 (SD)", "BT.709 (HD)", "SMPTE-240M"
+ };
if (colorspace < 0 || colorspace >= sizeof(names) / sizeof(names[0]))
*(char **)arg = talloc_strdup(NULL, mp_gtext("unknown"));
else
- *(char**)arg = talloc_strdup(NULL, names[colorspace]);
+ *(char **)arg = talloc_strdup(NULL, names[colorspace]);
return M_PROPERTY_OK;
case M_PROPERTY_SET:
if (!arg)
@@ -1251,7 +1250,7 @@ static int mp_property_panscan(m_option_t *prop, int action, void *arg,
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
vo_panscan += (arg ? *(float *) arg : 0.1) *
- (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
+ (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
if (vo_panscan > 1)
vo_panscan = 1;
else if (vo_panscan < 0)
@@ -1326,10 +1325,10 @@ static int mp_property_framedropping(m_option_t *prop, int action,
case M_PROPERTY_PRINT:
if (!arg)
return M_PROPERTY_ERROR;
- *(char **) arg = talloc_strdup(NULL,
- frame_dropping == 1 ? mp_gtext("enabled") :
- (frame_dropping == 2 ? mp_gtext("hard") :
- mp_gtext("disabled")));
+ *(char **) arg = talloc_strdup(NULL, frame_dropping == 1 ?
+ mp_gtext("enabled") :
+ (frame_dropping == 2 ? mp_gtext("hard") :
+ mp_gtext("disabled")));
return M_PROPERTY_OK;
default:
return m_property_choice(prop, action, arg, &frame_dropping);
@@ -1372,7 +1371,7 @@ static int mp_property_gamma(m_option_t *prop, int action, void *arg,
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
*gamma += (arg ? *(int *) arg : 1) *
- (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
+ (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
M_PROPERTY_CLAMP(prop, *gamma);
r = set_video_colors(mpctx->sh_video, prop->name, *gamma);
if (r <= 0)
@@ -1405,31 +1404,34 @@ static int mp_property_vsync(m_option_t *prop, int action, void *arg,
static int mp_property_video_format(m_option_t *prop, int action,
void *arg, MPContext *mpctx)
{
- char* meta;
+ char *meta;
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
- switch(action) {
+ switch (action) {
case M_PROPERTY_PRINT:
if (!arg)
return M_PROPERTY_ERROR;
- switch(mpctx->sh_video->format) {
+ switch (mpctx->sh_video->format) {
case 0x10000001:
- meta = talloc_strdup(NULL, "mpeg1"); break;
+ meta = talloc_strdup(NULL, "mpeg1");
+ break;
case 0x10000002:
- meta = talloc_strdup(NULL, "mpeg2"); break;
+ meta = talloc_strdup(NULL, "mpeg2");
+ break;
case 0x10000004:
- meta = talloc_strdup(NULL, "mpeg4"); break;
+ meta = talloc_strdup(NULL, "mpeg4");
+ break;
case 0x10000005:
- meta = talloc_strdup(NULL, "h264"); break;
+ meta = talloc_strdup(NULL, "h264");
+ break;
default:
- if(mpctx->sh_video->format >= 0x20202020) {
+ if (mpctx->sh_video->format >= 0x20202020) {
meta = talloc_asprintf(NULL, "%.4s",
(char *) &mpctx->sh_video->format);
- } else {
+ } else
meta = talloc_asprintf(NULL, "0x%08X", mpctx->sh_video->format);
- }
}
- *(char**)arg = meta;
+ *(char **)arg = meta;
return M_PROPERTY_OK;
}
return m_property_int_ro(prop, action, arg, mpctx->sh_video->format);
@@ -1441,7 +1443,8 @@ static int mp_property_video_codec(m_option_t *prop, int action,
{
if (!mpctx->sh_video || !mpctx->sh_video->codec)
return M_PROPERTY_UNAVAILABLE;
- return m_property_string_ro(prop, action, arg, mpctx->sh_video->codec->name);
+ return m_property_string_ro(prop, action, arg,
+ mpctx->sh_video->codec->name);
}
@@ -1490,11 +1493,6 @@ static int mp_property_aspect(m_option_t *prop, int action, void *arg,
return m_property_float_ro(prop, action, arg, mpctx->sh_video->aspect);
}
-///@}
-
-/// \defgroup SubProprties Subtitles properties
-/// \ingroup Properties
-///@{
/// Text subtitle position (RW)
static int mp_property_sub_pos(m_option_t *prop, int action, void *arg,
@@ -1549,16 +1547,17 @@ static int mp_property_sub(m_option_t *prop, int action, void *arg,
const char *tmp = mp_basename(sub_name);
*(char **) arg = talloc_asprintf(NULL, "(%d) %s%s",
- mpctx->set_of_sub_pos + 1,
- strlen(tmp) < 20 ? "" : "...",
- strlen(tmp) < 20 ? tmp : tmp + strlen(tmp) - 19);
+ mpctx->set_of_sub_pos + 1,
+ strlen(tmp) < 20 ? "" : "...",
+ strlen(tmp) < 20 ? tmp : tmp + strlen(tmp) - 19);
return M_PROPERTY_OK;
}
#ifdef CONFIG_DVDNAV
if (mpctx->stream->type == STREAMTYPE_DVDNAV) {
if (vo_spudec && opts->sub_id >= 0) {
unsigned char lang[3];
- if (mp_dvdnav_lang_from_sid(mpctx->stream, opts->sub_id, lang)) {
+ if (mp_dvdnav_lang_from_sid(mpctx->stream, opts->sub_id,
+ lang)) {
*(char **) arg = talloc_asprintf(NULL, "(%d) %s",
opts->sub_id, lang);
return M_PROPERTY_OK;
@@ -1571,7 +1570,7 @@ static int mp_property_sub(m_option_t *prop, int action, void *arg,
|| d_sub->demuxer->type == DEMUXER_TYPE_LAVF
|| d_sub->demuxer->type == DEMUXER_TYPE_LAVF_PREFERRED
|| d_sub->demuxer->type == DEMUXER_TYPE_OGG)
- && d_sub->sh && opts->sub_id >= 0) {
+ && d_sub->sh && opts->sub_id >= 0) {
struct sh_sub *sh = d_sub->sh;
char *lang = sh->lang ? sh->lang : mp_gtext("unknown");
if (sh->title)
@@ -1579,7 +1578,7 @@ static int mp_property_sub(m_option_t *prop, int action, void *arg,
opts->sub_id, lang, sh->title);
else
*(char **)arg = talloc_asprintf(NULL, "(%d) %s",
- opts->sub_id, lang);
+ opts->sub_id, lang);
return M_PROPERTY_OK;
}
@@ -1587,7 +1586,7 @@ static int mp_property_sub(m_option_t *prop, int action, void *arg,
const char *language = mp_gtext("unknown");
language = vobsub_get_id(vo_vobsub, (unsigned int) vobsub_id);
*(char **) arg = talloc_asprintf(NULL, "(%d) %s",
- vobsub_id, language ? language : mp_gtext("unknown"));
+ vobsub_id, language ? language : mp_gtext("unknown"));
return M_PROPERTY_OK;
}
#ifdef CONFIG_DVDREAD
@@ -1605,7 +1604,7 @@ static int mp_property_sub(m_option_t *prop, int action, void *arg,
#endif
if (opts->sub_id >= 0) {
*(char **) arg = talloc_asprintf(NULL, "(%d) %s", opts->sub_id,
- mp_gtext("unknown"));
+ mp_gtext("unknown"));
return M_PROPERTY_OK;
}
*(char **) arg = talloc_strdup(NULL, mp_gtext("disabled"));
@@ -1660,9 +1659,9 @@ static int mp_property_sub(m_option_t *prop, int action, void *arg,
mpctx->osd->ass_track = NULL;
uninit_player(mpctx, INITIALIZED_SUB);
- if (source == SUB_SOURCE_VOBSUB) {
+ if (source == SUB_SOURCE_VOBSUB)
vobsub_id = vobsub_get_id_by_index(vo_vobsub, source_pos);
- } else if (source == SUB_SOURCE_SUBS) {
+ else if (source == SUB_SOURCE_SUBS) {
mpctx->set_of_sub_pos = source_pos;
#ifdef CONFIG_ASS
if (opts->ass_enabled
@@ -1703,8 +1702,8 @@ static int mp_property_sub(m_option_t *prop, int action, void *arg,
mpctx->initialized_flags |= INITIALIZED_SUB;
}
} else {
- d_sub->id = -2;
- d_sub->sh = NULL;
+ d_sub->id = -2;
+ d_sub->sh = NULL;
}
}
}
@@ -1760,7 +1759,7 @@ static int mp_property_sub_source(m_option_t *prop, int action, void *arg,
case M_PROPERTY_SET:
if (!arg)
return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(int*)arg);
+ M_PROPERTY_CLAMP(prop, *(int *)arg);
if (*(int *) arg < 0)
mpctx->global_sub_pos = -1;
else if (*(int *) arg != sub_source(mpctx)) {
@@ -1772,7 +1771,7 @@ static int mp_property_sub_source(m_option_t *prop, int action, void *arg,
break;
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN: {
- int step_all = (arg && *(int*)arg != 0 ? *(int*)arg : 1)
+ int step_all = (arg && *(int *)arg != 0 ? *(int *)arg : 1)
* (action == M_PROPERTY_STEP_UP ? 1 : -1);
int step = (step_all > 0) ? 1 : -1;
int cur_source = sub_source(mpctx);
@@ -1784,7 +1783,7 @@ static int mp_property_sub_source(m_option_t *prop, int action, void *arg,
else if (source < -1)
source = SUB_SOURCES - 1;
if (source == cur_source || source == -1 ||
- mpctx->sub_counts[source])
+ mpctx->sub_counts[source])
step_all -= step;
}
if (source == cur_source)
@@ -1834,8 +1833,7 @@ static int mp_property_sub_by_type(m_option_t *prop, int action, void *arg,
*(int *) arg = sub_source_pos(mpctx);
if (source == SUB_SOURCE_VOBSUB)
*(int *) arg = vobsub_get_id_by_index(vo_vobsub, *(int *) arg);
- }
- else
+ } else
*(int *) arg = -1;
return M_PROPERTY_OK;
case M_PROPERTY_PRINT:
@@ -1857,13 +1855,12 @@ static int mp_property_sub_by_type(m_option_t *prop, int action, void *arg,
new_pos = -1;
*(int *) arg = -1;
}
- }
- else
+ } else
new_pos = -1;
break;
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN: {
- int step_all = (arg && *(int*)arg != 0 ? *(int*)arg : 1)
+ int step_all = (arg && *(int *)arg != 0 ? *(int *)arg : 1)
* (action == M_PROPERTY_STEP_UP ? 1 : -1);
int step = (step_all > 0) ? 1 : -1;
int max_sub_pos_for_source = -1;
@@ -1876,18 +1873,15 @@ static int mp_property_sub_by_type(m_option_t *prop, int action, void *arg,
else if (max_sub_pos_for_source == -1) {
// Find max pos for specific source
new_pos = mpctx->global_sub_size - 1;
- while (new_pos >= 0
- && sub_source(mpctx) != source)
+ while (new_pos >= 0 && sub_source(mpctx) != source)
new_pos--;
- }
- else
+ } else
new_pos = max_sub_pos_for_source;
- }
- else {
+ } else {
new_pos += step;
if (new_pos < offset ||
- new_pos >= mpctx->global_sub_size ||
- sub_source(mpctx) != source)
+ new_pos >= mpctx->global_sub_size ||
+ sub_source(mpctx) != source)
new_pos = -1;
}
step_all -= step;
@@ -1913,7 +1907,9 @@ static int mp_property_sub_delay(m_option_t *prop, int action, void *arg,
static int mp_property_sub_alignment(m_option_t *prop, int action,
void *arg, MPContext *mpctx)
{
- char *name[] = { _("top"), _("center"), _("bottom") };
+ char *name[] = {
+ _("top"), _("center"), _("bottom")
+ };
if (!mpctx->sh_video || mpctx->global_sub_pos < 0
|| sub_source(mpctx) != SUB_SOURCE_SUBS)
@@ -1961,7 +1957,7 @@ static int mp_property_sub_visibility(m_option_t *prop, int action,
#ifdef CONFIG_ASS
/// Use margins for libass subtitles (RW)
static int mp_property_ass_use_margins(m_option_t *prop, int action,
- void *arg, MPContext *mpctx)
+ void *arg, MPContext *mpctx)
{
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
@@ -2004,55 +2000,50 @@ static int mp_property_sub_forced_only(m_option_t *prop, int action,
#ifdef CONFIG_FREETYPE
/// Subtitle scale (RW)
static int mp_property_sub_scale(m_option_t *prop, int action, void *arg,
- MPContext *mpctx)
+ MPContext *mpctx)
{
struct MPOpts *opts = &mpctx->opts;
switch (action) {
- case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(float *) arg);
+ case M_PROPERTY_SET:
+ if (!arg)
+ return M_PROPERTY_ERROR;
+ M_PROPERTY_CLAMP(prop, *(float *) arg);
#ifdef CONFIG_ASS
- if (opts->ass_enabled) {
- ass_font_scale = *(float *) arg;
- ass_force_reload = 1;
- }
+ if (opts->ass_enabled) {
+ ass_font_scale = *(float *) arg;
+ ass_force_reload = 1;
+ }
#endif
- text_font_scale_factor = *(float *) arg;
- force_load_font = 1;
- return M_PROPERTY_OK;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
+ text_font_scale_factor = *(float *) arg;
+ force_load_font = 1;
+ return M_PROPERTY_OK;
+ case M_PROPERTY_STEP_UP:
+ case M_PROPERTY_STEP_DOWN:
#ifdef CONFIG_ASS
- if (opts->ass_enabled) {
- ass_font_scale += (arg ? *(float *) arg : 0.1)*
- (action == M_PROPERTY_STEP_UP ? 1.0 : -1.0);
- M_PROPERTY_CLAMP(prop, ass_font_scale);
- ass_force_reload = 1;
- }
+ if (opts->ass_enabled) {
+ ass_font_scale += (arg ? *(float *) arg : 0.1) *
+ (action == M_PROPERTY_STEP_UP ? 1.0 : -1.0);
+ M_PROPERTY_CLAMP(prop, ass_font_scale);
+ ass_force_reload = 1;
+ }
#endif
- text_font_scale_factor += (arg ? *(float *) arg : 0.1)*
- (action == M_PROPERTY_STEP_UP ? 1.0 : -1.0);
- M_PROPERTY_CLAMP(prop, text_font_scale_factor);
- force_load_font = 1;
- return M_PROPERTY_OK;
- default:
+ text_font_scale_factor += (arg ? *(float *) arg : 0.1) *
+ (action == M_PROPERTY_STEP_UP ? 1.0 : -1.0);
+ M_PROPERTY_CLAMP(prop, text_font_scale_factor);
+ force_load_font = 1;
+ return M_PROPERTY_OK;
+ default:
#ifdef CONFIG_ASS
- if (opts->ass_enabled)
- return m_property_float_ro(prop, action, arg, ass_font_scale);
- else
+ if (opts->ass_enabled)
+ return m_property_float_ro(prop, action, arg, ass_font_scale);
+ else
#endif
- return m_property_float_ro(prop, action, arg, text_font_scale_factor);
+ return m_property_float_ro(prop, action, arg, text_font_scale_factor);
}
}
#endif
-///@}
-
-/// \defgroup TVProperties TV properties
-/// \ingroup Properties
-///@{
#ifdef CONFIG_TV
@@ -2079,7 +2070,7 @@ static int mp_property_tv_color(m_option_t *prop, int action, void *arg,
if (!r)
return M_PROPERTY_ERROR;
val += (arg ? *(int *) arg : 1) *
- (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
+ (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
M_PROPERTY_CLAMP(prop, val);
return tv_set_color_options(tvh, prop->offset, val);
}
@@ -2091,37 +2082,40 @@ static int mp_property_tv_color(m_option_t *prop, int action, void *arg,
#endif
static int mp_property_teletext_common(m_option_t *prop, int action, void *arg,
- MPContext *mpctx)
+ MPContext *mpctx)
{
- int val,result;
+ int val, result;
int base_ioctl = prop->offset;
/*
- for teletext's GET,SET,STEP ioctls this is not 0
- SET is GET+1
- STEP is GET+2
- */
+ for teletext's GET,SET,STEP ioctls this is not 0
+ SET is GET+1
+ STEP is GET+2
+ */
if (!mpctx->demuxer || !mpctx->demuxer->teletext)
return M_PROPERTY_UNAVAILABLE;
- if(!base_ioctl)
+ if (!base_ioctl)
return M_PROPERTY_ERROR;
switch (action) {
case M_PROPERTY_GET:
if (!arg)
return M_PROPERTY_ERROR;
- result=teletext_control(mpctx->demuxer->teletext, base_ioctl, arg);
+ result = teletext_control(mpctx->demuxer->teletext, base_ioctl, arg);
break;
case M_PROPERTY_SET:
if (!arg)
return M_PROPERTY_ERROR;
M_PROPERTY_CLAMP(prop, *(int *) arg);
- result=teletext_control(mpctx->demuxer->teletext, base_ioctl+1, arg);
+ result = teletext_control(mpctx->demuxer->teletext, base_ioctl + 1,
+ arg);
break;
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
- result=teletext_control(mpctx->demuxer->teletext, base_ioctl, &val);
- val += (arg ? *(int *) arg : 1) * (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
- result=teletext_control(mpctx->demuxer->teletext, base_ioctl+1, &val);
+ result = teletext_control(mpctx->demuxer->teletext, base_ioctl, &val);
+ val += (arg ? *(int *) arg : 1) * (action == M_PROPERTY_STEP_DOWN ?
+ -1 : 1);
+ result = teletext_control(mpctx->demuxer->teletext, base_ioctl + 1,
+ &val);
break;
default:
return M_PROPERTY_NOT_IMPLEMENTED;
@@ -2131,18 +2125,18 @@ static int mp_property_teletext_common(m_option_t *prop, int action, void *arg,
}
static int mp_property_teletext_mode(m_option_t *prop, int action, void *arg,
- MPContext *mpctx)
+ MPContext *mpctx)
{
int re