From d4b8d1486a69ee5bbd96a2758f56c1bbc6242bfb Mon Sep 17 00:00:00 2001 From: harklu Date: Mon, 8 Aug 2011 10:07:17 +0200 Subject: core: allocate OSD text buffers dynamically The OSD text buffers (mp_osd_msg_t.text and osd_state.text) used to be static arrays, with the buffer sizes spread all over the code as magic constants. Make the buffers dynamically allocated and remove the arbitrary length limits. --- sub/sub.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sub/sub.c') diff --git a/sub/sub.c b/sub/sub.c index 880793373c..efe648948c 100644 --- a/sub/sub.c +++ b/sub/sub.c @@ -1239,9 +1239,18 @@ struct osd_state *osd_create(void) #ifdef CONFIG_FREETYPE force_load_font = 1; #endif + osd_set_text(osd, NULL); return osd; } +void osd_set_text(struct osd_state *osd, const char *text) { + talloc_free(osd->osd_text); + //osd->text must never be NULL + if (!text) + text = ""; + osd->osd_text = talloc_strdup(osd, text); +} + int vo_osd_changed_flag=0; void osd_remove_text(struct osd_state *osd, int dxs, int dys, -- cgit v1.2.3