Commit Graph

26494 Commits

Author SHA1 Message Date
Uoti Urpala f518cf7ea9 Add option pointer to stream struct (at least temporarily)
The stream code does not access many option variables directly, but it
does access some such as audio_id and network_bandwidth (and does that
without including proper headers for them). Add option pointer to the
stream struct to allow access to those variables. Remove the unused
(always NULL) and clumsy-looking char** options parameter in the
open_stream call and replace it with the option pointer. The parameter
is currently only set in the main open_stream() call in MPlayer.c and
not in any other locations that can open a stream.

In the long term it might be better to pass a more limited set of
values somehow, but this should do for now.
2008-04-23 13:48:38 +03:00
Uoti Urpala 9e7dfe3fa3 Mark some functions static
These functions aren't used outside their file and have no prototype
in any header. Based on a forgotten patch from 2006 by Stefan Huehner,
(stefan huehner org).
2008-04-23 13:48:38 +03:00
Uoti Urpala d9aa368a6d Move playback_speed to options struct 2008-04-23 13:48:37 +03:00
Uoti Urpala c2a36d9264 Move option helper #defines to cfg-common.h for now 2008-04-23 13:48:37 +03:00
Uoti Urpala ca63fdcf03 cfg-common-opts.h: Remove multiple inclusion guards and #include
This file cannot be used as a normal header so the multiple inclusion
guards are pointless, and the only reason the '#include "config.h"'
did not break compilation was that it compiled to whitespace only due
to its own multiple inclusion guard.
2008-04-23 13:48:37 +03:00
Uoti Urpala 3ee6503a07 Move global rel_seek_secs and abs_seek_pos to mpctx 2008-04-23 13:48:37 +03:00
Uoti Urpala c1f9fe7d67 Remove static mpctx from mplayer.c
Pass it in function calls instead. There's no reasonable way to pass
it to exit_player() when used outside mplayer.c. However most of those
uses seem to be wrong (the code should not make the program exit) and
should be removed. For now just make exit_player() uses outside
mplayer.c simply call exit() without any shutdown code.
2008-04-23 13:48:33 +03:00
Uoti Urpala ef74d21b1f Move loop_times to option struct 2008-04-23 13:47:44 +03:00
Uoti Urpala 67778746ce Remove pointless #ifdefs
These #ifdefs only made MPContext 2 variables smaller when dvbin
support was disabled.
2008-04-23 13:47:43 +03:00
Uoti Urpala db8924ea3c Move mRootWin,mScreen,mLocalDisplay to x11 struct 2008-04-23 13:47:43 +03:00
Uoti Urpala 0ef3e9ae87 Move vo_mouse_autohide,vo_wm_type,vo_fs_type,vo_fs_flip to x11 struct 2008-04-23 13:47:43 +03:00
Uoti Urpala cc8334710e x11_common: Move vo_old_[x|y|width|height| to x11 struct 2008-04-23 13:47:43 +03:00
Uoti Urpala 52b3c6097b x11_common.c: Move orig_layer and old_gravity to x11 struct 2008-04-23 13:47:43 +03:00
Uoti Urpala 49ac1f06ca Move static mouse hide timers to x11 struct 2008-04-23 13:47:43 +03:00
Uoti Urpala 49461e04d0 Move vo_gc,f_gc,vo_hints to x11 struct 2008-04-23 13:47:43 +03:00
Uoti Urpala 5f39342e01 x11_common.c: Move function-static variables to struct 2008-04-23 13:47:42 +03:00
Uoti Urpala dd784ca408 Mark a table const 2008-04-23 13:47:42 +03:00
Uoti Urpala e66e17adc1 Move xv_port,xv_colorkey,xv_ck_info to x11 struct 2008-04-23 13:47:35 +03:00
Uoti Urpala 40f02f64fd Move vo_window to x11 struct 2008-04-23 13:46:40 +03:00
Uoti Urpala 7159af499c Move static X11 atoms to struct 2008-04-23 13:46:40 +03:00
Uoti Urpala 78172918ff Move vo_screenwidth,vo_screenheight to options struct 2008-04-23 13:46:40 +03:00
Uoti Urpala 432e8ff4a5 Move vo_depthonscreen to x11 struct 2008-04-23 13:46:40 +03:00
Uoti Urpala a2212a71a7 Remove vo_depthonscreen references from non-X VOs
X-specific code uses this global as its internal variable (assuming
that X is initialized if it is set). While using non-X VOs the
variable is not accessed outside the VO. So make those VOs use their
own variables instead of the global vo_depthonscreen.
2008-04-23 13:46:40 +03:00
Uoti Urpala ce76dfdd4a Move vo_dbpp to options struct 2008-04-23 13:46:40 +03:00
Uoti Urpala eaab1ce896 Move vo_dx,vo_dy,vo_dwidth,vo_dheight to vo struct 2008-04-23 13:46:40 +03:00
Uoti Urpala 7521aac665 Move global vo_config_count to vo struct
Remove the global and Add a corresponding field to the vo struct, plus
another which tells whether the LAST config call was successful.The
latter value which tells whether the VO should be properly configured
at the moment seems a better match for the semantics actually needed
in most places where the old value was used. The 'count' field with
the old semantics is not currently used by anything, but I'm leaving
it there for vo drivers which would need those semantics if converted
to use the struct.

Existing uses of the global outside old vo drivers are either converted
to use the struct field or moved inside the vo_xyz() calls (instead of
"if (vo_config_count) vo_flip_page(..." just call vo_flip_page which
will now do nothing if not configured). The removal of the check in
mpcommon.c/update_subtitles() is less trivial than the others, but I
think it shouldn't cause problems.
2008-04-23 13:46:39 +03:00
Uoti Urpala 26039a38e3 Move global mDisplay to x11 state struct 2008-04-23 13:46:34 +03:00
Uoti Urpala acf319b3ed Create a struct for X11 state
Will be used for common data between X11 VOs. The main reasons for
making it a separate struct rather than extra fields in the main VO
struct are that some field definitions need X headers and that the code
keeps basic X state such as the display connection over opening and
closing of individual VOs.
2008-04-23 13:41:07 +03:00
Uoti Urpala d283d5236a x11_common.c: Make some functions static 2008-04-23 13:41:06 +03:00
Uoti Urpala 1ebfddd812 Allocate vo struct with talloc
Also allocate the private vo_xv struct as a child and remove explicit
free() for it.
2008-04-23 13:41:06 +03:00
Uoti Urpala 95a909b4fd Makefile: Compile and link talloc.c 2008-04-23 13:41:06 +03:00
Uoti Urpala 7c0e5e8f99 Make talloc abort() instead of returning NULL
Replace (hopefully) all cases where normally successful allocations
could return NULL with abort(). This should allow skipping most checks
on allocation return values.
2008-04-23 13:41:06 +03:00
Uoti Urpala c0c9b26ff9 Hardcode feature checks in talloc.c
Original talloc build system used autoconf to check for features, most
of which were standard C headers. Assume those always exist. Always
use a workaround for the one non-standard feature (strnlen).
2008-04-23 13:41:06 +03:00
Uoti Urpala 27a30e310e Add the talloc memory allocator
Copy talloc.c and talloc.h from Samba (last changed 2008-04-17 in
commit 7b9a647ebbbe9ec9e1b82b42e3a8916396f91273).
2008-04-23 13:41:06 +03:00
Uoti Urpala bfe569b76e Move vo_ontop to options struct
Add a 'struct vo *vo' argument to the x11_common.c functions that
access the variable so it's available as vo->opts->vo_ontop. To keep
VOs using the old API working create a global vo variable that is set
to the currently used old vo. "vo_ontop" will be #defined to
"global_vo->opts->vo_ontop", and x11_common.h will add defines like
the following when it is included by old VOs:
 #define vo_x11_ontop() vo_x11_ontop(global_vo)
so that they will call the function according to the new declaration.
2008-04-23 13:41:06 +03:00
Uoti Urpala 6c9d09170d vo_gl[2]: Rename conflicting vo_ontop macro
Rename the vo_ontop() macro to vo_gl_ontop(). It caused problems with
other changes because it conflicts with a global variable name (gl2
actually called vo_ontop() as a function and used vo_ontop as an int -
this only worked because vo_ontop was defined as a function-like macro
and use without parentheses didn't trigger replacement).
2008-04-23 13:41:06 +03:00
Uoti Urpala 8ec90e5e4f Add option pointer to vo struct 2008-04-23 13:41:06 +03:00
Uoti Urpala 5045066574 vf.c: malloc+memset -> calloc 2008-04-23 13:41:06 +03:00
Uoti Urpala 9b06b5ed85 Move correct_pts to options struct 2008-04-23 13:41:05 +03:00
Uoti Urpala 0d59f81e54 Add option pointer to vf struct 2008-04-23 13:41:05 +03:00
Uoti Urpala 7039bc090a Add option pointer to demuxers and stheader.h structs 2008-04-23 13:41:05 +03:00
Uoti Urpala d3d12332d6 Declare demuxer *_streams fields with proper types
Give sh_audio_t, sh_video_t and sh_sub_t which before had typedef
names only a matching struct name (without _t) too.
Change the a_streams, v_streams and s_streams demuxer fields from
void * to struct sh_audio *, struct sh_video * and struct sh_sub *.
Remove a now unnecessary cast from mplayer.c.
2008-04-23 13:41:05 +03:00
Uoti Urpala 732ee3474a Move options "vo" and "ao" to common struct 2008-04-23 13:41:05 +03:00
Uoti Urpala 9db0c118d3 Start of new option system
First part of option restructuring. The aim is to move option values
from a huge number of separate globals to a single non-global struct.

This part adds some support for parsing option values into such struct
instances, and moves one example option (fixed-vo) to the struct.
2008-04-23 13:41:05 +03:00
Uoti Urpala f894294bae vo_xv: Free resources in error cases
If preinit() failed after allocating some resources it didn't free
them. Also if preinit() completed but all (if any) calls to config()
failed then uninit() it not free resources. Add checks to uninit() to
make it safe with only a subset of resources allocated, then make it
execute independently of vo_config_count and also make preinit() call
it in error cases.
2008-04-23 13:41:05 +03:00
Uoti Urpala b91826280c vo_xv.c: Make reconfig logic more robust
The previous version was not buggy, but this is easier to see correct.
Now it doesn't depend on options determining num_buffers staying
constant and on vo_config_count.
2008-04-23 13:41:05 +03:00
Uoti Urpala 461264756e vo_xv.c: remove unnecessary #ifdefs and static vars
Combine code unnecessarily split in 3 #ifdef blocks into one block and
change local variables there were pointlessly declared static to
normal ones.

After this vo_xv.c no longer defines any global or static variables.
2008-04-23 13:41:04 +03:00
Uoti Urpala 1756771e51 vo_xv.c: Cosmetic changes
Remove an unnecessary inner scope in a function and separate 'i' loop
counter variable declared in it, reindent.
2008-04-23 13:41:04 +03:00
Uoti Urpala ef874e0f4c Change vo_xv to use new VO API 2008-04-23 13:41:04 +03:00
Uoti Urpala e5e8effca8 Add a context argument to mp_input_add_event_fd callback 2008-04-23 13:41:04 +03:00