mirror of
https://github.com/mpv-player/mpv
synced 2024-12-29 10:32:15 +00:00
89a5714893
Remove subtitle selection code setting osd->ass_track directly and vf_ass/vf_vo code rendering the track directly with libass. Instead, do track selection and rendering with dec_sub.c functions. Before, mpctx->set_of_ass_tracks[] contained bare libass tracks generated from external subtitle files. For use with dec_sub.c, it now contains struct sh_sub instances with decoder already initialized. This commit breaks the sub_step command ('g' and 'y' keys) for libass-rendered subtitles. It could be fixed, but it's so useless - especially as with the existing implementation there's no practical way to get subtitle delay back to normal after using it - that I didn't bother. Conflicts: command.c mp_core.h mplayer.c
73 lines
2.4 KiB
C
73 lines
2.4 KiB
C
/*
|
|
* This file is part of mplayer2.
|
|
*
|
|
* mplayer2 is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* mplayer2 is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with mplayer2; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*/
|
|
|
|
#ifndef MPLAYER_EOSD_PACKER_H
|
|
#define MPLAYER_EOSD_PACKER_H
|
|
|
|
#include <inttypes.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "sub/ass_mp.h"
|
|
#include "sub/dec_sub.h"
|
|
|
|
// Pool of surfaces
|
|
struct eosd_surface {
|
|
//void *native_surface;
|
|
int w;
|
|
int h;
|
|
};
|
|
|
|
struct eosd_rect {
|
|
int x0, y0, x1, y1;
|
|
};
|
|
|
|
// List of surfaces to be rendered
|
|
struct eosd_target {
|
|
struct eosd_rect source; // position in EOSD surface
|
|
struct eosd_rect dest; // position on screen
|
|
uint32_t color; // libass-style color of the image
|
|
// NOTE: This must not be accessed after you return from your VO's
|
|
// VOCTRL_DRAW_EOSD call - libass will free or reuse the associated
|
|
// memory. Feel free to set this to NULL to make erroneous accesses to
|
|
// this member fail early.
|
|
ASS_Image *ass_img;
|
|
};
|
|
|
|
struct eosd_packer {
|
|
struct eosd_surface surface;
|
|
struct eosd_target *targets;
|
|
int targets_count; // number of valid elements in targets
|
|
int targets_size; // number of allocated elements in targets
|
|
|
|
uint32_t max_surface_width;
|
|
uint32_t max_surface_height;
|
|
|
|
int *scratch;
|
|
};
|
|
|
|
struct eosd_packer *eosd_packer_create(void *talloc_ctx);
|
|
void eosd_packer_reinit(struct eosd_packer *state, uint32_t max_width,
|
|
uint32_t max_height);
|
|
void eosd_packer_generate(struct eosd_packer *state, mp_eosd_images_t *imgs,
|
|
bool *out_need_reposition, bool *out_need_upload,
|
|
bool *out_need_reallocate);
|
|
bool eosd_packer_calculate_source_bb(struct eosd_packer *state,
|
|
struct eosd_rect *out_bb);
|
|
|
|
#endif /* MPLAYER_EOSD_PACKER_H */
|