2012-08-25 14:47:50 +00:00
|
|
|
#ifndef MPLAYER_DEC_SUB_H
|
|
|
|
#define MPLAYER_DEC_SUB_H
|
|
|
|
|
2012-09-28 19:19:36 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
2015-07-06 19:55:37 +00:00
|
|
|
#include <pthread.h>
|
2012-09-28 19:19:36 +00:00
|
|
|
|
2013-11-24 11:58:06 +00:00
|
|
|
#include "osd.h"
|
2012-10-04 15:16:40 +00:00
|
|
|
|
2013-11-23 20:37:15 +00:00
|
|
|
struct sh_stream;
|
2012-08-25 18:22:39 +00:00
|
|
|
struct ass_track;
|
2013-12-21 18:06:37 +00:00
|
|
|
struct mpv_global;
|
2013-06-01 17:44:12 +00:00
|
|
|
struct demux_packet;
|
|
|
|
struct ass_library;
|
|
|
|
struct ass_renderer;
|
2012-10-04 15:16:32 +00:00
|
|
|
|
2013-06-01 17:44:12 +00:00
|
|
|
struct dec_sub;
|
|
|
|
struct sd;
|
|
|
|
|
2013-06-28 23:34:11 +00:00
|
|
|
enum sd_ctrl {
|
|
|
|
SD_CTRL_SUB_STEP,
|
2013-07-14 23:48:25 +00:00
|
|
|
SD_CTRL_SET_VIDEO_PARAMS,
|
Add prelimimary (basic, possibly broken) dvdnav support
This readds a more or less completely new dvdnav implementation, though
it's based on the code from before commit 41fbcee. Note that this is
rather basic, and might be broken or not quite usable in many cases.
Most importantly, navigation highlights are not correctly implemented.
This would require changes in the FFmpeg dvdsub decoder (to apply a
different internal CLUT), so supporting it is not really possible right
now. And in fact, I don't think I ever want to support it, because it's
a very small gain for a lot of work. Instead, mpv will display fake
highlights, which are an approximate bounding box around the real
highlights.
Some things like mouse input or switching audio/subtitles stream using
the dvdnav VM are not supported.
Might be quite fragile on transitions: if dvdnav initiates a transition,
and doesn't give us enough mpeg data to initialize video playback, the
player will just quit.
This is added only because some users seem to want it. I don't intend to
make mpv a good DVD player, so the very basic minimum will have to do.
How about you just convert your DVD to proper video files?
2013-12-12 00:44:28 +00:00
|
|
|
SD_CTRL_GET_RESOLUTION,
|
2013-06-28 23:34:11 +00:00
|
|
|
};
|
|
|
|
|
2013-12-21 18:06:37 +00:00
|
|
|
struct dec_sub *sub_create(struct mpv_global *global);
|
2013-06-01 17:44:12 +00:00
|
|
|
void sub_destroy(struct dec_sub *sub);
|
sub: uglify sub decoder with locking
The plan is to make the whole OSD thread-safe, and we start with this.
We just put locks on all entry points (fortunately, dec_sub.c and all
sd_*.c decoders are very closed off, and only the entry points in
dec_sub.h let you access it). I think this is pretty ugly, but at least
it's very simple.
There's a special case with sub_get_bitmaps(): this function returns
pointers to decoder data (specifically, libass images). There's no way
to synchronize this internally, so expose sub_lock/sub_unlock functions.
To make things simpler, and especially because the lock is sort-of
exposed to the outside world, make the locks recursive. Although the
only case where this is actually needed (although trivial) is
sub_set_extradata().
One corner case are ASS subtitles: for some reason, we keep a single
ASS_Renderer instance for subtitles around (probably to avoid rescanning
fonts with ordered chapters), and this ASS_Renderer instance is not
synchronized. Also, demux_libass.c loads ASS_Track objects, which are
directly passed to sd_ass.c. These things are not synchronized (and
would be hard to synchronize), and basically we're out of luck. But I
think for now, accesses happen reasonably serialized, so there is no
actual problem yet, even if we start to access OSD from other threads.
2014-01-17 22:13:09 +00:00
|
|
|
void sub_lock(struct dec_sub *sub);
|
|
|
|
void sub_unlock(struct dec_sub *sub);
|
2013-06-01 17:44:12 +00:00
|
|
|
|
|
|
|
void sub_set_video_res(struct dec_sub *sub, int w, int h);
|
2013-06-11 19:39:54 +00:00
|
|
|
void sub_set_video_fps(struct dec_sub *sub, double fps);
|
2013-06-01 17:44:12 +00:00
|
|
|
void sub_set_extradata(struct dec_sub *sub, void *data, int data_len);
|
|
|
|
void sub_set_ass_renderer(struct dec_sub *sub, struct ass_library *ass_library,
|
2015-07-06 19:55:37 +00:00
|
|
|
struct ass_renderer *ass_renderer,
|
|
|
|
pthread_mutex_t *ass_lock);
|
2013-11-23 20:37:15 +00:00
|
|
|
void sub_init_from_sh(struct dec_sub *sub, struct sh_stream *sh);
|
2013-06-01 17:44:12 +00:00
|
|
|
|
|
|
|
bool sub_is_initialized(struct dec_sub *sub);
|
|
|
|
|
2013-11-23 20:37:15 +00:00
|
|
|
bool sub_read_all_packets(struct dec_sub *sub, struct sh_stream *sh);
|
2013-06-01 17:44:12 +00:00
|
|
|
bool sub_accept_packets_in_advance(struct dec_sub *sub);
|
|
|
|
void sub_decode(struct dec_sub *sub, struct demux_packet *packet);
|
|
|
|
void sub_get_bitmaps(struct dec_sub *sub, struct mp_osd_res dim, double pts,
|
2012-10-04 15:16:36 +00:00
|
|
|
struct sub_bitmaps *res);
|
2013-06-01 17:44:12 +00:00
|
|
|
bool sub_has_get_text(struct dec_sub *sub);
|
|
|
|
char *sub_get_text(struct dec_sub *sub, double pts);
|
|
|
|
void sub_reset(struct dec_sub *sub);
|
|
|
|
|
2013-06-28 23:34:11 +00:00
|
|
|
int sub_control(struct dec_sub *sub, enum sd_ctrl cmd, void *arg);
|
2012-09-01 17:49:04 +00:00
|
|
|
|
2012-08-25 14:47:50 +00:00
|
|
|
#endif
|