diff options
author | wm4 <wm4@nowhere> | 2014-03-08 23:38:53 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-03-09 00:19:35 +0100 |
commit | 5ffd6a9e9b7a0d894d7513ad20c24c2727426ecd (patch) | |
tree | f87a9c927774d8829ab2a920dcd857d2ee54a4e2 /common/encode_lavc.h | |
parent | b48d09a89dd14616e5ae4e9d017b921486d5f541 (diff) | |
download | mpv-5ffd6a9e9b7a0d894d7513ad20c24c2727426ecd.tar.bz2 mpv-5ffd6a9e9b7a0d894d7513ad20c24c2727426ecd.tar.xz |
encode: add locking
Since the AO will run in a thread, and there's lots of shared state with
encoding, we have to add locking.
One case this doesn't handle correctly are the encode_lavc_available()
calls in ao_lavc.c and vo_lavc.c. They don't do much (and usually only
to protect against doing --ao=lavc with normal playback), and changing
it would be a bit messy. So just leave them.
Diffstat (limited to 'common/encode_lavc.h')
-rw-r--r-- | common/encode_lavc.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/encode_lavc.h b/common/encode_lavc.h index deaf42b684..af7f4fba3d 100644 --- a/common/encode_lavc.h +++ b/common/encode_lavc.h @@ -22,6 +22,8 @@ #ifndef MPLAYER_ENCODE_LAVC_H #define MPLAYER_ENCODE_LAVC_H +#include <pthread.h> + #include <libavcodec/avcodec.h> #include <libavformat/avformat.h> #include <libavutil/avstring.h> @@ -37,6 +39,11 @@ struct encode_lavc_context { struct encode_output_conf *options; struct mp_log *log; + // All entry points must be guarded with the lock. Functions called by + // the playback core lock this automatically, but ao_lavc.c and vo_lavc.c + // must lock manually before accessing state. + pthread_mutex_t lock; + float vo_fps; // these are processed from the options |