From subversion at mplayerhq.hu Thu Dec 1 19:34:19 2011 From: subversion at mplayerhq.hu (reimar) Date: Thu, 1 Dec 2011 19:34:19 +0100 (CET) Subject: [MPlayer-cvslog] r34369 - trunk/libvo/x11_common.c Message-ID: <20111201183419.E2B69121D53@avserver.banki.hu> Author: reimar Date: Thu Dec 1 19:34:18 2011 New Revision: 34369 Log: X11: support CTRL key and thus key combinations with it. Modified: trunk/libvo/x11_common.c Modified: trunk/libvo/x11_common.c ============================================================================== --- trunk/libvo/x11_common.c Tue Nov 29 21:15:22 2011 (r34368) +++ trunk/libvo/x11_common.c Thu Dec 1 19:34:18 2011 (r34369) @@ -844,6 +844,7 @@ int vo_x11_check_events(Display * mydisp ret |= check_resize(); break; case KeyPress: + case KeyRelease: { int key; @@ -853,10 +854,15 @@ int vo_x11_check_events(Display * mydisp XLookupString(&Event.xkey, buf, sizeof(buf), &keySym, &stat); - if (!vo_x11_putkey_ext(keySym)) { - key = - ((keySym & 0xff00) != - 0 ? ((keySym & 0x00ff) + 256) : (keySym)); + key = + ((keySym & 0xff00) != + 0 ? ((keySym & 0x00ff) + 256) : (keySym)); + if (key == wsLeftCtrl || key == wsRightCtrl) { + mplayer_put_key(KEY_CTRL | + (Event.type == KeyPress ? MP_KEY_DOWN : 0)); + } else if (Event.type == KeyRelease) { + break; + } else if (!vo_x11_putkey_ext(keySym)) { vo_x11_putkey(key); } ret |= VO_EVENT_KEYPRESS; @@ -1095,7 +1101,7 @@ void vo_x11_create_vo_window(XVisualInfo // if it relies on events being forwarded to the parent of WinID. // It also is consistent with the w32_common.c code. vo_x11_selectinput_witherr(mDisplay, vo_window, - StructureNotifyMask | KeyPressMask | PointerMotionMask | + StructureNotifyMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask); vo_x11_update_geometry(); @@ -1136,7 +1142,7 @@ void vo_x11_create_vo_window(XVisualInfo XSelectInput(mDisplay, vo_window, NoEventMask); XSync(mDisplay, False); vo_x11_selectinput_witherr(mDisplay, vo_window, - StructureNotifyMask | KeyPressMask | PointerMotionMask | + StructureNotifyMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask); } if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop); From subversion at mplayerhq.hu Thu Dec 1 20:09:21 2011 From: subversion at mplayerhq.hu (reimar) Date: Thu, 1 Dec 2011 20:09:21 +0100 (CET) Subject: [MPlayer-cvslog] r34370 - trunk/input/input.c Message-ID: <20111201190921.37BE4121F26@avserver.banki.hu> Author: reimar Date: Thu Dec 1 20:09:20 2011 New Revision: 34370 Log: Only print printable characters, not all ASCII ones. Non-printable ASCII characters like ESC will instead be printed as hex now. Modified: trunk/input/input.c Modified: trunk/input/input.c ============================================================================== --- trunk/input/input.c Thu Dec 1 19:34:18 2011 (r34369) +++ trunk/input/input.c Thu Dec 1 20:09:20 2011 (r34370) @@ -1456,7 +1456,7 @@ mp_input_get_key_name(int key) { return key_names[i].name; } - if(isascii(key)) { + if(isprint(key)) { snprintf(key_str,12,"%c",(char)key); return key_str; } From subversion at mplayerhq.hu Thu Dec 1 20:10:15 2011 From: subversion at mplayerhq.hu (reimar) Date: Thu, 1 Dec 2011 20:10:15 +0100 (CET) Subject: [MPlayer-cvslog] r34371 - trunk/stream/cache2.c Message-ID: <20111201191015.810A71220B0@avserver.banki.hu> Author: reimar Date: Thu Dec 1 20:10:15 2011 New Revision: 34371 Log: Make cache process detect when the main process disappeared and make it exit on its own in that case. Modified: trunk/stream/cache2.c Modified: trunk/stream/cache2.c ============================================================================== --- trunk/stream/cache2.c Thu Dec 1 20:09:20 2011 (r34370) +++ trunk/stream/cache2.c Thu Dec 1 20:10:15 2011 (r34371) @@ -75,6 +75,9 @@ typedef struct { int back_size; // we should keep back_size amount of old bytes for backward seek int fill_limit; // we should fill buffer only if space>=fill_limit int seek_limit; // keep filling cache if distance is less that seek limit +#if FORKED_CACHE + pid_t ppid; // parent PID to detect killed parent +#endif // filler's pointers: int eof; off_t min_filepos; // buffer contain only a part of the file, from min-max pos @@ -279,6 +282,13 @@ static int cache_execute_control(cache_v s->stream_time_pos = pos; else s->stream_time_pos = MP_NOPTS_VALUE; +#if FORKED_CACHE + // if parent PID changed, main process was killed -> exit + if (s->ppid != getppid()) { + mp_msg(MSGT_CACHE, MSGL_WARN, "Parent process disappeared, exiting cache process.\n"); + return 0; + } +#endif last = GetTimerMS(); } if (s->control == -1) return 1; @@ -346,6 +356,9 @@ static cache_vars_t* cache_init(int size s->fill_limit=8*sector; s->back_size=s->buffer_size/2; +#if FORKED_CACHE + s->ppid = getpid(); +#endif return s; } From subversion at mplayerhq.hu Fri Dec 2 20:14:24 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Fri, 2 Dec 2011 20:14:24 +0100 (CET) Subject: [MPlayer-cvslog] r34372 - trunk/etc/codecs.conf Message-ID: <20111202191424.2155A121AC7@avserver.banki.hu> Author: cehoyos Date: Fri Dec 2 20:14:23 2011 New Revision: 34372 Log: Support FFmpeg VBLE decoder. Patch by Paul B Mahol, onemda gmail Modified: trunk/etc/codecs.conf Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Thu Dec 1 20:10:15 2011 (r34371) +++ trunk/etc/codecs.conf Fri Dec 2 20:14:23 2011 (r34372) @@ -2324,6 +2324,14 @@ videocodec utvideodmo out RGB32,RGB24 out BGR32,BGR24 +videocodec ffvble + info "FFmpeg VBLE lossless codec" + status working + fourcc VBLE + driver ffmpeg + dll vble + out YV12 + videocodec psiv info "Infinite Video PSI_V" status working From subversion at mplayerhq.hu Fri Dec 2 20:23:43 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Fri, 2 Dec 2011 20:23:43 +0100 (CET) Subject: [MPlayer-cvslog] r34373 - in trunk: etc/codecs.conf libmpdemux/mp_taglists.c Message-ID: <20111202192344.50E6E12278B@avserver.banki.hu> Author: cehoyos Date: Fri Dec 2 20:23:43 2011 New Revision: 34373 Log: Support FFmpeg Funcom IMA ISS ADPCM decoding. Patch by Paul B Mahol, onemda gmail Modified: trunk/etc/codecs.conf trunk/libmpdemux/mp_taglists.c Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Fri Dec 2 20:14:23 2011 (r34372) +++ trunk/etc/codecs.conf Fri Dec 2 20:23:43 2011 (r34373) @@ -4272,6 +4272,13 @@ audiocodec ffadpcmimadk3 driver ffmpeg dll adpcm_ima_dk3 +audiocodec ffadpcmimaiss + info "FFmpeg Funcom IMA ISS ADPCM" + status working + fourcc AISS ; internal MPlayer FourCC + driver ffmpeg + dll adpcm_ima_iss + audiocodec dk3adpcm info "Duck DK3 ADPCM (rogue format number)" status working Modified: trunk/libmpdemux/mp_taglists.c ============================================================================== --- trunk/libmpdemux/mp_taglists.c Fri Dec 2 20:14:23 2011 (r34372) +++ trunk/libmpdemux/mp_taglists.c Fri Dec 2 20:23:43 2011 (r34373) @@ -31,6 +31,7 @@ static const struct AVCodecTag mp_wav_ta { CODEC_ID_ADPCM_ADX, MKTAG('S', 'a', 'd', 'x')}, { CODEC_ID_ADPCM_EA, MKTAG('A', 'D', 'E', 'A')}, { CODEC_ID_ADPCM_EA_MAXIS_XA, MKTAG('A', 'D', 'X', 'A')}, + { CODEC_ID_ADPCM_IMA_ISS, MKTAG('A', 'I', 'S', 'S')}, { CODEC_ID_ADPCM_IMA_WS, MKTAG('A', 'I', 'W', 'S')}, { CODEC_ID_ADPCM_THP, MKTAG('T', 'H', 'P', 'A')}, { CODEC_ID_ADPCM_XA, MKTAG('P', 'S', 'X', 'A')}, From subversion at mplayerhq.hu Fri Dec 2 20:40:36 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Fri, 2 Dec 2011 20:40:36 +0100 (CET) Subject: [MPlayer-cvslog] r34374 - in trunk: etc/codecs.conf libmpdemux/mp_taglists.c Message-ID: <20111202194036.7E077122A27@avserver.banki.hu> Author: cehoyos Date: Fri Dec 2 20:40:36 2011 New Revision: 34374 Log: Support FFmpeg ADPCM IMA Electronic Arts SEAD decoding. Based on a patch by Paul B Mahol, onemda gmail Modified: trunk/etc/codecs.conf trunk/libmpdemux/mp_taglists.c Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Fri Dec 2 20:23:43 2011 (r34373) +++ trunk/etc/codecs.conf Fri Dec 2 20:40:36 2011 (r34374) @@ -4279,6 +4279,13 @@ audiocodec ffadpcmimaiss driver ffmpeg dll adpcm_ima_iss +audiocodec ffadpcmimaeasead + info "FFmpeg ADPCM IMA Electronic Arts SEAD" + status working + fourcc SEAD ; internal MPlayer FourCC + driver ffmpeg + dll adpcm_ima_ea_sead + audiocodec dk3adpcm info "Duck DK3 ADPCM (rogue format number)" status working Modified: trunk/libmpdemux/mp_taglists.c ============================================================================== --- trunk/libmpdemux/mp_taglists.c Fri Dec 2 20:23:43 2011 (r34373) +++ trunk/libmpdemux/mp_taglists.c Fri Dec 2 20:40:36 2011 (r34374) @@ -31,6 +31,7 @@ static const struct AVCodecTag mp_wav_ta { CODEC_ID_ADPCM_ADX, MKTAG('S', 'a', 'd', 'x')}, { CODEC_ID_ADPCM_EA, MKTAG('A', 'D', 'E', 'A')}, { CODEC_ID_ADPCM_EA_MAXIS_XA, MKTAG('A', 'D', 'X', 'A')}, + { CODEC_ID_ADPCM_IMA_EA_SEAD, MKTAG('S', 'E', 'A', 'D')}, { CODEC_ID_ADPCM_IMA_ISS, MKTAG('A', 'I', 'S', 'S')}, { CODEC_ID_ADPCM_IMA_WS, MKTAG('A', 'I', 'W', 'S')}, { CODEC_ID_ADPCM_THP, MKTAG('T', 'H', 'P', 'A')}, From subversion at mplayerhq.hu Fri Dec 2 20:45:48 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Fri, 2 Dec 2011 20:45:48 +0100 (CET) Subject: [MPlayer-cvslog] r34375 - in trunk: etc/codecs.conf libmpdemux/mp_taglists.c Message-ID: <20111202194549.0F0C012282B@avserver.banki.hu> Author: cehoyos Date: Fri Dec 2 20:45:48 2011 New Revision: 34375 Log: Support FFmpeg ADPCM IMA Electronic Arts EACS decoding. Modified: trunk/etc/codecs.conf trunk/libmpdemux/mp_taglists.c Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Fri Dec 2 20:40:36 2011 (r34374) +++ trunk/etc/codecs.conf Fri Dec 2 20:45:48 2011 (r34375) @@ -4286,6 +4286,13 @@ audiocodec ffadpcmimaeasead driver ffmpeg dll adpcm_ima_ea_sead +audiocodec ffadpcmimaeaeacs + info "FFmpeg ADPCM IMA Electronic Arts EACS" + status working + fourcc EACS ; internal MPlayer FourCC + driver ffmpeg + dll adpcm_ima_ea_eacs + audiocodec dk3adpcm info "Duck DK3 ADPCM (rogue format number)" status working Modified: trunk/libmpdemux/mp_taglists.c ============================================================================== --- trunk/libmpdemux/mp_taglists.c Fri Dec 2 20:40:36 2011 (r34374) +++ trunk/libmpdemux/mp_taglists.c Fri Dec 2 20:45:48 2011 (r34375) @@ -31,6 +31,7 @@ static const struct AVCodecTag mp_wav_ta { CODEC_ID_ADPCM_ADX, MKTAG('S', 'a', 'd', 'x')}, { CODEC_ID_ADPCM_EA, MKTAG('A', 'D', 'E', 'A')}, { CODEC_ID_ADPCM_EA_MAXIS_XA, MKTAG('A', 'D', 'X', 'A')}, + { CODEC_ID_ADPCM_IMA_EA_EACS, MKTAG('E', 'A', 'C', 'S')}, { CODEC_ID_ADPCM_IMA_EA_SEAD, MKTAG('S', 'E', 'A', 'D')}, { CODEC_ID_ADPCM_IMA_ISS, MKTAG('A', 'I', 'S', 'S')}, { CODEC_ID_ADPCM_IMA_WS, MKTAG('A', 'I', 'W', 'S')}, From subversion at mplayerhq.hu Sat Dec 3 01:22:28 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Sat, 3 Dec 2011 01:22:28 +0100 (CET) Subject: [MPlayer-cvslog] r34376 - trunk/etc/codecs.conf Message-ID: <20111203002229.14F60122B14@avserver.banki.hu> Author: cehoyos Date: Sat Dec 3 01:22:28 2011 New Revision: 34376 Log: Cosmetics: Add a comment about the eatgv internal MPlayer FourCC. Patch by Paul B. Mahol, onemda gmail Modified: trunk/etc/codecs.conf Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Fri Dec 2 20:45:48 2011 (r34375) +++ trunk/etc/codecs.conf Sat Dec 3 01:22:28 2011 (r34376) @@ -3529,7 +3529,7 @@ videocodec ffdfa videocodec ffeatgv info "FFmpeg Electronic Arts TGV" status working - fourcc fVGT + fourcc fVGT ; internal MPlayer FourCC driver ffmpeg dll eatgv out BGR8 From subversion at mplayerhq.hu Sat Dec 3 01:30:59 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Sat, 3 Dec 2011 01:30:59 +0100 (CET) Subject: [MPlayer-cvslog] r34377 - trunk/etc/codecs.conf Message-ID: <20111203003100.148AD122027@avserver.banki.hu> Author: cehoyos Date: Sat Dec 3 01:30:59 2011 New Revision: 34377 Log: Support FFmpeg QPEG decoding. Patch by Paul B. Mahol, onemda gmail Modified: trunk/etc/codecs.conf Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Sat Dec 3 01:22:28 2011 (r34376) +++ trunk/etc/codecs.conf Sat Dec 3 01:30:59 2011 (r34377) @@ -3321,6 +3321,15 @@ videocodec qpeg dll "qpeg32.dll" out BGR8 flip +videocodec ffqpeg + info "FFmpeg Q-team QPEG" + status working + fourcc Q1.0,QPEG + fourcc Q1.1,qpeq + driver ffmpeg + dll "qpeg" + out BGR8 + videocodec rricm info "rricm" status crashing From subversion at mplayerhq.hu Sat Dec 3 09:03:12 2011 From: subversion at mplayerhq.hu (reimar) Date: Sat, 3 Dec 2011 09:03:12 +0100 (CET) Subject: [MPlayer-cvslog] r34378 - trunk/libmpdemux/mp_taglists.c Message-ID: <20111203080313.0E8E7121725@avserver.banki.hu> Author: reimar Date: Sat Dec 3 09:03:12 2011 New Revision: 34378 Log: Fix mp_tag2codec_id to take all AVI tags into account again. Fixes bug #2025. Modified: trunk/libmpdemux/mp_taglists.c Modified: trunk/libmpdemux/mp_taglists.c ============================================================================== --- trunk/libmpdemux/mp_taglists.c Sat Dec 3 01:30:59 2011 (r34377) +++ trunk/libmpdemux/mp_taglists.c Sat Dec 3 09:03:12 2011 (r34378) @@ -149,7 +149,16 @@ static const struct AVCodecTag * const m enum CodecID mp_tag2codec_id(uint32_t tag, int audio) { - return av_codec_get_id(audio ? mp_wav_taglists : mp_bmp_taglists, tag); + AVOutputFormat *avi_format; + enum CodecID id = av_codec_get_id(audio ? mp_wav_taglists : mp_bmp_taglists, tag); + if (id != CODEC_ID_NONE) + return id; + avi_format = av_guess_format("avi", NULL, NULL); + if (!avi_format) { + mp_msg(MSGT_DEMUXER, MSGL_FATAL, "MPlayer cannot work properly without AVI muxer in libavformat!\n"); + return 0; + } + return av_codec_get_id(avi_format->codec_tag, tag); } uint32_t mp_codec_id2tag(enum CodecID codec_id, uint32_t old_tag, int audio) From subversion at mplayerhq.hu Sat Dec 3 19:43:55 2011 From: subversion at mplayerhq.hu (reimar) Date: Sat, 3 Dec 2011 19:43:55 +0100 (CET) Subject: [MPlayer-cvslog] r34379 - trunk/libmpcodecs/vd_ffmpeg.c Message-ID: <20111203184355.99B96122DC1@avserver.banki.hu> Author: reimar Date: Sat Dec 3 19:43:54 2011 New Revision: 34379 Log: Finally apply forgotten patch to fix VDCTRL_QUERY_UNSEEN_FRAMES result for vd_ffmpeg. Modified: trunk/libmpcodecs/vd_ffmpeg.c Modified: trunk/libmpcodecs/vd_ffmpeg.c ============================================================================== --- trunk/libmpcodecs/vd_ffmpeg.c Sat Dec 3 09:03:12 2011 (r34378) +++ trunk/libmpcodecs/vd_ffmpeg.c Sat Dec 3 19:43:54 2011 (r34379) @@ -180,8 +180,10 @@ static int control(sh_video_t *sh, int c avcodec_flush_buffers(avctx); return CONTROL_TRUE; case VDCTRL_QUERY_UNSEEN_FRAMES: - // has_b_frames includes delay due to frame-multithreading - return avctx->has_b_frames + 10; + // "has_b_frames" contains the (e.g. reorder) delay as sepcified + // in the standard. "delay" contains the libavcodec-specific delay + // e.g. due to frame multithreading + return avctx->has_b_frames + avctx->delay + 10; } return CONTROL_UNKNOWN; } From subversion at mplayerhq.hu Sat Dec 3 20:06:19 2011 From: subversion at mplayerhq.hu (reimar) Date: Sat, 3 Dec 2011 20:06:19 +0100 (CET) Subject: [MPlayer-cvslog] r34380 - trunk/libvo/x11_common.c Message-ID: <20111203190619.9F5E1122DB8@avserver.banki.hu> Author: reimar Date: Sat Dec 3 20:06:19 2011 New Revision: 34380 Log: X11: update title only on reconfigure instead of at least once per frame. At least currently such frequent updates are not necessary and they are a bit of a performance issue, at least when used with X forwarding. Modified: trunk/libvo/x11_common.c Modified: trunk/libvo/x11_common.c ============================================================================== --- trunk/libvo/x11_common.c Sat Dec 3 19:43:54 2011 (r34379) +++ trunk/libvo/x11_common.c Sat Dec 3 20:06:19 2011 (r34380) @@ -1079,6 +1079,8 @@ void vo_x11_create_vo_window(XVisualInfo Colormap col_map, const char *classname, const char *title) { + if (vo_wintitle) + title = vo_wintitle; if (WinID >= 0) { vo_fs = flags & VOFLAG_FULLSCREEN; vo_window = WinID ? (Window)WinID : mRootWin; @@ -1117,12 +1119,12 @@ void vo_x11_create_vo_window(XVisualInfo } if (flags & VOFLAG_HIDDEN) goto final; + XStoreName(mDisplay, vo_window, title); if (window_state & VOFLAG_HIDDEN) { XSizeHints hint; XEvent xev; window_state &= ~VOFLAG_HIDDEN; vo_x11_classhint(mDisplay, vo_window, classname); - XStoreName(mDisplay, vo_window, title); vo_hidecursor(mDisplay, vo_window); XSelectInput(mDisplay, vo_window, StructureNotifyMask); hint.x = x; hint.y = y; @@ -1351,8 +1353,6 @@ int vo_x11_update_geometry(void) { if (w <= INT_MAX && h <= INT_MAX) { vo_dwidth = w; vo_dheight = h; } XTranslateCoordinates(mDisplay, vo_window, mRootWin, 0, 0, &vo_dx, &vo_dy, &dummy_win); - if (vo_wintitle) - XStoreName(mDisplay, vo_window, vo_wintitle); return depth <= INT_MAX ? depth : 0; } From subversion at mplayerhq.hu Sat Dec 3 20:59:17 2011 From: subversion at mplayerhq.hu (reimar) Date: Sat, 3 Dec 2011 20:59:17 +0100 (CET) Subject: [MPlayer-cvslog] r34381 - in trunk/libvo: vo_directx.c w32_common.c Message-ID: <20111203195917.A4975122EDF@avserver.banki.hu> Author: reimar Date: Sat Dec 3 20:59:17 2011 New Revision: 34381 Log: Make -title and -use-filename-title work on Windows. Modified: trunk/libvo/vo_directx.c trunk/libvo/w32_common.c Modified: trunk/libvo/vo_directx.c ============================================================================== --- trunk/libvo/vo_directx.c Sat Dec 3 20:06:19 2011 (r34380) +++ trunk/libvo/vo_directx.c Sat Dec 3 20:59:17 2011 (r34381) @@ -959,9 +959,6 @@ static int config(uint32_t width, uint32 if (!vo_w32_config(d_width, d_height, options)) return 1; - if (WinID == -1) - SetWindowText(vo_w32_window, title); - /*create the surfaces*/ if (Directx_CreatePrimarySurface()) return 1; Modified: trunk/libvo/w32_common.c ============================================================================== --- trunk/libvo/w32_common.c Sat Dec 3 20:06:19 2011 (r34380) +++ trunk/libvo/w32_common.c Sat Dec 3 20:59:17 2011 (r34381) @@ -433,6 +433,8 @@ int vo_w32_config(uint32_t width, uint32 prev_height = vo_dheight = height; prev_x = vo_dx; prev_y = vo_dy; + if (vo_wintitle) + SetWindowText(vo_w32_window, vo_wintitle); } vo_fs = flags & VOFLAG_FULLSCREEN; From subversion at mplayerhq.hu Sat Dec 3 22:33:28 2011 From: subversion at mplayerhq.hu (reimar) Date: Sat, 3 Dec 2011 22:33:28 +0100 (CET) Subject: [MPlayer-cvslog] r34382 - trunk/libass/mputils.h Message-ID: <20111203213328.82372122F4C@avserver.banki.hu> Author: reimar Date: Sat Dec 3 22:33:28 2011 New Revision: 34382 Log: Remove unused header. Deleted: trunk/libass/mputils.h From subversion at mplayerhq.hu Sat Dec 3 22:35:57 2011 From: subversion at mplayerhq.hu (reimar) Date: Sat, 3 Dec 2011 22:35:57 +0100 (CET) Subject: [MPlayer-cvslog] r34383 - in trunk: Makefile libass/ass.c libass/ass.h libass/ass_bitmap.c libass/ass_bitmap.h libass/ass_cache.c libass/ass_cache.h libass/ass_cache_template.h libass/ass_drawing.c libass/ass_drawi... Message-ID: <20111203213557.4BB1E122EDB@avserver.banki.hu> Author: reimar Date: Sat Dec 3 22:35:56 2011 New Revision: 34383 Log: Update libass to 0.10 release. Patch by [subjunk gmail com], see bug #2008. Modified: trunk/Makefile trunk/libass/ass.c trunk/libass/ass.h trunk/libass/ass_bitmap.c trunk/libass/ass_bitmap.h trunk/libass/ass_cache.c trunk/libass/ass_cache.h trunk/libass/ass_cache_template.h trunk/libass/ass_drawing.c trunk/libass/ass_drawing.h trunk/libass/ass_font.c trunk/libass/ass_font.h trunk/libass/ass_library.c trunk/libass/ass_parse.c trunk/libass/ass_parse.h trunk/libass/ass_render.c trunk/libass/ass_render.h trunk/libass/ass_render_api.c trunk/libass/ass_types.h Modified: trunk/Makefile ============================================================================== --- trunk/Makefile Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/Makefile Sat Dec 3 22:35:56 2011 (r34383) @@ -115,6 +115,7 @@ SRCS_COMMON-$(LIBASS_INTERNAL) += libass/ass_parse.c \ libass/ass_render.c \ libass/ass_render_api.c \ + libass/ass_shaper.c \ libass/ass_strtod.c \ libass/ass_utils.c \ Modified: trunk/libass/ass.c ============================================================================== --- trunk/libass/ass.c Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass.c Sat Dec 3 22:35:56 2011 (r34383) @@ -28,6 +28,7 @@ #include #include #include +#include #ifdef CONFIG_ICONV #include @@ -69,6 +70,7 @@ void ass_free_track(ASS_Track *track) } free(track->style_format); free(track->event_format); + free(track->Language); if (track->styles) { for (i = 0; i < track->n_styles; ++i) ass_free_style(track, i); @@ -595,6 +597,12 @@ static int process_info_line(ASS_Track * track->ScaledBorderAndShadow = parse_bool(str + 22); } else if (!strncmp(str, "Kerning:", 8)) { track->Kerning = parse_bool(str + 8); + } else if (!strncmp(str, "Language:", 9)) { + char *p = str + 9; + while (*p && isspace(*p)) p++; + track->Language = malloc(3); + strncpy(track->Language, p, 2); + track->Language[2] = 0; } return 0; } @@ -1269,3 +1277,36 @@ ASS_Track *ass_new_track(ASS_Library *li track->parser_priv = calloc(1, sizeof(ASS_ParserPriv)); return track; } + +/** + * \brief Prepare track for rendering + */ +void ass_lazy_track_init(ASS_Library *lib, ASS_Track *track) +{ + if (track->PlayResX && track->PlayResY) + return; + if (!track->PlayResX && !track->PlayResY) { + ass_msg(lib, MSGL_WARN, + "Neither PlayResX nor PlayResY defined. Assuming 384x288"); + track->PlayResX = 384; + track->PlayResY = 288; + } else { + if (!track->PlayResY && track->PlayResX == 1280) { + track->PlayResY = 1024; + ass_msg(lib, MSGL_WARN, + "PlayResY undefined, setting to %d", track->PlayResY); + } else if (!track->PlayResY) { + track->PlayResY = track->PlayResX * 3 / 4; + ass_msg(lib, MSGL_WARN, + "PlayResY undefined, setting to %d", track->PlayResY); + } else if (!track->PlayResX && track->PlayResY == 1024) { + track->PlayResX = 1280; + ass_msg(lib, MSGL_WARN, + "PlayResX undefined, setting to %d", track->PlayResX); + } else if (!track->PlayResX) { + track->PlayResX = track->PlayResY * 4 / 3; + ass_msg(lib, MSGL_WARN, + "PlayResX undefined, setting to %d", track->PlayResX); + } + } +} Modified: trunk/libass/ass.h ============================================================================== --- trunk/libass/ass.h Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass.h Sat Dec 3 22:35:56 2011 (r34383) @@ -23,7 +23,7 @@ #include #include "ass_types.h" -#define LIBASS_VERSION 0x00913000 +#define LIBASS_VERSION 0x01000000 /* * A linked list of images produced by an ass renderer. @@ -61,6 +61,19 @@ typedef enum { } ASS_Hinting; /** + * \brief Text shaping levels. + * + * SIMPLE is a fast, font-agnostic shaper that can do only substitutions. + * COMPLEX is a slower shaper using OpenType for substitutions and positioning. + * + * libass uses the best shaper available by default. + */ +typedef enum { + ASS_SHAPING_SIMPLE = 0, + ASS_SHAPING_COMPLEX +} ASS_ShapingLevel; + +/** * \brief Initialize the library. * \return library handle or NULL if failed */ @@ -147,6 +160,13 @@ void ass_renderer_done(ASS_Renderer *pri void ass_set_frame_size(ASS_Renderer *priv, int w, int h); /** + * \brief Set shaping level. This is merely a hint, the renderer will use + * whatever is available if the request cannot be fulfilled. + * \param level shaping level + */ +void ass_set_shaper(ASS_Renderer *priv, ASS_ShapingLevel level); + +/** * \brief Set frame margins. These values may be negative if pan-and-scan * is used. * \param priv renderer handle Modified: trunk/libass/ass_bitmap.c ============================================================================== --- trunk/libass/ass_bitmap.c Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass_bitmap.c Sat Dec 3 22:35:56 2011 (r34383) @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 Evgeniy Stepanov + * Copyright (C) 2011 Grigori Goronzy * * This file is part of libass. * @@ -22,6 +23,7 @@ #include #include #include FT_GLYPH_H +#include FT_OUTLINE_H #include "ass_utils.h" #include "ass_bitmap.h" @@ -133,10 +135,12 @@ void ass_synth_done(ASS_SynthPriv *priv) static Bitmap *alloc_bitmap(int w, int h) { Bitmap *bm; + unsigned s = w; // XXX: alignment bm = malloc(sizeof(Bitmap)); - bm->buffer = calloc(w, h); + bm->buffer = calloc(s, h); bm->w = w; bm->h = h; + bm->stride = s; bm->left = bm->top = 0; return bm; } @@ -153,70 +157,57 @@ static Bitmap *copy_bitmap(const Bitmap Bitmap *dst = alloc_bitmap(src->w, src->h); dst->left = src->left; dst->top = src->top; - memcpy(dst->buffer, src->buffer, src->w * src->h); + memcpy(dst->buffer, src->buffer, src->stride * src->h); return dst; } -int check_glyph_area(ASS_Library *library, FT_Glyph glyph) -{ - FT_BBox bbox; - long long dx, dy; - FT_Glyph_Get_CBox(glyph, FT_GLYPH_BBOX_TRUNCATE, &bbox); - dx = bbox.xMax - bbox.xMin; - dy = bbox.yMax - bbox.yMin; - if (dx * dy > 8000000) { - ass_msg(library, MSGL_WARN, "Glyph bounding box too large: %dx%dpx", - (int) dx, (int) dy); - return 1; - } else - return 0; -} - -static Bitmap *glyph_to_bitmap_internal(ASS_Library *library, - FT_Glyph glyph, int bord) +Bitmap *outline_to_bitmap(ASS_Library *library, FT_Library ftlib, + FT_Outline *outline, int bord) { - FT_BitmapGlyph bg; - FT_Bitmap *bit; Bitmap *bm; int w, h; - unsigned char *src; - unsigned char *dst; - int i; int error; + FT_BBox bbox; + FT_Bitmap bitmap; - if (check_glyph_area(library, glyph)) - return 0; - error = FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, 0, 0); - if (error) { - ass_msg(library, MSGL_WARN, "FT_Glyph_To_Bitmap error %d", - error); - return 0; - } + FT_Outline_Get_CBox(outline, &bbox); + // move glyph to origin (0, 0) + bbox.xMin &= ~63; + bbox.yMin &= ~63; + FT_Outline_Translate(outline, -bbox.xMin, -bbox.yMin); + // bitmap size + bbox.xMax = (bbox.xMax + 63) & ~63; + bbox.yMax = (bbox.yMax + 63) & ~63; + w = (bbox.xMax - bbox.xMin) >> 6; + h = (bbox.yMax - bbox.yMin) >> 6; + // pen offset + bbox.xMin >>= 6; + bbox.yMax >>= 6; - bg = (FT_BitmapGlyph) glyph; - bit = &(bg->bitmap); - if (bit->pixel_mode != FT_PIXEL_MODE_GRAY) { - ass_msg(library, MSGL_WARN, "Unsupported pixel mode: %d", - (int) (bit->pixel_mode)); - FT_Done_Glyph(glyph); - return 0; + if (w * h > 8000000) { + ass_msg(library, MSGL_WARN, "Glyph bounding box too large: %dx%dpx", + w, h); + return NULL; } - w = bit->width; - h = bit->rows; + // allocate and set up bitmap bm = alloc_bitmap(w + 2 * bord, h + 2 * bord); - bm->left = bg->left - bord; - bm->top = -bg->top - bord; + bm->left = bbox.xMin - bord; + bm->top = -bbox.yMax - bord; + bitmap.width = w; + bitmap.rows = h; + bitmap.pitch = bm->stride; + bitmap.buffer = bm->buffer + bord + bm->stride * bord; + bitmap.num_grays = 256; + bitmap.pixel_mode = FT_PIXEL_MODE_GRAY; - src = bit->buffer; - dst = bm->buffer + bord + bm->w * bord; - for (i = 0; i < h; ++i) { - memcpy(dst, src, w); - src += bit->pitch; - dst += bm->w; + // render into target bitmap + if ((error = FT_Outline_Get_Bitmap(ftlib, outline, &bitmap))) { + ass_msg(library, MSGL_WARN, "Failed to rasterize glyph: %d\n", error); + ass_free_bitmap(bm); + return NULL; } - FT_Done_Glyph(glyph); return bm; } @@ -232,16 +223,16 @@ static void fix_outline(Bitmap *bm_g, Bi const int l = bm_o->left > bm_g->left ? bm_o->left : bm_g->left; const int t = bm_o->top > bm_g->top ? bm_o->top : bm_g->top; const int r = - bm_o->left + bm_o->w < - bm_g->left + bm_g->w ? bm_o->left + bm_o->w : bm_g->left + bm_g->w; + bm_o->left + bm_o->stride < + bm_g->left + bm_g->stride ? bm_o->left + bm_o->stride : bm_g->left + bm_g->stride; const int b = bm_o->top + bm_o->h < bm_g->top + bm_g->h ? bm_o->top + bm_o->h : bm_g->top + bm_g->h; unsigned char *g = - bm_g->buffer + (t - bm_g->top) * bm_g->w + (l - bm_g->left); + bm_g->buffer + (t - bm_g->top) * bm_g->stride + (l - bm_g->left); unsigned char *o = - bm_o->buffer + (t - bm_o->top) * bm_o->w + (l - bm_o->left); + bm_o->buffer + (t - bm_o->top) * bm_o->stride + (l - bm_o->left); for (y = 0; y < b - t; ++y) { for (x = 0; x < r - l; ++x) { @@ -250,8 +241,8 @@ static void fix_outline(Bitmap *bm_g, Bi c_o = o[x]; o[x] = (c_o > c_g) ? c_o - (c_g / 2) : 0; } - g += bm_g->w; - o += bm_o->w; + g += bm_g->stride; + o += bm_o->stride; } } @@ -259,27 +250,30 @@ static void fix_outline(Bitmap *bm_g, Bi * \brief Shift a bitmap by the fraction of a pixel in x and y direction * expressed in 26.6 fixed point */ -static void shift_bitmap(unsigned char *buf, int w, int h, int shift_x, - int shift_y) +static void shift_bitmap(Bitmap *bm, int shift_x, int shift_y) { int x, y, b; + int w = bm->w; + int h = bm->h; + int s = bm->stride; + unsigned char *buf = bm->buffer; // Shift in x direction if (shift_x > 0) { for (y = 0; y < h; y++) { for (x = w - 1; x > 0; x--) { - b = (buf[x + y * w - 1] * shift_x) >> 6; - buf[x + y * w - 1] -= b; - buf[x + y * w] += b; + b = (buf[x + y * s - 1] * shift_x) >> 6; + buf[x + y * s - 1] -= b; + buf[x + y * s] += b; } } } else if (shift_x < 0) { shift_x = -shift_x; for (y = 0; y < h; y++) { for (x = 0; x < w - 1; x++) { - b = (buf[x + y * w + 1] * shift_x) >> 6; - buf[x + y * w + 1] -= b; - buf[x + y * w] += b; + b = (buf[x + y * s + 1] * shift_x) >> 6; + buf[x + y * s + 1] -= b; + buf[x + y * s] += b; } } } @@ -288,18 +282,18 @@ static void shift_bitmap(unsigned char * if (shift_y > 0) { for (x = 0; x < w; x++) { for (y = h - 1; y > 0; y--) { - b = (buf[x + (y - 1) * w] * shift_y) >> 6; - buf[x + (y - 1) * w] -= b; - buf[x + y * w] += b; + b = (buf[x + (y - 1) * s] * shift_y) >> 6; + buf[x + (y - 1) * s] -= b; + buf[x + y * s] += b; } } } else if (shift_y < 0) { shift_y = -shift_y; for (x = 0; x < w; x++) { for (y = 0; y < h - 1; y++) { - b = (buf[x + (y + 1) * w] * shift_y) >> 6; - buf[x + (y + 1) * w] -= b; - buf[x + y * w] += b; + b = (buf[x + (y + 1) * s] * shift_y) >> 6; + buf[x + (y + 1) * s] -= b; + buf[x + y * s] += b; } } } @@ -430,16 +424,20 @@ static void ass_gauss_blur(unsigned char * \brief Blur with [[1,2,1]. [2,4,2], [1,2,1]] kernel * This blur is the same as the one employed by vsfilter. */ -static void be_blur(unsigned char *buf, int w, int h) +static void be_blur(Bitmap *bm) { + int w = bm->w; + int h = bm->h; + int s = bm->stride; + unsigned char *buf = bm->buffer; unsigned int x, y; unsigned int old_sum, new_sum; for (y = 0; y < h; y++) { - old_sum = 2 * buf[y * w]; + old_sum = 2 * buf[y * s]; for (x = 0; x < w - 1; x++) { - new_sum = buf[y * w + x] + buf[y * w + x + 1]; - buf[y * w + x] = (old_sum + new_sum) >> 2; + new_sum = buf[y * s + x] + buf[y * s + x + 1]; + buf[y * s + x] = (old_sum + new_sum) >> 2; old_sum = new_sum; } } @@ -447,18 +445,18 @@ static void be_blur(unsigned char *buf, for (x = 0; x < w; x++) { old_sum = 2 * buf[x]; for (y = 0; y < h - 1; y++) { - new_sum = buf[y * w + x] + buf[(y + 1) * w + x]; - buf[y * w + x] = (old_sum + new_sum) >> 2; + new_sum = buf[y * s + x] + buf[(y + 1) * s + x]; + buf[y * s + x] = (old_sum + new_sum) >> 2; old_sum = new_sum; } } } -int glyph_to_bitmap(ASS_Library *library, ASS_SynthPriv *priv_blur, - FT_Glyph glyph, FT_Glyph outline_glyph, - Bitmap **bm_g, Bitmap **bm_o, Bitmap **bm_s, - int be, double blur_radius, FT_Vector shadow_offset, - int border_style) +int outline_to_bitmap3(ASS_Library *library, ASS_SynthPriv *priv_blur, + FT_Library ftlib, FT_Outline *outline, FT_Outline *border, + Bitmap **bm_g, Bitmap **bm_o, Bitmap **bm_s, + int be, double blur_radius, FT_Vector shadow_offset, + int border_style) { blur_radius *= 2; int bbord = be > 0 ? sqrt(2 * be) : 0; @@ -471,13 +469,13 @@ int glyph_to_bitmap(ASS_Library *library *bm_g = *bm_o = *bm_s = 0; - if (glyph) - *bm_g = glyph_to_bitmap_internal(library, glyph, bord); + if (outline) + *bm_g = outline_to_bitmap(library, ftlib, outline, bord); if (!*bm_g) return 1; - if (outline_glyph) { - *bm_o = glyph_to_bitmap_internal(library, outline_glyph, bord); + if (border) { + *bm_o = outline_to_bitmap(library, ftlib, border, bord); if (!*bm_o) { return 1; } @@ -486,9 +484,9 @@ int glyph_to_bitmap(ASS_Library *library // Apply box blur (multiple passes, if requested) while (be--) { if (*bm_o) - be_blur((*bm_o)->buffer, (*bm_o)->w, (*bm_o)->h); + be_blur(*bm_o); else - be_blur((*bm_g)->buffer, (*bm_g)->w, (*bm_g)->h); + be_blur(*bm_g); } // Apply gaussian blur @@ -500,12 +498,12 @@ int glyph_to_bitmap(ASS_Library *library generate_tables(priv_blur, blur_radius); if (*bm_o) ass_gauss_blur((*bm_o)->buffer, priv_blur->tmp, - (*bm_o)->w, (*bm_o)->h, (*bm_o)->w, + (*bm_o)->w, (*bm_o)->h, (*bm_o)->stride, (int *) priv_blur->gt2, priv_blur->g_r, priv_blur->g_w); else ass_gauss_blur((*bm_g)->buffer, priv_blur->tmp, - (*bm_g)->w, (*bm_g)->h, (*bm_g)->w, + (*bm_g)->w, (*bm_g)->h, (*bm_g)->stride, (int *) priv_blur->gt2, priv_blur->g_r, priv_blur->g_w); } @@ -521,8 +519,7 @@ int glyph_to_bitmap(ASS_Library *library assert(bm_s); - shift_bitmap((*bm_s)->buffer, (*bm_s)->w,(*bm_s)->h, - shadow_offset.x, shadow_offset.y); + shift_bitmap(*bm_s, shadow_offset.x, shadow_offset.y); return 0; } Modified: trunk/libass/ass_bitmap.h ============================================================================== --- trunk/libass/ass_bitmap.h Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass_bitmap.h Sat Dec 3 22:35:56 2011 (r34383) @@ -32,9 +32,12 @@ void ass_synth_done(ASS_SynthPriv *priv) typedef struct { int left, top; int w, h; // width, height + int stride; unsigned char *buffer; // w x h buffer } Bitmap; +Bitmap *outline_to_bitmap(ASS_Library *library, FT_Library ftlib, + FT_Outline *outline, int bord); /** * \brief perform glyph rendering * \param glyph original glyph @@ -44,13 +47,12 @@ typedef struct { * \param bm_g out: pointer to the bitmap of glyph shadow is returned here * \param be 1 = produces blurred bitmaps, 0 = normal bitmaps */ -int glyph_to_bitmap(ASS_Library *library, ASS_SynthPriv *priv_blur, - FT_Glyph glyph, FT_Glyph outline_glyph, - Bitmap **bm_g, Bitmap **bm_o, Bitmap **bm_s, - int be, double blur_radius, FT_Vector shadow_offset, - int border_style); +int outline_to_bitmap3(ASS_Library *library, ASS_SynthPriv *priv_blur, + FT_Library ftlib, FT_Outline *outline, FT_Outline *border, + Bitmap **bm_g, Bitmap **bm_o, Bitmap **bm_s, + int be, double blur_radius, FT_Vector shadow_offset, + int border_style); void ass_free_bitmap(Bitmap *bm); -int check_glyph_area(ASS_Library *library, FT_Glyph glyph); #endif /* LIBASS_BITMAP_H */ Modified: trunk/libass/ass_cache.c ============================================================================== --- trunk/libass/ass_cache.c Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass_cache.c Sat Dec 3 22:35:56 2011 (r34383) @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 Evgeniy Stepanov + * Copyright (C) 2011 Grigori Goronzy * * This file is part of libass. * @@ -20,129 +21,35 @@ #include #include -#include FT_FREETYPE_H -#include FT_GLYPH_H - +#include FT_OUTLINE_H #include #include "ass_utils.h" -#include "ass.h" -#include "ass_fontconfig.h" #include "ass_font.h" -#include "ass_bitmap.h" #include "ass_cache.h" -static unsigned hashmap_hash(void *buf, size_t len) -{ - return fnv_32a_buf(buf, len, FNV1_32A_INIT); -} - -static int hashmap_key_compare(void *a, void *b, size_t size) -{ - return memcmp(a, b, size) == 0; -} - -static void hashmap_item_dtor(void *key, size_t key_size, void *value, - size_t value_size) -{ - free(key); - free(value); -} - -Hashmap *hashmap_init(ASS_Library *library, size_t key_size, - size_t value_size, int nbuckets, - HashmapItemDtor item_dtor, - HashmapKeyCompare key_compare, - HashmapHash hash) -{ - Hashmap *map = calloc(1, sizeof(Hashmap)); - map->library = library; - map->nbuckets = nbuckets; - map->key_size = key_size; - map->value_size = value_size; - map->root = calloc(nbuckets, sizeof(hashmap_item_p)); - map->item_dtor = item_dtor ? item_dtor : hashmap_item_dtor; - map->key_compare = key_compare ? key_compare : hashmap_key_compare; - map->hash = hash ? hash : hashmap_hash; - return map; -} - -void hashmap_done(Hashmap *map) -{ - int i; - // print stats - if (map->count > 0 || map->hit_count + map->miss_count > 0) - ass_msg(map->library, MSGL_V, - "cache statistics: \n total accesses: %d\n hits: %d\n " - "misses: %d\n object count: %d", - map->hit_count + map->miss_count, map->hit_count, - map->miss_count, map->count); - - for (i = 0; i < map->nbuckets; ++i) { - HashmapItem *item = map->root[i]; - while (item) { - HashmapItem *next = item->next; - map->item_dtor(item->key, map->key_size, item->value, - map->value_size); - free(item); - item = next; - } - } - free(map->root); - free(map); -} - -// does nothing if key already exists -void *hashmap_insert(Hashmap *map, void *key, void *value) -{ - unsigned hash = map->hash(key, map->key_size); - HashmapItem **next = map->root + (hash % map->nbuckets); - while (*next) { - if (map->key_compare(key, (*next)->key, map->key_size)) - return (*next)->value; - next = &((*next)->next); - assert(next); - } - (*next) = malloc(sizeof(HashmapItem)); - (*next)->key = malloc(map->key_size); - (*next)->value = malloc(map->value_size); - memcpy((*next)->key, key, map->key_size); - memcpy((*next)->value, value, map->value_size); - (*next)->next = 0; - - map->count++; - return (*next)->value; -} - -void *hashmap_find(Hashmap *map, void *key) -{ - unsigned hash = map->hash(key, map->key_size); - HashmapItem *item = map->root[hash % map->nbuckets]; - while (item) { - if (map->key_compare(key, item->key, map->key_size)) { - map->hit_count++; - return item->value; - } - item = item->next; - } - map->miss_count++; - return 0; -} +// type-specific functions +// create hash/compare functions for bitmap, outline and composite cache +#define CREATE_HASH_FUNCTIONS +#include "ass_cache_template.h" +#define CREATE_COMPARISON_FUNCTIONS +#include "ass_cache_template.h" -//--------------------------------- // font cache - -static unsigned font_desc_hash(void *buf, size_t len) +static unsigned font_hash(void *buf, size_t len) { ASS_FontDesc *desc = buf; unsigned hval; hval = fnv_32a_str(desc->family, FNV1_32A_INIT); hval = fnv_32a_buf(&desc->bold, sizeof(desc->bold), hval); hval = fnv_32a_buf(&desc->italic, sizeof(desc->italic), hval); + hval = fnv_32a_buf(&desc->treat_family_as_pattern, + sizeof(desc->treat_family_as_pattern), hval); + hval = fnv_32a_buf(&desc->vertical, sizeof(desc->vertical), hval); return hval; } -static int font_compare(void *key1, void *key2, size_t key_size) +static unsigned font_compare(void *key1, void *key2, size_t key_size) { ASS_FontDesc *a = key1; ASS_FontDesc *b = key2; @@ -159,227 +66,287 @@ static int font_compare(void *key1, void return 1; } -static void font_hash_dtor(void *key, size_t key_size, void *value, - size_t value_size) +static void font_destruct(void *key, void *value) { ass_font_free(value); free(key); } -ASS_Font *ass_font_cache_find(Hashmap *font_cache, - ASS_FontDesc *desc) -{ - return hashmap_find(font_cache, desc); -} - -/** - * \brief Add a face struct to cache. - * \param font font struct -*/ -void *ass_font_cache_add(Hashmap *font_cache, ASS_Font *font) -{ - return hashmap_insert(font_cache, &(font->desc), font); -} - -Hashmap *ass_font_cache_init(ASS_Library *library) -{ - Hashmap *font_cache; - font_cache = hashmap_init(library, sizeof(ASS_FontDesc), - sizeof(ASS_Font), - 1000, - font_hash_dtor, font_compare, font_desc_hash); - return font_cache; -} - -void ass_font_cache_done(Hashmap *font_cache) -{ - hashmap_done(font_cache); -} - - -// Create hash/compare functions for bitmap and glyph -#define CREATE_HASH_FUNCTIONS -#include "ass_cache_template.h" -#define CREATE_COMPARISON_FUNCTIONS -#include "ass_cache_template.h" - -//--------------------------------- // bitmap cache - -static void bitmap_hash_dtor(void *key, size_t key_size, void *value, - size_t value_size) +static void bitmap_destruct(void *key, void *value) { BitmapHashValue *v = value; + BitmapHashKey *k = key; if (v->bm) ass_free_bitmap(v->bm); if (v->bm_o) ass_free_bitmap(v->bm_o); if (v->bm_s) ass_free_bitmap(v->bm_s); + if (k->type == BITMAP_CLIP) + free(k->u.clip.text); free(key); free(value); } -void *cache_add_bitmap(Hashmap *bitmap_cache, BitmapHashKey *key, - BitmapHashValue *val) +static size_t bitmap_size(void *value, size_t value_size) { - // Note: this is only an approximation + BitmapHashValue *val = value; if (val->bm_o) - bitmap_cache->cache_size += val->bm_o->w * val->bm_o->h * 3; + return val->bm_o->w * val->bm_o->h * 3; else if (val->bm) - bitmap_cache->cache_size += val->bm->w * val->bm->h * 3; - - return hashmap_insert(bitmap_cache, key, val); + return val->bm->w * val->bm->h * 3; + return 0; } -/** - * \brief Get a bitmap from bitmap cache. - * \param key hash key - * \return requested hash val or 0 if not found -*/ -BitmapHashValue *cache_find_bitmap(Hashmap *bitmap_cache, - BitmapHashKey *key) +static unsigned bitmap_hash(void *key, size_t key_size) { - return hashmap_find(bitmap_cache, key); + BitmapHashKey *k = key; + switch (k->type) { + case BITMAP_OUTLINE: return outline_bitmap_hash(&k->u, key_size); + case BITMAP_CLIP: return clip_bitmap_hash(&k->u, key_size); + default: return 0; + } } -Hashmap *ass_bitmap_cache_init(ASS_Library *library) +static unsigned bitmap_compare (void *a, void *b, size_t key_size) { - Hashmap *bitmap_cache; - bitmap_cache = hashmap_init(library, - sizeof(BitmapHashKey), - sizeof(BitmapHashValue), - 0xFFFF + 13, - bitmap_hash_dtor, bitmap_compare, - bitmap_hash); - return bitmap_cache; + BitmapHashKey *ak = a; + BitmapHashKey *bk = b; + if (ak->type != bk->type) return 0; + switch (ak->type) { + case BITMAP_OUTLINE: return outline_bitmap_compare(&ak->u, &bk->u, key_size); + case BITMAP_CLIP: return clip_bitmap_compare(&ak->u, &bk->u, key_size); + default: return 0; + } } -void ass_bitmap_cache_done(Hashmap *bitmap_cache) +// composite cache +static void composite_destruct(void *key, void *value) { - hashmap_done(bitmap_cache); + CompositeHashValue *v = value; + free(v->a); + free(v->b); + free(key); + free(value); } -Hashmap *ass_bitmap_cache_reset(Hashmap *bitmap_cache) -{ - ASS_Library *lib = bitmap_cache->library; +// outline cache - ass_bitmap_cache_done(bitmap_cache); - return ass_bitmap_cache_init(lib); +static unsigned outline_hash(void *key, size_t key_size) +{ + OutlineHashKey *k = key; + switch (k->type) { + case OUTLINE_GLYPH: return glyph_hash(&k->u, key_size); + case OUTLINE_DRAWING: return drawing_hash(&k->u, key_size); + default: return 0; + } } -//--------------------------------- -// glyph cache +static unsigned outline_compare(void *a, void *b, size_t key_size) +{ + OutlineHashKey *ak = a; + OutlineHashKey *bk = b; + if (ak->type != bk->type) return 0; + switch (ak->type) { + case OUTLINE_GLYPH: return glyph_compare(&ak->u, &bk->u, key_size); + case OUTLINE_DRAWING: return drawing_compare(&ak->u, &bk->u, key_size); + default: return 0; + } +} -static void glyph_hash_dtor(void *key, size_t key_size, void *value, - size_t value_size) +static void outline_destruct(void *key, void *value) { - GlyphHashValue *v = value; - if (v->glyph) - FT_Done_Glyph(v->glyph); - if (v->outline_glyph) - FT_Done_Glyph(v->outline_glyph); + OutlineHashValue *v = value; + OutlineHashKey *k = key; + if (v->outline) + outline_free(v->lib, v->outline); + if (v->border) + outline_free(v->lib, v->border); + if (k->type == OUTLINE_DRAWING) + free(k->u.drawing.text); free(key); free(value); } -void *cache_add_glyph(Hashmap *glyph_cache, GlyphHashKey *key, - GlyphHashValue *val) -{ - if (val->glyph && val->glyph->format == FT_GLYPH_FORMAT_BITMAP) { - FT_Bitmap *bitmap = &((FT_BitmapGlyph) val->glyph)->bitmap; - glyph_cache->cache_size += bitmap->rows * bitmap->pitch; - } - return hashmap_insert(glyph_cache, key, val); + +// Cache data +typedef struct cache_item { + void *key; + void *value; + struct cache_item *next; +} CacheItem; + +struct cache { + unsigned buckets; + CacheItem **map; + + HashFunction hash_func; + ItemSize size_func; + HashCompare compare_func; + CacheItemDestructor destruct_func; + size_t key_size; + size_t value_size; + + size_t cache_size; + unsigned hits; + unsigned misses; + unsigned items; +}; + +// Hash for a simple (single value or array) type +static unsigned hash_simple(void *key, size_t key_size) +{ + return fnv_32a_buf(key, key_size, FNV1_32A_INIT); } -/** - * \brief Get a glyph from glyph cache. - * \param key hash key - * \return requested hash val or 0 if not found -*/ -GlyphHashValue *cache_find_glyph(Hashmap *glyph_cache, - GlyphHashKey *key) +// Comparison of a simple type +static unsigned compare_simple(void *a, void *b, size_t key_size) { - return hashmap_find(glyph_cache, key); + return memcmp(a, b, key_size) == 0; } -Hashmap *ass_glyph_cache_init(ASS_Library *library) +// Default destructor +static void destruct_simple(void *key, void *value) { - Hashmap *glyph_cache; - glyph_cache = hashmap_init(library, sizeof(GlyphHashKey), - sizeof(GlyphHashValue), - 0xFFFF + 13, - glyph_hash_dtor, glyph_compare, glyph_hash); - return glyph_cache; + free(key); + free(value); } -void ass_glyph_cache_done(Hashmap *glyph_cache) + +// Create a cache with type-specific hash/compare/destruct/size functions +Cache *ass_cache_create(HashFunction hash_func, HashCompare compare_func, + CacheItemDestructor destruct_func, ItemSize size_func, + size_t key_size, size_t value_size) { - hashmap_done(glyph_cache); + Cache *cache = calloc(1, sizeof(*cache)); + cache->buckets = 0xFFFF; + cache->hash_func = hash_simple; + cache->compare_func = compare_simple; + cache->destruct_func = destruct_simple; + cache->size_func = size_func; + if (hash_func) + cache->hash_func = hash_func; + if (compare_func) + cache->compare_func = compare_func; + if (destruct_func) + cache->destruct_func = destruct_func; + cache->key_size = key_size; + cache->value_size = value_size; + cache->map = calloc(cache->buckets, sizeof(CacheItem *)); + + return cache; } -Hashmap *ass_glyph_cache_reset(Hashmap *glyph_cache) +void *ass_cache_put(Cache *cache, void *key, void *value) { - ASS_Library *lib = glyph_cache->library; + unsigned bucket = cache->hash_func(key, cache->key_size) % cache->buckets; + CacheItem **item = &cache->map[bucket]; + while (*item) + item = &(*item)->next; + (*item) = calloc(1, sizeof(CacheItem)); + (*item)->key = malloc(cache->key_size); + (*item)->value = malloc(cache->value_size); + memcpy((*item)->key, key, cache->key_size); + memcpy((*item)->value, value, cache->value_size); - ass_glyph_cache_done(glyph_cache); - return ass_glyph_cache_init(lib); + cache->items++; + if (cache->size_func) + cache->cache_size += cache->size_func(value, cache->value_size); + else + cache->cache_size++; + + return (*item)->value; } +void *ass_cache_get(Cache *cache, void *key) +{ + unsigned bucket = cache->hash_func(key, cache->key_size) % cache->buckets; + CacheItem *item = cache->map[bucket]; + while (item) { + if (cache->compare_func(key, item->key, cache->key_size)) { + cache->hits++; + return item->value; + } + item = item->next; + } + cache->misses++; + return NULL; +} -//--------------------------------- -// composite cache +int ass_cache_empty(Cache *cache, size_t max_size) +{ + int i; -static void composite_hash_dtor(void *key, size_t key_size, void *value, - size_t value_size) + if (cache->cache_size < max_size) + return 0; + + for (i = 0; i < cache->buckets; i++) { + CacheItem *item = cache->map[i]; + while (item) { + CacheItem *next = item->next; + cache->destruct_func(item->key, item->value); + free(item); + item = next; + } + cache->map[i] = NULL; + } + + cache->items = cache->hits = cache->misses = cache->cache_size = 0; + + return 1; +} + +void ass_cache_stats(Cache *cache, size_t *size, unsigned *hits, + unsigned *misses, unsigned *count) { - CompositeHashValue *v = value; - free(v->a); - free(v->b); - free(key); - free(value); + if (size) + *size = cache->cache_size; + if (hits) + *hits = cache->hits; + if (misses) + *misses = cache->misses; + if (count) + *count = cache->items; } -void *cache_add_composite(Hashmap *composite_cache, - CompositeHashKey *key, - CompositeHashValue *val) +void ass_cache_done(Cache *cache) { - return hashmap_insert(composite_cache, key, val); + ass_cache_empty(cache, 0); + free(cache->map); + free(cache); } -/** - * \brief Get a composite bitmap from composite cache. - * \param key hash key - * \return requested hash val or 0 if not found -*/ -CompositeHashValue *cache_find_composite(Hashmap *composite_cache, - CompositeHashKey *key) +// Type-specific creation function +Cache *ass_font_cache_create(void) { - return hashmap_find(composite_cache, key); + return ass_cache_create(font_hash, font_compare, font_destruct, + (ItemSize)NULL, sizeof(ASS_FontDesc), sizeof(ASS_Font)); } -Hashmap *ass_composite_cache_init(ASS_Library *library) +Cache *ass_outline_cache_create(void) { - Hashmap *composite_cache; - composite_cache = hashmap_init(library, sizeof(CompositeHashKey), - sizeof(CompositeHashValue), - 0xFFFF + 13, - composite_hash_dtor, composite_compare, - composite_hash); - return composite_cache; + return ass_cache_create(outline_hash, outline_compare, outline_destruct, + NULL, sizeof(OutlineHashKey), sizeof(OutlineHashValue)); } -void ass_composite_cache_done(Hashmap *composite_cache) +Cache *ass_glyph_metrics_cache_create(void) { - hashmap_done(composite_cache); + return ass_cache_create(glyph_metrics_hash, glyph_metrics_compare, NULL, + (ItemSize) NULL, sizeof(GlyphMetricsHashKey), + sizeof(GlyphMetricsHashValue)); } -Hashmap *ass_composite_cache_reset(Hashmap *composite_cache) +Cache *ass_bitmap_cache_create(void) { - ASS_Library *lib = composite_cache->library; + return ass_cache_create(bitmap_hash, bitmap_compare, bitmap_destruct, + bitmap_size, sizeof(BitmapHashKey), sizeof(BitmapHashValue)); +} - ass_composite_cache_done(composite_cache); - return ass_composite_cache_init(lib); +Cache *ass_composite_cache_create(void) +{ + return ass_cache_create(composite_hash, composite_compare, + composite_destruct, (ItemSize)NULL, sizeof(CompositeHashKey), + sizeof(CompositeHashValue)); } Modified: trunk/libass/ass_cache.h ============================================================================== --- trunk/libass/ass_cache.h Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass_cache.h Sat Dec 3 22:35:56 2011 (r34383) @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 Evgeniy Stepanov + * Copyright (C) 2011 Grigori Goronzy * * This file is part of libass. * @@ -23,51 +24,9 @@ #include "ass_font.h" #include "ass_bitmap.h" -typedef void (*HashmapItemDtor) (void *key, size_t key_size, - void *value, size_t value_size); -typedef int (*HashmapKeyCompare) (void *key1, void *key2, - size_t key_size); -typedef unsigned (*HashmapHash) (void *key, size_t key_size); - -typedef struct hashmap_item { - void *key; - void *value; - struct hashmap_item *next; -} HashmapItem; -typedef HashmapItem *hashmap_item_p; - -typedef struct { - int nbuckets; - size_t key_size, value_size; - hashmap_item_p *root; - HashmapItemDtor item_dtor; // a destructor for hashmap key/value pairs - HashmapKeyCompare key_compare; - HashmapHash hash; - size_t cache_size; - // stats - int hit_count; - int miss_count; - int count; - ASS_Library *library; -} Hashmap; - -Hashmap *hashmap_init(ASS_Library *library, size_t key_size, - size_t value_size, int nbuckets, - HashmapItemDtor item_dtor, - HashmapKeyCompare key_compare, - HashmapHash hash); -void hashmap_done(Hashmap *map); -void *hashmap_insert(Hashmap *map, void *key, void *value); -void *hashmap_find(Hashmap *map, void *key); - -Hashmap *ass_font_cache_init(ASS_Library *library); -ASS_Font *ass_font_cache_find(Hashmap *, ASS_FontDesc *desc); -void *ass_font_cache_add(Hashmap *, ASS_Font *font); -void ass_font_cache_done(Hashmap *); +typedef struct cache Cache; -// Create definitions for bitmap_hash_key and glyph_hash_key -#define CREATE_STRUCT_DEFINITIONS -#include "ass_cache_template.h" +// cache values typedef struct { Bitmap *bm; // the actual bitmaps @@ -75,43 +34,71 @@ typedef struct { Bitmap *bm_s; } BitmapHashValue; -Hashmap *ass_bitmap_cache_init(ASS_Library *library); -void *cache_add_bitmap(Hashmap *, BitmapHashKey *key, - BitmapHashValue *val); -BitmapHashValue *cache_find_bitmap(Hashmap *bitmap_cache, - BitmapHashKey *key); -Hashmap *ass_bitmap_cache_reset(Hashmap *bitmap_cache); -void ass_bitmap_cache_done(Hashmap *bitmap_cache); - - typedef struct { unsigned char *a; unsigned char *b; } CompositeHashValue; -Hashmap *ass_composite_cache_init(ASS_Library *library); -void *cache_add_composite(Hashmap *, CompositeHashKey *key, - CompositeHashValue *val); -CompositeHashValue *cache_find_composite(Hashmap *composite_cache, - CompositeHashKey *key); -Hashmap *ass_composite_cache_reset(Hashmap *composite_cache); -void ass_composite_cache_done(Hashmap *composite_cache); - - typedef struct { - FT_Glyph glyph; - FT_Glyph outline_glyph; + FT_Library lib; + FT_Outline *outline; + FT_Outline *border; FT_BBox bbox_scaled; // bbox after scaling, but before rotation - FT_Vector advance; // 26.6, advance distance to the next bitmap in line - int asc, desc; // ascender/descender of a drawing -} GlyphHashValue; + FT_Vector advance; // 26.6, advance distance to the next outline in line + int asc, desc; // ascender/descender +} OutlineHashValue; -Hashmap *ass_glyph_cache_init(ASS_Library *library); -void *cache_add_glyph(Hashmap *, GlyphHashKey *key, - GlyphHashValue *val); -GlyphHashValue *cache_find_glyph(Hashmap *glyph_cache, - GlyphHashKey *key); -Hashmap *ass_glyph_cache_reset(Hashmap *glyph_cache); -void ass_glyph_cache_done(Hashmap *glyph_cache); +typedef struct { + FT_Glyph_Metrics metrics; +} GlyphMetricsHashValue; + +// Create definitions for bitmap, outline and composite hash keys +#define CREATE_STRUCT_DEFINITIONS +#include "ass_cache_template.h" + +// Type-specific function pointers +typedef unsigned(*HashFunction)(void *key, size_t key_size); +typedef size_t(*ItemSize)(void *value, size_t value_size); +typedef unsigned(*HashCompare)(void *a, void *b, size_t key_size); +typedef void(*CacheItemDestructor)(void *key, void *value); + +// cache hash keys + +typedef struct outline_hash_key { + enum { + OUTLINE_GLYPH, + OUTLINE_DRAWING, + } type; + union { + GlyphHashKey glyph; + DrawingHashKey drawing; + } u; +} OutlineHashKey; + +typedef struct bitmap_hash_key { + enum { + BITMAP_OUTLINE, + BITMAP_CLIP, + } type; + union { + OutlineBitmapHashKey outline; + ClipMaskHashKey clip; + } u; +} BitmapHashKey; + +Cache *ass_cache_create(HashFunction hash_func, HashCompare compare_func, + CacheItemDestructor destruct_func, ItemSize size_func, + size_t key_size, size_t value_size); +void *ass_cache_put(Cache *cache, void *key, void *value); +void *ass_cache_get(Cache *cache, void *key); +int ass_cache_empty(Cache *cache, size_t max_size); +void ass_cache_stats(Cache *cache, size_t *size, unsigned *hits, + unsigned *misses, unsigned *count); +void ass_cache_done(Cache *cache); +Cache *ass_font_cache_create(void); +Cache *ass_outline_cache_create(void); +Cache *ass_glyph_metrics_cache_create(void); +Cache *ass_bitmap_cache_create(void); +Cache *ass_composite_cache_create(void); #endif /* LIBASS_CACHE_H */ Modified: trunk/libass/ass_cache_template.h ============================================================================== --- trunk/libass/ass_cache_template.h Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass_cache_template.h Sat Dec 3 22:35:56 2011 (r34383) @@ -4,6 +4,8 @@ typedef struct structname { #define GENERIC(type, member) \ type member; +#define STRING(member) \ + char *member; #define FTVECTOR(member) \ FT_Vector member; #define BITMAPHASHKEY(member) \ @@ -14,13 +16,15 @@ #elif defined(CREATE_COMPARISON_FUNCTIONS) #undef CREATE_COMPARISON_FUNCTIONS #define START(funcname, structname) \ - static int funcname##_compare(void *key1, void *key2, size_t key_size) \ + static unsigned funcname##_compare(void *key1, void *key2, size_t key_size) \ { \ struct structname *a = key1; \ struct structname *b = key2; \ return // conditions follow #define GENERIC(type, member) \ a->member == b->member && +#define STRING(member) \ + strcmp(a->member, b->member) == 0 && #define FTVECTOR(member) \ a->member.x == b->member.x && a->member.y == b->member.y && #define BITMAPHASHKEY(member) \ @@ -38,6 +42,8 @@ unsigned hval = FNV1_32A_INIT; #define GENERIC(type, member) \ hval = fnv_32a_buf(&p->member, sizeof(p->member), hval); +#define STRING(member) \ + hval = fnv_32a_str(p->member, hval); #define FTVECTOR(member) GENERIC(, member.x); GENERIC(, member.y); #define BITMAPHASHKEY(member) { \ unsigned temp = bitmap_hash(&p->member, sizeof(p->member)); \ @@ -53,19 +59,11 @@ -// describes a bitmap; bitmaps with equivalents structs are considered identical -START(bitmap, bitmap_hash_key) - GENERIC(char, bitmap) // bool : true = bitmap, false = outline - GENERIC(ASS_Font *, font) - GENERIC(double, size) // font size - GENERIC(uint32_t, ch) // character code - FTVECTOR(outline) // border width, 16.16 fixed point value - GENERIC(int, bold) - GENERIC(int, italic) +// describes an outline bitmap +START(outline_bitmap, outline_bitmap_hash_key) + GENERIC(OutlineHashValue *, outline) GENERIC(char, be) // blur edges GENERIC(double, blur) // gaussian blur - GENERIC(unsigned, scale_x) // 16.16 - GENERIC(unsigned, scale_y) // 16.16 GENERIC(int, frx) // signed 16.16 GENERIC(int, fry) // signed 16.16 GENERIC(int, frz) // signed 16.16 @@ -78,26 +76,49 @@ START(bitmap, bitmap_hash_key) GENERIC(int, shift_y) FTVECTOR(advance) // subpixel shift vector FTVECTOR(shadow_offset) // shadow subpixel shift - GENERIC(unsigned, drawing_hash) // hashcode of a drawing - GENERIC(unsigned, flags) // glyph decoration - GENERIC(unsigned, border_style) -END(BitmapHashKey) +END(OutlineBitmapHashKey) + +// describe a clip mask bitmap +START(clip_bitmap, clip_bitmap_hash_key) + STRING(text) +END(ClipMaskHashKey) // describes an outline glyph START(glyph, glyph_hash_key) GENERIC(ASS_Font *, font) GENERIC(double, size) // font size - GENERIC(uint32_t, ch) // character code + GENERIC(int, face_index) + GENERIC(int, glyph_index) GENERIC(int, bold) GENERIC(int, italic) GENERIC(unsigned, scale_x) // 16.16 GENERIC(unsigned, scale_y) // 16.16 FTVECTOR(outline) // border width, 16.16 - GENERIC(unsigned, drawing_hash) // hashcode of a drawing GENERIC(unsigned, flags) // glyph decoration flags GENERIC(unsigned, border_style) END(GlyphHashKey) +START(glyph_metrics, glyph_metrics_hash_key) + GENERIC(ASS_Font *, font) + GENERIC(double, size) + GENERIC(int, face_index) + GENERIC(int, glyph_index) + GENERIC(unsigned, scale_x) + GENERIC(unsigned, scale_y) +END(GlyphMetricsHashKey) + +// describes an outline drawing +START(drawing, drawing_hash_key) + GENERIC(unsigned, scale_x) + GENERIC(unsigned, scale_y) + GENERIC(int, pbo) + FTVECTOR(outline) + GENERIC(unsigned, border_style) + GENERIC(int, scale) + GENERIC(unsigned, hash) + STRING(text) +END(DrawingHashKey) + // Cache for composited bitmaps START(composite, composite_hash_key) GENERIC(int, aw) @@ -117,6 +138,7 @@ END(CompositeHashKey) #undef START #undef GENERIC +#undef STRING #undef FTVECTOR #undef BITMAPHASHKEY #undef END Modified: trunk/libass/ass_drawing.c ============================================================================== --- trunk/libass/ass_drawing.c Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass_drawing.c Sat Dec 3 22:35:56 2011 (r34383) @@ -17,13 +17,11 @@ */ #include -#include FT_GLYPH_H #include FT_OUTLINE_H #include FT_BBOX_H #include #include "ass_utils.h" -#include "ass_font.h" #include "ass_drawing.h" #define CURVE_ACCURACY 64.0 @@ -31,35 +29,12 @@ #define GLYPH_INITIAL_CONTOURS 5 /* - * \brief Get and prepare a FreeType glyph - */ -static void drawing_make_glyph(ASS_Drawing *drawing, void *fontconfig_priv, - ASS_Font *font) -{ - FT_OutlineGlyph glyph; - - // This is hacky... - glyph = (FT_OutlineGlyph) ass_font_get_glyph(fontconfig_priv, font, - (uint32_t) ' ', 0, 0); - if (glyph) { - FT_Outline_Done(drawing->ftlibrary, &glyph->outline); - FT_Outline_New(drawing->ftlibrary, GLYPH_INITIAL_POINTS, - GLYPH_INITIAL_CONTOURS, &glyph->outline); - - glyph->outline.n_contours = 0; - glyph->outline.n_points = 0; - glyph->root.advance.x = glyph->root.advance.y = 0; - } - drawing->glyph = glyph; -} - -/* * \brief Add a single point to a contour. */ static inline void drawing_add_point(ASS_Drawing *drawing, FT_Vector *point) { - FT_Outline *ol = &drawing->glyph->outline; + FT_Outline *ol = &drawing->outline; if (ol->n_points >= drawing->max_points) { drawing->max_points *= 2; @@ -75,11 +50,11 @@ static inline void drawing_add_point(ASS } /* - * \brief Close a contour and check glyph size overflow. + * \brief Close a contour and check outline size overflow. */ static inline void drawing_close_shape(ASS_Drawing *drawing) { - FT_Outline *ol = &drawing->glyph->outline; + FT_Outline *ol = &drawing->outline; if (ol->n_contours >= drawing->max_contours) { drawing->max_contours *= 2; @@ -107,13 +82,13 @@ static void drawing_prepare(ASS_Drawing /* * \brief Finish a drawing. This only sets the horizontal advance according - * to the glyph's bbox at the moment. + * to the outline's bbox at the moment. */ static void drawing_finish(ASS_Drawing *drawing, int raw_mode) { int i, offset; FT_BBox bbox = drawing->cbox; - FT_Outline *ol = &drawing->glyph->outline; + FT_Outline *ol = &drawing->outline; // Close the last contour drawing_close_shape(drawing); @@ -126,7 +101,7 @@ static void drawing_finish(ASS_Drawing * if (raw_mode) return; - drawing->glyph->root.advance.x = d6_to_d16(bbox.xMax - bbox.xMin); + drawing->advance.x = bbox.xMax - bbox.xMin; drawing->desc = double_to_d6(-drawing->pbo * drawing->scale_y); drawing->asc = bbox.yMax - bbox.yMin + drawing->desc; @@ -355,8 +330,7 @@ static void drawing_evaluate_curve(ASS_D /* * \brief Create and initialize a new drawing and return it */ -ASS_Drawing *ass_drawing_new(void *fontconfig_priv, ASS_Font *font, - FT_Library lib) +ASS_Drawing *ass_drawing_new(ASS_Library *lib, FT_Library ftlib) { ASS_Drawing *drawing; @@ -365,17 +339,18 @@ ASS_Drawing *ass_drawing_new(void *fontc drawing->size = DRAWING_INITIAL_SIZE; drawing->cbox.xMin = drawing->cbox.yMin = INT_MAX; drawing->cbox.xMax = drawing->cbox.yMax = INT_MIN; - drawing->fontconfig_priv = fontconfig_priv; - drawing->font = font; - drawing->ftlibrary = lib; - if (font) - drawing->library = font->library; - + drawing->ftlibrary = ftlib; + drawing->library = lib; drawing->scale_x = 1.; drawing->scale_y = 1.; drawing->max_contours = GLYPH_INITIAL_CONTOURS; drawing->max_points = GLYPH_INITIAL_POINTS; + FT_Outline_New(drawing->ftlibrary, GLYPH_INITIAL_POINTS, + GLYPH_INITIAL_CONTOURS, &drawing->outline); + drawing->outline.n_contours = 0; + drawing->outline.n_points = 0; + return drawing; } @@ -386,6 +361,7 @@ void ass_drawing_free(ASS_Drawing* drawi { if (drawing) { free(drawing->text); + FT_Outline_Done(drawing->ftlibrary, &drawing->outline); } free(drawing); } @@ -416,17 +392,12 @@ void ass_drawing_hash(ASS_Drawing* drawi /* * \brief Convert token list to outline. Calls the line and curve evaluators. */ -FT_OutlineGlyph *ass_drawing_parse(ASS_Drawing *drawing, int raw_mode) +FT_Outline *ass_drawing_parse(ASS_Drawing *drawing, int raw_mode) { int started = 0; ASS_DrawingToken *token; FT_Vector pen = {0, 0}; - if (drawing->font) - drawing_make_glyph(drawing, drawing->fontconfig_priv, drawing->font); - if (!drawing->glyph) - return NULL; - drawing->tokens = drawing_tokenize(drawing->text); drawing_prepare(drawing); @@ -486,5 +457,5 @@ FT_OutlineGlyph *ass_drawing_parse(ASS_D drawing_finish(drawing, raw_mode); drawing_free_tokens(drawing->tokens); - return &drawing->glyph; + return &drawing->outline; } Modified: trunk/libass/ass_drawing.h ============================================================================== --- trunk/libass/ass_drawing.h Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass_drawing.h Sat Dec 3 22:35:56 2011 (r34383) @@ -20,7 +20,7 @@ #define LIBASS_DRAWING_H #include -#include FT_GLYPH_H +#include FT_OUTLINE_H #include "ass.h" @@ -53,13 +53,12 @@ typedef struct { double scale_y; // FontScaleY int asc; // ascender int desc; // descender - FT_OutlineGlyph glyph; // the "fake" glyph created for later rendering + FT_Outline outline; // target outline + FT_Vector advance; // advance (from cbox) int hash; // hash value (for caching) // private FT_Library ftlibrary; // needed for font ops - ASS_Font *font; // dito - void *fontconfig_priv; // dito ASS_Library *library; int size; // current buffer size ASS_DrawingToken *tokens; // tokenized drawing @@ -70,11 +69,10 @@ typedef struct { FT_BBox cbox; // bounding box, or let's say... VSFilter's idea of it } ASS_Drawing; -ASS_Drawing *ass_drawing_new(void *fontconfig_priv, ASS_Font *font, - FT_Library lib); +ASS_Drawing *ass_drawing_new(ASS_Library *lib, FT_Library ftlib); void ass_drawing_free(ASS_Drawing* drawing); void ass_drawing_add_char(ASS_Drawing* drawing, char symbol); void ass_drawing_hash(ASS_Drawing* drawing); -FT_OutlineGlyph *ass_drawing_parse(ASS_Drawing *drawing, int raw_mode); +FT_Outline *ass_drawing_parse(ASS_Drawing *drawing, int raw_mode); #endif /* LIBASS_DRAWING_H */ Modified: trunk/libass/ass_font.c ============================================================================== --- trunk/libass/ass_font.c Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass_font.c Sat Dec 3 22:35:56 2011 (r34383) @@ -30,12 +30,9 @@ #include "ass.h" #include "ass_library.h" #include "ass_font.h" -#include "ass_bitmap.h" -#include "ass_cache.h" #include "ass_fontconfig.h" #include "ass_utils.h" - -#define VERTICAL_LOWER_BOUND 0x02f1 +#include "ass_shaper.h" /** * Select a good charmap, prefer Microsoft Unicode charmaps. @@ -91,8 +88,6 @@ static int find_font(ASS_Library *librar return -1; } -static void face_set_size(FT_Face face, double size); - static void buggy_font_workaround(FT_Face face) { // Some fonts have zero Ascender/Descender fields in 'hhea' table. @@ -161,7 +156,7 @@ static int add_face(void *fc_priv, ASS_F buggy_font_workaround(face); font->faces[font->n_faces++] = face; - face_set_size(face, font->size); + ass_face_set_size(face, font->size); free(path); return font->n_faces - 1; } @@ -169,7 +164,7 @@ static int add_face(void *fc_priv, ASS_F /** * \brief Create a new ASS_Font according to "desc" argument */ -ASS_Font *ass_font_new(void *font_cache, ASS_Library *library, +ASS_Font *ass_font_new(Cache *font_cache, ASS_Library *library, FT_Library ftlibrary, void *fc_priv, ASS_FontDesc *desc) { @@ -177,12 +172,13 @@ ASS_Font *ass_font_new(void *font_cache, ASS_Font *fontp; ASS_Font font; - fontp = ass_font_cache_find((Hashmap *) font_cache, desc); + fontp = ass_cache_get(font_cache, desc); if (fontp) return fontp; font.library = library; font.ftlibrary = ftlibrary; + font.shaper_priv = NULL; font.n_faces = 0; font.desc.family = strdup(desc->family); font.desc.treat_family_as_pattern = desc->treat_family_as_pattern; @@ -199,7 +195,7 @@ ASS_Font *ass_font_new(void *font_cache, free(font.desc.family); return 0; } else - return ass_font_cache_add((Hashmap *) font_cache, &font); + return ass_cache_put(font_cache, &font.desc, &font); } /** @@ -216,7 +212,7 @@ void ass_font_set_transform(ASS_Font *fo } } -static void face_set_size(FT_Face face, double size) +void ass_face_set_size(FT_Face face, double size) { TT_HoriHeader *hori = FT_Get_Sfnt_Table(face, ft_sfnt_hhea); TT_OS2 *os2 = FT_Get_Sfnt_Table(face, ft_sfnt_os2); @@ -251,7 +247,7 @@ void ass_font_set_size(ASS_Font *font, d if (font->size != size) { font->size = size; for (i = 0; i < font->n_faces; ++i) - face_set_size(font->faces[i], size); + ass_face_set_size(font->faces[i], size); } } @@ -276,9 +272,6 @@ void ass_font_get_asc_desc(ASS_Font *fon *asc = FT_MulFix(face->ascender, y_scale); *desc = FT_MulFix(-face->descender, y_scale); } - if (font->desc.vertical && ch >= VERTICAL_LOWER_BOUND) { - *asc = FT_MulFix(face->max_advance_width, y_scale); - } return; } } @@ -388,6 +381,25 @@ static int ass_strike_outline_glyph(FT_F return 0; } +void outline_copy(FT_Library lib, FT_Outline *source, FT_Outline **dest) +{ + if (source == NULL) { + *dest = NULL; + return; + } + *dest = calloc(1, sizeof(**dest)); + + FT_Outline_New(lib, source->n_points, source->n_contours, *dest); + FT_Outline_Copy(source, *dest); +} + +void outline_free(FT_Library lib, FT_Outline *outline) +{ + if (outline) + FT_Outline_Done(lib, outline); + free(outline); +} + /** * Slightly embold a glyph without touching its metrics */ @@ -405,33 +417,43 @@ static void ass_glyph_embolden(FT_GlyphS } /** - * \brief Get a glyph - * \param ch character code - **/ -FT_Glyph ass_font_get_glyph(void *fontconfig_priv, ASS_Font *font, - uint32_t ch, ASS_Hinting hinting, int deco) + * \brief Get glyph and face index + * Finds a face that has the requested codepoint and returns both face + * and glyph index. + */ +int ass_font_get_index(void *fcpriv, ASS_Font *font, uint32_t symbol, + int *face_index, int *glyph_index) { - int error; int index = 0; int i; - FT_Glyph glyph; FT_Face face = 0; - int flags = 0; - int vertical = font->desc.vertical; - if (ch < 0x20) + *glyph_index = 0; + + if (symbol < 0x20) { + *face_index = 0; return 0; + } // Handle NBSP like a regular space when rendering the glyph - if (ch == 0xa0) - ch = ' '; - if (font->n_faces == 0) + if (symbol == 0xa0) + symbol = ' '; + if (font->n_faces == 0) { + *face_index = 0; return 0; + } - for (i = 0; i < font->n_faces; ++i) { + // try with the requested face + if (*face_index < font->n_faces) { + face = font->faces[*face_index]; + index = FT_Get_Char_Index(face, symbol); + } + + // not found in requested face, try all others + for (i = 0; i < font->n_faces && index == 0; ++i) { face = font->faces[i]; - index = FT_Get_Char_Index(face, ch); + index = FT_Get_Char_Index(face, symbol); if (index) - break; + *face_index = i; } #ifdef CONFIG_FONTCONFIG @@ -439,30 +461,50 @@ FT_Glyph ass_font_get_glyph(void *fontco int face_idx; ass_msg(font->library, MSGL_INFO, "Glyph 0x%X not found, selecting one more " - "font for (%s, %d, %d)", ch, font->desc.family, + "font for (%s, %d, %d)", symbol, font->desc.family, font->desc.bold, font->desc.italic); - face_idx = add_face(fontconfig_priv, font, ch); + face_idx = *face_index = add_face(fcpriv, font, symbol); if (face_idx >= 0) { face = font->faces[face_idx]; - index = FT_Get_Char_Index(face, ch); + index = FT_Get_Char_Index(face, symbol); if (index == 0 && face->num_charmaps > 0) { int i; ass_msg(font->library, MSGL_WARN, - "Glyph 0x%X not found, broken font? Trying all charmaps", ch); + "Glyph 0x%X not found, broken font? Trying all charmaps", symbol); for (i = 0; i < face->num_charmaps; i++) { FT_Set_Charmap(face, face->charmaps[i]); - if ((index = FT_Get_Char_Index(face, ch)) != 0) break; + if ((index = FT_Get_Char_Index(face, symbol)) != 0) break; } } if (index == 0) { ass_msg(font->library, MSGL_ERR, "Glyph 0x%X not found in font for (%s, %d, %d)", - ch, font->desc.family, font->desc.bold, + symbol, font->desc.family, font->desc.bold, font->desc.italic); } } } #endif + // FIXME: make sure we have a valid face_index. this is a HACK. + *face_index = FFMAX(*face_index, 0); + *glyph_index = index; + + return 1; +} + +/** + * \brief Get a glyph + * \param ch character code + **/ +FT_Glyph ass_font_get_glyph(void *fontconfig_priv, ASS_Font *font, + uint32_t ch, int face_index, int index, + ASS_Hinting hinting, int deco) +{ + int error; + FT_Glyph glyph; + FT_Face face = font->faces[face_index]; + int flags = 0; + int vertical = font->desc.vertical; flags = FT_LOAD_NO_BITMAP | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH | FT_LOAD_IGNORE_TRANSFORM; @@ -505,10 +547,16 @@ FT_Glyph ass_font_get_glyph(void *fontco // Rotate glyph, if needed if (vertical && ch >= VERTICAL_LOWER_BOUND) { FT_Matrix m = { 0, double_to_d16(-1.0), double_to_d16(1.0), 0 }; + TT_OS2 *os2 = FT_Get_Sfnt_Table(face, ft_sfnt_os2); + int desc = 0; + + if (os2) + desc = FT_MulFix(os2->sTypoDescender, face->size->metrics.y_scale); + + FT_Outline_Translate(&((FT_OutlineGlyph) glyph)->outline, 0, -desc); FT_Outline_Transform(&((FT_OutlineGlyph) glyph)->outline, &m); FT_Outline_Translate(&((FT_OutlineGlyph) glyph)->outline, - face->glyph->metrics.vertAdvance, - 0); + face->glyph->metrics.vertAdvance, desc); glyph->advance.x = face->glyph->linearVertAdvance; } @@ -561,6 +609,8 @@ void ass_font_free(ASS_Font *font) for (i = 0; i < font->n_faces; ++i) if (font->faces[i]) FT_Done_Face(font->faces[i]); + if (font->shaper_priv) + ass_shaper_font_data_free(font->shaper_priv); free(font->desc.family); free(font); } @@ -618,9 +668,9 @@ static int get_contour_direction(FT_Vect * \param border_x border size, x direction, d6 format * \param border_x border size, y direction, d6 format */ -void fix_freetype_stroker(FT_OutlineGlyph glyph, int border_x, int border_y) +void fix_freetype_stroker(FT_Outline *outline, int border_x, int border_y) { - int nc = glyph->outline.n_contours; + int nc = outline->n_contours; int begin, stop; char modified = 0; char *valid_cont = malloc(nc); @@ -630,14 +680,14 @@ void fix_freetype_stroker(FT_OutlineGlyp int i, j; int inside_direction; - inside_direction = FT_Outline_Get_Orientation(&glyph->outline) == + inside_direction = FT_Outline_Get_Orientation(outline) == FT_ORIENTATION_TRUETYPE; // create a list of cboxes of the contours for (i = 0; i < nc; i++) { start = end + 1; - end = glyph->outline.contours[i]; - get_contour_cbox(&boxes[i], glyph->outline.points, start, end); + end = outline->contours[i]; + get_contour_cbox(&boxes[i], outline->points, start, end); } // for each contour, check direction and whether it's "outside" @@ -645,8 +695,8 @@ void fix_freetype_stroker(FT_OutlineGlyp end = -1; for (i = 0; i < nc; i++) { start = end + 1; - end = glyph->outline.contours[i]; - int dir = get_contour_direction(glyph->outline.points, start, end); + end = outline->contours[i]; + int dir = get_contour_direction(outline->points, start, end); valid_cont[i] = 1; if (dir == inside_direction) { for (j = 0; j < nc; j++) { @@ -662,19 +712,19 @@ void fix_freetype_stroker(FT_OutlineGlyp * inside of - assume the font is buggy and it should be * an "outside" contour, and reverse it */ for (j = 0; j < (end + 1 - start) / 2; j++) { - FT_Vector temp = glyph->outline.points[start + j]; - char temp2 = glyph->outline.tags[start + j]; - glyph->outline.points[start + j] = glyph->outline.points[end - j]; - glyph->outline.points[end - j] = temp; - glyph->outline.tags[start + j] = glyph->outline.tags[end - j]; - glyph->outline.tags[end - j] = temp2; + FT_Vector temp = outline->points[start + j]; + char temp2 = outline->tags[start + j]; + outline->points[start + j] = outline->points[end - j]; + outline->points[end - j] = temp; + outline->tags[start + j] = outline->tags[end - j]; + outline->tags[end - j] = temp2; } dir ^= 1; } check_inside: if (dir == inside_direction) { FT_BBox box; - get_contour_cbox(&box, glyph->outline.points, start, end); + get_contour_cbox(&box, outline->points, start, end); int width = box.xMax - box.xMin; int height = box.yMax - box.yMin; if (width < border_x * 2 || height < border_y * 2) { @@ -687,13 +737,12 @@ void fix_freetype_stroker(FT_OutlineGlyp // if we need to modify the outline, rewrite it and skip // the contours that we determined should be removed. if (modified) { - FT_Outline *outline = &glyph->outline; int p = 0, c = 0; for (i = 0; i < nc; i++) { if (!valid_cont[i]) continue; - begin = (i == 0) ? 0 : glyph->outline.contours[i - 1] + 1; - stop = glyph->outline.contours[i]; + begin = (i == 0) ? 0 : outline->contours[i - 1] + 1; + stop = outline->contours[i]; for (j = begin; j <= stop; j++) { outline->points[p].x = outline->points[j].x; outline->points[p].y = outline->points[j].y; Modified: trunk/libass/ass_font.h ============================================================================== --- trunk/libass/ass_font.h Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass_font.h Sat Dec 3 22:35:56 2011 (r34383) @@ -22,13 +22,19 @@ #include #include #include FT_GLYPH_H +#include FT_OUTLINE_H + #include "ass.h" #include "ass_types.h" +#define VERTICAL_LOWER_BOUND 0x02f1 + #define ASS_FONT_MAX_FACES 10 #define DECO_UNDERLINE 1 #define DECO_STRIKETHROUGH 2 +typedef struct ass_shaper_font_data ASS_ShaperFontData; + typedef struct { char *family; unsigned bold; @@ -42,25 +48,33 @@ typedef struct { ASS_Library *library; FT_Library ftlibrary; FT_Face faces[ASS_FONT_MAX_FACES]; + ASS_ShaperFontData *shaper_priv; int n_faces; double scale_x, scale_y; // current transform FT_Vector v; // current shift double size; } ASS_Font; -// FIXME: passing the hashmap via a void pointer is very ugly. -ASS_Font *ass_font_new(void *font_cache, ASS_Library *library, +#include "ass_cache.h" + +ASS_Font *ass_font_new(Cache *font_cache, ASS_Library *library, FT_Library ftlibrary, void *fc_priv, ASS_FontDesc *desc); void ass_font_set_transform(ASS_Font *font, double scale_x, double scale_y, FT_Vector *v); +void ass_face_set_size(FT_Face face, double size); void ass_font_set_size(ASS_Font *font, double size); void ass_font_get_asc_desc(ASS_Font *font, uint32_t ch, int *asc, int *desc); +int ass_font_get_index(void *fcpriv, ASS_Font *font, uint32_t symbol, + int *face_index, int *glyph_index); FT_Glyph ass_font_get_glyph(void *fontconfig_priv, ASS_Font *font, - uint32_t ch, ASS_Hinting hinting, int flags); + uint32_t ch, int face_index, int index, + ASS_Hinting hinting, int deco); FT_Vector ass_font_get_kerning(ASS_Font *font, uint32_t c1, uint32_t c2); void ass_font_free(ASS_Font *font); -void fix_freetype_stroker(FT_OutlineGlyph glyph, int border_x, int border_y); +void fix_freetype_stroker(FT_Outline *outline, int border_x, int border_y); +void outline_copy(FT_Library lib, FT_Outline *source, FT_Outline **dest); +void outline_free(FT_Library lib, FT_Outline *outline); #endif /* LIBASS_FONT_H */ Modified: trunk/libass/ass_library.c ============================================================================== --- trunk/libass/ass_library.c Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass_library.c Sat Dec 3 22:35:56 2011 (r34383) @@ -78,6 +78,7 @@ void ass_set_style_overrides(ASS_Library free(*p); } free(priv->style_overrides); + priv->style_overrides = NULL; if (!list) return; Modified: trunk/libass/ass_parse.c ============================================================================== --- trunk/libass/ass_parse.c Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass_parse.c Sat Dec 3 22:35:56 2011 (r34383) @@ -47,17 +47,18 @@ static inline int mystrcmp(char **p, con return 0; } -static void change_font_size(ASS_Renderer *render_priv, double sz) +double ensure_font_size(ASS_Renderer *priv, double size) { - double size = sz * render_priv->font_scale; - if (size < 1) size = 1; - else if (size > render_priv->height * 2) - size = render_priv->height * 2; + else if (size > priv->height * 2) + size = priv->height * 2; - ass_font_set_size(render_priv->state.font, size); + return size; +} +static void change_font_size(ASS_Renderer *render_priv, double sz) +{ render_priv->state.font_size = sz; } @@ -189,17 +190,18 @@ interpolate_alpha(long long now, long lo { unsigned a; double cf; - if (now <= t1) { + + if (now < t1) { a = a1; } else if (now >= t4) { a = a3; - } else if (now < t2) { // and > t1 + } else if (now < t2 && t2 > t1) { cf = ((double) (now - t1)) / (t2 - t1); a = a1 * (1 - cf) + a2 * cf; - } else if (now > t3) { + } else if (now >= t3 && t4 > t3) { cf = ((double) (now - t3)) / (t4 - t3); a = a2 * (1 - cf) + a3 * cf; - } else { // t2 <= now <= t3 + } else { // t2 <= now < t3 a = a2; } @@ -216,13 +218,9 @@ static char *parse_vector_clip(ASS_Rende int res = 0; ASS_Drawing *drawing = render_priv->state.clip_drawing; - if (drawing && drawing->glyph) - FT_Done_Glyph((FT_Glyph) drawing->glyph); ass_drawing_free(drawing); - render_priv->state.clip_drawing = ass_drawing_new( - render_priv->fontconfig_priv, - render_priv->state.font, - render_priv->ftlibrary); + render_priv->state.clip_drawing = + ass_drawing_new(render_priv->library, render_priv->ftlibrary); drawing = render_priv->state.clip_drawing; skipopt('('); res = mystrtoi(&p, &scale); @@ -259,6 +257,7 @@ static char *parse_tag(ASS_Renderer *ren else val = -1.; change_border(render_priv, val, render_priv->state.border_y); + render_priv->state.bm_run_id++; } else if (mystrcmp(&p, "ybord")) { double val; if (mystrtod(&p, &val)) @@ -273,6 +272,7 @@ static char *parse_tag(ASS_Renderer *ren else val = 0.; render_priv->state.shadow_x = val; + render_priv->state.bm_run_id++; } else if (mystrcmp(&p, "yshad")) { double val; if (mystrtod(&p, &val)) @@ -280,6 +280,7 @@ static char *parse_tag(ASS_Renderer *ren else val = 0.; render_priv->state.shadow_y = val; + render_priv->state.bm_run_id++; } else if (mystrcmp(&p, "fax")) { double val; if (mystrtod(&p, &val)) @@ -331,6 +332,7 @@ static char *parse_tag(ASS_Renderer *ren render_priv->state.blur = val; } else render_priv->state.blur = 0.0; + render_priv->state.bm_run_id++; // ASS standard tags } else if (mystrcmp(&p, "fsc")) { char tp = *p++; @@ -391,6 +393,7 @@ static char *parse_tag(ASS_Renderer *ren } else val = -1.; // reset to default change_border(render_priv, val, val); + render_priv->state.bm_run_id++; } else if (mystrcmp(&p, "move")) { double x1, x2, y1, y2; long long t1, t2, delta_t, t; @@ -492,6 +495,7 @@ static char *parse_tag(ASS_Renderer *ren change_alpha(&render_priv->state.c[3], render_priv->state.style->BackColour, pwr); } + render_priv->state.bm_run_id++; // FIXME: simplify } else if (mystrcmp(&p, "an")) { int val; @@ -682,6 +686,7 @@ static char *parse_tag(ASS_Renderer *ren val = render_priv->state.style->PrimaryColour; ass_msg(render_priv->library, MSGL_DBG2, "color: %X", val); change_color(&render_priv->state.c[0], val, pwr); + render_priv->state.bm_run_id++; } else if ((*p >= '1') && (*p <= '4') && (++p) && (mystrcmp(&p, "c") || mystrcmp(&p, "a"))) { char n = *(p - 2); @@ -711,9 +716,11 @@ static char *parse_tag(ASS_Renderer *ren switch (cmd) { case 'c': change_color(render_priv->state.c + cidx, val, pwr); + render_priv->state.bm_run_id++; break; case 'a': change_alpha(render_priv->state.c + cidx, val >> 24, pwr); + render_priv->state.bm_run_id++; break; default: ass_msg(render_priv->library, MSGL_WARN, "Bad command: %c%c", @@ -733,6 +740,7 @@ static char *parse_tag(ASS_Renderer *ren render_priv->state.be = val; } else render_priv->state.be = 0; + render_priv->state.bm_run_id++; } else if (mystrcmp(&p, "b")) { int b; if (mystrtoi(&p, &b)) { @@ -781,18 +789,21 @@ static char *parse_tag(ASS_Renderer *ren } else val = 0.; render_priv->state.shadow_x = render_priv->state.shadow_y = val; + render_priv->state.bm_run_id++; } else if (mystrcmp(&p, "s")) { int val; if (mystrtoi(&p, &val) && val) render_priv->state.flags |= DECO_STRIKETHROUGH; else render_priv->state.flags &= ~DECO_STRIKETHROUGH; + render_priv->state.bm_run_id++; } else if (mystrcmp(&p, "u")) { int val; if (mystrtoi(&p, &val) && val) render_priv->state.flags |= DECO_UNDERLINE; else render_priv->state.flags &= ~DECO_UNDERLINE; + render_priv->state.bm_run_id++; } else if (mystrcmp(&p, "pbo")) { double val = 0; if (mystrtod(&p, &val)) @@ -809,6 +820,11 @@ static char *parse_tag(ASS_Renderer *ren if (!mystrtoi(&p, &val)) val = render_priv->track->WrapStyle; render_priv->state.wrap_style = val; + } else if (mystrcmp(&p, "fe")) { + int val; + if (!mystrtoi(&p, &val)) + val = render_priv->state.style->Encoding; + render_priv->state.font_encoding = val; } return p; @@ -890,6 +906,77 @@ void apply_transition_effects(ASS_Render } /** + * \brief determine karaoke effects + * Karaoke effects cannot be calculated during parse stage (get_next_char()), + * so they are done in a separate step. + * Parse stage: when karaoke style override is found, its parameters are stored in the next glyph's + * (the first glyph of the karaoke word)'s effect_type and effect_timing. + * This function: + * 1. sets effect_type for all glyphs in the word (_karaoke_ word) + * 2. sets effect_timing for all glyphs to x coordinate of the border line between the left and right karaoke parts + * (left part is filled with PrimaryColour, right one - with SecondaryColour). + */ +void process_karaoke_effects(ASS_Renderer *render_priv) +{ + GlyphInfo *cur, *cur2; + GlyphInfo *s1, *e1; // start and end of the current word + GlyphInfo *s2; // start of the next word + int i; + int timing; // current timing + int tm_start, tm_end; // timings at start and end of the current word + int tm_current; + double dt; + int x; + int x_start, x_end; + + tm_current = render_priv->time - render_priv->state.event->Start; + timing = 0; + s1 = s2 = 0; + for (i = 0; i <= render_priv->text_info.length; ++i) { + cur = render_priv->text_info.glyphs + i; + if ((i == render_priv->text_info.length) + || (cur->effect_type != EF_NONE)) { + s1 = s2; + s2 = cur; + if (s1) { + e1 = s2 - 1; + tm_start = timing + s1->effect_skip_timing; + tm_end = tm_start + s1->effect_timing; + timing = tm_end; + x_start = 1000000; + x_end = -1000000; + for (cur2 = s1; cur2 <= e1; ++cur2) { + x_start = FFMIN(x_start, d6_to_int(cur2->bbox.xMin + cur2->pos.x)); + x_end = FFMAX(x_end, d6_to_int(cur2->bbox.xMax + cur2->pos.x)); + } + + dt = (tm_current - tm_start); + if ((s1->effect_type == EF_KARAOKE) + || (s1->effect_type == EF_KARAOKE_KO)) { + if (dt > 0) + x = x_end + 1; + else + x = x_start; + } else if (s1->effect_type == EF_KARAOKE_KF) { + dt /= (tm_end - tm_start); + x = x_start + (x_end - x_start) * dt; + } else { + ass_msg(render_priv->library, MSGL_ERR, + "Unknown effect type"); + continue; + } + + for (cur2 = s1; cur2 <= e1; ++cur2) { + cur2->effect_type = s1->effect_type; + cur2->effect_timing = x - d6_to_int(cur2->pos.x); + } + } + } + } +} + + +/** * \brief Get next ucs4 char from string, parsing and executing style overrides * \param str string pointer * \return ucs4 code of the next char Modified: trunk/libass/ass_parse.h ============================================================================== --- trunk/libass/ass_parse.h Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass_parse.h Sat Dec 3 22:35:56 2011 (r34383) @@ -27,9 +27,11 @@ #define _a(c) ((c) & 0xFF) void update_font(ASS_Renderer *render_priv); +double ensure_font_size(ASS_Renderer *priv, double size); void change_border(ASS_Renderer *render_priv, double border_x, double border_y); void apply_transition_effects(ASS_Renderer *render_priv, ASS_Event *event); +void process_karaoke_effects(ASS_Renderer *render_priv); unsigned get_next_char(ASS_Renderer *render_priv, char **str); extern void change_alpha(uint32_t *var, uint32_t new, double pwr); extern uint32_t mult_alpha(uint32_t a, uint32_t b); Modified: trunk/libass/ass_render.c ============================================================================== --- trunk/libass/ass_render.c Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass_render.c Sat Dec 3 22:35:56 2011 (r34383) @@ -23,44 +23,13 @@ #include "ass_render.h" #include "ass_parse.h" +#include "ass_shaper.h" #define MAX_GLYPHS_INITIAL 1024 #define MAX_LINES_INITIAL 64 #define SUBPIXEL_MASK 63 #define SUBPIXEL_ACCURACY 7 -static void ass_lazy_track_init(ASS_Renderer *render_priv) -{ - ASS_Track *track = render_priv->track; - - if (track->PlayResX && track->PlayResY) - return; - if (!track->PlayResX && !track->PlayResY) { - ass_msg(render_priv->library, MSGL_WARN, - "Neither PlayResX nor PlayResY defined. Assuming 384x288"); - track->PlayResX = 384; - track->PlayResY = 288; - } else { - if (!track->PlayResY && track->PlayResX == 1280) { - track->PlayResY = 1024; - ass_msg(render_priv->library, MSGL_WARN, - "PlayResY undefined, setting to %d", track->PlayResY); - } else if (!track->PlayResY) { - track->PlayResY = track->PlayResX * 3 / 4; - ass_msg(render_priv->library, MSGL_WARN, - "PlayResY undefined, setting to %d", track->PlayResY); - } else if (!track->PlayResX && track->PlayResY == 1024) { - track->PlayResX = 1280; - ass_msg(render_priv->library, MSGL_WARN, - "PlayResX undefined, setting to %d", track->PlayResX); - } else if (!track->PlayResX) { - track->PlayResX = track->PlayResY * 4 / 3; - ass_msg(render_priv->library, MSGL_WARN, - "PlayResX undefined, setting to %d", track->PlayResX); - } - } -} - ASS_Renderer *ass_renderer_init(ASS_Library *library) { int error; @@ -75,10 +44,8 @@ ASS_Renderer *ass_renderer_init(ASS_Libr } FT_Library_Version(ft, &vmajor, &vminor, &vpatch); - ass_msg(library, MSGL_V, "FreeType library version: %d.%d.%d", + ass_msg(library, MSGL_V, "Raster: FreeType %d.%d.%d", vmajor, vminor, vpatch); - ass_msg(library, MSGL_V, "FreeType headers version: %d.%d.%d", - FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH); priv = calloc(1, sizeof(ASS_Renderer)); if (!priv) { @@ -92,10 +59,10 @@ ASS_Renderer *ass_renderer_init(ASS_Libr priv->ftlibrary = ft; // images_root and related stuff is zero-filled in calloc - priv->cache.font_cache = ass_font_cache_init(library); - priv->cache.bitmap_cache = ass_bitmap_cache_init(library); - priv->cache.composite_cache = ass_composite_cache_init(library); - priv->cache.glyph_cache = ass_glyph_cache_init(library); + priv->cache.font_cache = ass_font_cache_create(); + priv->cache.bitmap_cache = ass_bitmap_cache_create(); + priv->cache.composite_cache = ass_composite_cache_create(); + priv->cache.outline_cache = ass_outline_cache_create(); priv->cache.glyph_max = GLYPH_CACHE_MAX; priv->cache.bitmap_max_size = BITMAP_CACHE_MAX_SIZE; @@ -106,11 +73,19 @@ ASS_Renderer *ass_renderer_init(ASS_Libr priv->settings.font_size_coeff = 1.; + priv->shaper = ass_shaper_new(0); + ass_shaper_info(library); +#ifdef CONFIG_HARFBUZZ + priv->settings.shaper = ASS_SHAPING_COMPLEX; +#else + priv->settings.shaper = ASS_SHAPING_SIMPLE; +#endif + ass_init_exit: if (priv) - ass_msg(library, MSGL_V, "Init"); + ass_msg(library, MSGL_V, "Initialized"); else - ass_msg(library, MSGL_ERR, "Init failed"); + ass_msg(library, MSGL_ERR, "Initialization failed"); return priv; } @@ -131,10 +106,10 @@ static void free_list_clear(ASS_Renderer void ass_renderer_done(ASS_Renderer *render_priv) { - ass_font_cache_done(render_priv->cache.font_cache); - ass_bitmap_cache_done(render_priv->cache.bitmap_cache); - ass_composite_cache_done(render_priv->cache.composite_cache); - ass_glyph_cache_done(render_priv->cache.glyph_cache); + ass_cache_done(render_priv->cache.font_cache); + ass_cache_done(render_priv->cache.bitmap_cache); + ass_cache_done(render_priv->cache.composite_cache); + ass_cache_done(render_priv->cache.outline_cache); ass_free_images(render_priv->images_root); ass_free_images(render_priv->prev_images_root); @@ -149,6 +124,7 @@ void ass_renderer_done(ASS_Renderer *ren fontconfig_done(render_priv->fontconfig_priv); if (render_priv->synth_priv) ass_synth_done(render_priv->synth_priv); + ass_shaper_free(render_priv->shaper); free(render_priv->eimg); free(render_priv->text_info.glyphs); free(render_priv->text_info.lines); @@ -328,18 +304,18 @@ static ASS_Image **render_glyph_i(ASS_Re // split up into left and right for karaoke, if needed if (lbrk > r[j].x0) { if (lbrk > r[j].x1) lbrk = r[j].x1; - img = my_draw_bitmap(bm->buffer + r[j].y0 * bm->w + r[j].x0, + img = my_draw_bitmap(bm->buffer + r[j].y0 * bm->stride + r[j].x0, lbrk - r[j].x0, r[j].y1 - r[j].y0, - bm->w, dst_x + r[j].x0, dst_y + r[j].y0, color); + bm->stride, dst_x + r[j].x0, dst_y + r[j].y0, color); if (!img) break; *tail = img; tail = &img->next; } if (lbrk < r[j].x1) { if (lbrk < r[j].x0) lbrk = r[j].x0; - img = my_draw_bitmap(bm->buffer + r[j].y0 * bm->w + lbrk, + img = my_draw_bitmap(bm->buffer + r[j].y0 * bm->stride + lbrk, r[j].x1 - lbrk, r[j].y1 - r[j].y0, - bm->w, dst_x + lbrk, dst_y + r[j].y0, color2); + bm->stride, dst_x + lbrk, dst_y + r[j].y0, color2); if (!img) break; *tail = img; tail = &img->next; @@ -419,8 +395,8 @@ render_glyph(ASS_Renderer *render_priv, if (brk > b_x0) { // draw left part if (brk > b_x1) brk = b_x1; - img = my_draw_bitmap(bm->buffer + bm->w * b_y0 + b_x0, - brk - b_x0, b_y1 - b_y0, bm->w, + img = my_draw_bitmap(bm->buffer + bm->stride * b_y0 + b_x0, + brk - b_x0, b_y1 - b_y0, bm->stride, dst_x + b_x0, dst_y + b_y0, color); if (!img) return tail; *tail = img; @@ -429,8 +405,8 @@ render_glyph(ASS_Renderer *render_priv, if (brk < b_x1) { // draw right part if (brk < b_x0) brk = b_x0; - img = my_draw_bitmap(bm->buffer + bm->w * b_y0 + brk, - b_x1 - brk, b_y1 - b_y0, bm->w, + img = my_draw_bitmap(bm->buffer + bm->stride * b_y0 + brk, + b_x1 - brk, b_y1 - b_y0, bm->stride, dst_x + brk, dst_y + b_y0, color2); if (!img) return tail; *tail = img; @@ -516,7 +492,7 @@ render_overlap(ASS_Renderer *render_priv hk.by = by; hk.as = as; hk.bs = bs; - hv = cache_find_composite(render_priv->cache.composite_cache, &hk); + hv = ass_cache_get(render_priv->cache.composite_cache, &hk); if (hv) { (*last_tail)->bitmap = hv->a; (*tail)->bitmap = hv->b; @@ -539,7 +515,7 @@ render_overlap(ASS_Renderer *render_priv // Insert bitmaps into the cache chv.a = (*last_tail)->bitmap; chv.b = (*tail)->bitmap; - cache_add_composite(render_priv->cache.composite_cache, &hk, &chv); + ass_cache_put(render_priv->cache.composite_cache, &hk, &chv); } static void free_list_add(ASS_Renderer *render_priv, void *object) @@ -564,32 +540,31 @@ static void free_list_add(ASS_Renderer * static void blend_vector_clip(ASS_Renderer *render_priv, ASS_Image *head) { - FT_Glyph glyph; - FT_BitmapGlyph clip_bm; + FT_Outline *outline; + Bitmap *clip_bm = NULL; ASS_Image *cur; ASS_Drawing *drawing = render_priv->state.clip_drawing; - GlyphHashKey key; - GlyphHashValue *val; + BitmapHashKey key; + BitmapHashValue *val; int error; if (!drawing) return; // Try to get mask from cache - ass_drawing_hash(drawing); memset(&key, 0, sizeof(key)); - key.ch = -2; - key.drawing_hash = drawing->hash; - val = cache_find_glyph(render_priv->cache.glyph_cache, &key); + key.type = BITMAP_CLIP; + key.u.clip.text = drawing->text; + val = ass_cache_get(render_priv->cache.bitmap_cache, &key); if (val) { - clip_bm = (FT_BitmapGlyph) val->glyph; + clip_bm = val->bm; } else { - GlyphHashValue v; + BitmapHashValue v; // Not found in cache, parse and rasterize it - glyph = (FT_Glyph) *ass_drawing_parse(drawing, 1); - if (!glyph) { + outline = ass_drawing_parse(drawing, 1); + if (!outline) { ass_msg(render_priv->library, MSGL_WARN, "Clip vector parsing failed. Skipping."); goto blend_vector_error; @@ -602,37 +577,27 @@ static void blend_vector_clip(ASS_Render .x = int_to_d6(render_priv->settings.left_margin), .y = -int_to_d6(render_priv->settings.top_margin), }; - FT_Outline_Translate(&drawing->glyph->outline, - trans.x, trans.y); - } - - // Check glyph bounding box size - if (check_glyph_area(render_priv->library, glyph)) { - FT_Done_Glyph(glyph); - glyph = 0; - goto blend_vector_error; + FT_Outline_Translate(outline, trans.x, trans.y); } ass_msg(render_priv->library, MSGL_DBG2, "Parsed vector clip: scales (%f, %f) string [%s]\n", drawing->scale_x, drawing->scale_y, drawing->text); - error = FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, 0, 1); - if (error) { + clip_bm = outline_to_bitmap(render_priv->library, + render_priv->ftlibrary, outline, 0); + if (clip_bm == NULL) { ass_msg(render_priv->library, MSGL_WARN, "Clip vector rasterization failed: %d. Skipping.", error); - FT_Done_Glyph(glyph); - glyph = 0; } -blend_vector_error: - clip_bm = (FT_BitmapGlyph) glyph; - // Add to cache memset(&v, 0, sizeof(v)); - v.glyph = glyph; - cache_add_glyph(render_priv->cache.glyph_cache, &key, &v); + key.u.clip.text = strdup(drawing->text); + v.bm = clip_bm; + ass_cache_put(render_priv->cache.bitmap_cache, &key, &v); } +blend_vector_error: if (!clip_bm) goto blend_vector_exit; @@ -645,17 +610,17 @@ blend_vector_error: unsigned char *abuffer, *bbuffer, *nbuffer; abuffer = cur->bitmap; - bbuffer = clip_bm->bitmap.buffer; + bbuffer = clip_bm->buffer; ax = cur->dst_x; ay = cur->dst_y; aw = cur->w; ah = cur->h; as = cur->stride; bx = clip_bm->left; - by = -clip_bm->top; - bw = clip_bm->bitmap.width; - bh = clip_bm->bitmap.rows; - bs = clip_bm->bitmap.pitch; + by = clip_bm->top; + bw = clip_bm->w; + bh = clip_bm->h; + bs = clip_bm->stride; // Calculate overlap coordinates left = (ax > bx) ? ax : bx; @@ -739,22 +704,31 @@ static ASS_Image *render_text(ASS_Render || (info->shadow_x == 0 && info->shadow_y == 0) || info->skip) continue; - pen_x = - dst_x + (info->pos.x >> 6) + - (int) (info->shadow_x * render_priv->border_scale); - pen_y = - dst_y + (info->pos.y >> 6) + - (int) (info->shadow_y * render_priv->border_scale); - bm = info->bm_s; + while (info) { + if (!info->bm_s) { + info = info->next; + continue; + } - here_tail = tail; - tail = - render_glyph(render_priv, bm, pen_x, pen_y, info->c[3], 0, - 1000000, tail); - if (last_tail && tail != here_tail && ((info->c[3] & 0xff) > 0)) - render_overlap(render_priv, last_tail, here_tail); + pen_x = + dst_x + (info->pos.x >> 6) + + (int) (info->shadow_x * render_priv->border_scale); + pen_y = + dst_y + (info->pos.y >> 6) + + (int) (info->shadow_y * render_priv->border_scale); + bm = info->bm_s; - last_tail = here_tail; + here_tail = tail; + tail = + render_glyph(render_priv, bm, pen_x, pen_y, info->c[3], 0, + 1000000, tail); + + if (last_tail && tail != here_tail && ((info->c[3] & 0xff) > 0)) + render_overlap(render_priv, last_tail, here_tail); + last_tail = here_tail; + + info = info->next; + } } last_tail = 0; @@ -764,22 +738,30 @@ static ASS_Image *render_text(ASS_Render || info->skip) continue; - pen_x = dst_x + (info->pos.x >> 6); - pen_y = dst_y + (info->pos.y >> 6); - bm = info->bm_o; + while (info) { + if (!info->bm_o) { + info = info->next; + continue; + } - if ((info->effect_type == EF_KARAOKE_KO) - && (info->effect_timing <= (info->bbox.xMax >> 6))) { - // do nothing - } else { - here_tail = tail; - tail = - render_glyph(render_priv, bm, pen_x, pen_y, info->c[2], - 0, 1000000, tail); - if (last_tail && tail != here_tail && ((info->c[2] & 0xff) > 0)) - render_overlap(render_priv, last_tail, here_tail); + pen_x = dst_x + (info->pos.x >> 6); + pen_y = dst_y + (info->pos.y >> 6); + bm = info->bm_o; - last_tail = here_tail; + if ((info->effect_type == EF_KARAOKE_KO) + && (info->effect_timing <= (info->bbox.xMax >> 6))) { + // do nothing + } else { + here_tail = tail; + tail = + render_glyph(render_priv, bm, pen_x, pen_y, info->c[2], + 0, 1000000, tail); + if (last_tail && tail != here_tail && ((info->c[2] & 0xff) > 0)) + render_overlap(render_priv, last_tail, here_tail); + + last_tail = here_tail; + } + info = info->next; } } @@ -789,28 +771,36 @@ static ASS_Image *render_text(ASS_Render || info->skip) continue; - pen_x = dst_x + (info->pos.x >> 6); - pen_y = dst_y + (info->pos.y >> 6); - bm = info->bm; + while (info) { + if (!info->bm) { + info = info->next; + continue; + } - if ((info->effect_type == EF_KARAOKE) - || (info->effect_type == EF_KARAOKE_KO)) { - if (info->effect_timing > (info->bbox.xMax >> 6)) + pen_x = dst_x + (info->pos.x >> 6); + pen_y = dst_y + (info->pos.y >> 6); + bm = info->bm; + + if ((info->effect_type == EF_KARAOKE) + || (info->effect_type == EF_KARAOKE_KO)) { + if (info->effect_timing > (info->bbox.xMax >> 6)) + tail = + render_glyph(render_priv, bm, pen_x, pen_y, + info->c[0], 0, 1000000, tail); + else + tail = + render_glyph(render_priv, bm, pen_x, pen_y, + info->c[1], 0, 1000000, tail); + } else if (info->effect_type == EF_KARAOKE_KF) { tail = - render_glyph(render_priv, bm, pen_x, pen_y, - info->c[0], 0, 1000000, tail); - else + render_glyph(render_priv, bm, pen_x, pen_y, info->c[0], + info->c[1], info->effect_timing, tail); + } else tail = - render_glyph(render_priv, bm, pen_x, pen_y, - info->c[1], 0, 1000000, tail); - } else if (info->effect_type == EF_KARAOKE_KF) { - tail = - render_glyph(render_priv, bm, pen_x, pen_y, info->c[0], - info->c[1], info->effect_timing, tail); - } else - tail = - render_glyph(render_priv, bm, pen_x, pen_y, info->c[0], - 0, 1000000, tail); + render_glyph(render_priv, bm, pen_x, pen_y, info->c[0], + 0, 1000000, tail); + info = info->next; + } } *tail = 0; @@ -819,23 +809,27 @@ static ASS_Image *render_text(ASS_Render return head; } -static void compute_string_bbox(TextInfo *info, DBBox *bbox) +static void compute_string_bbox(TextInfo *text, DBBox *bbox) { int i; - if (info->length > 0) { + if (text->length > 0) { bbox->xMin = 32000; bbox->xMax = -32000; - bbox->yMin = -1 * info->lines[0].asc + d6_to_double(info->glyphs[0].pos.y); - bbox->yMax = info->height - info->lines[0].asc + - d6_to_double(info->glyphs[0].pos.y); + bbox->yMin = -1 * text->lines[0].asc + d6_to_double(text->glyphs[0].pos.y); + bbox->yMax = text->height - text->lines[0].asc + + d6_to_double(text->glyphs[0].pos.y); - for (i = 0; i < info->length; ++i) { - if (info->glyphs[i].skip) continue; - double s = d6_to_double(info->glyphs[i].pos.x); - double e = s + d6_to_double(info->glyphs[i].advance.x); - bbox->xMin = FFMIN(bbox->xMin, s); - bbox->xMax = FFMAX(bbox->xMax, e); + for (i = 0; i < text->length; ++i) { + GlyphInfo *info = text->glyphs + i; + if (info->skip) continue; + while (info) { + double s = d6_to_double(info->pos.x); + double e = s + d6_to_double(info->advance.x); + bbox->xMin = FFMIN(bbox->xMin, s); + bbox->xMax = FFMAX(bbox->xMax, e); + info = info->next; + } } } else bbox->xMin = bbox->xMax = bbox->yMin = bbox->yMax = 0.; @@ -877,6 +871,7 @@ void reset_render_context(ASS_Renderer * render_priv->state.frz = M_PI * render_priv->state.style->Angle / 180.; render_priv->state.fax = render_priv->state.fay = 0.; render_priv->state.wrap_style = render_priv->track->WrapStyle; + render_priv->state.font_encoding = render_priv->state.style->Encoding; } /** @@ -909,10 +904,10 @@ init_render_context(ASS_Renderer *render render_priv->state.effect_type = EF_NONE; render_priv->state.effect_timing = 0; render_priv->state.effect_skip_timing = 0; + render_priv->state.bm_run_id = 0; ass_drawing_free(render_priv->state.drawing); - render_priv->state.drawing = ass_drawing_new(render_priv->fontconfig_priv, - render_priv->state.font, - render_priv->ftlibrary); + render_priv->state.drawing = ass_drawing_new(render_priv->library, + render_priv->ftlibrary); apply_transition_effects(render_priv, event); } @@ -930,30 +925,18 @@ static void free_render_context(ASS_Rend * Replace the outline of a glyph by a contour which makes up a simple * opaque rectangle. */ -static void draw_opaque_box(ASS_Renderer *render_priv, uint32_t ch, - FT_Glyph glyph, int sx, int sy) +static void draw_opaque_box(ASS_Renderer *render_priv, int asc, int desc, + FT_Outline *ol, FT_Vector advance, int sx, int sy) { - int asc = 0, desc = 0; int i; - int adv = d16_to_d6(glyph->advance.x); + int adv = advance.x; double scale_y = render_priv->state.scale_y; double scale_x = render_priv->state.scale_x; - FT_OutlineGlyph og = (FT_OutlineGlyph) glyph; - FT_Outline *ol; // to avoid gaps sx = FFMAX(64, sx); sy = FFMAX(64, sy); - if (ch == -1) { - asc = render_priv->state.drawing->asc; - desc = render_priv->state.drawing->desc; - } else { - ass_font_get_asc_desc(render_priv->state.font, ch, &asc, &desc); - asc *= scale_y; - desc *= scale_y; - } - // Emulate the WTFish behavior of VSFilter, i.e. double-scale // the sizes of the opaque box. adv += double_to_d6(render_priv->state.hspacing * render_priv->font_scale @@ -971,10 +954,8 @@ static void draw_opaque_box(ASS_Renderer { .x = -sx, .y = -desc - sy }, }; - FT_Outline_Done(render_priv->ftlibrary, &og->outline); - FT_Outline_New(render_priv->ftlibrary, 4, 1, &og->outline); + FT_Outline_New(render_priv->ftlibrary, 4, 1, ol); - ol = &og->outline; ol->n_points = ol->n_contours = 0; for (i = 0; i < 4; i++) { ol->points[ol->n_points] = points[i]; @@ -987,40 +968,53 @@ static void draw_opaque_box(ASS_Renderer * Stroke an outline glyph in x/y direction. Applies various fixups to get * around limitations of the FreeType stroker. */ -static void stroke_outline_glyph(ASS_Renderer *render_priv, - FT_OutlineGlyph *glyph, int sx, int sy) +static void stroke_outline(ASS_Renderer *render_priv, FT_Outline *outline, + int sx, int sy) { if (sx <= 0 && sy <= 0) return; - fix_freetype_stroker(*glyph, sx, sy); + fix_freetype_stroker(outline, sx, sy); // Borders are equal; use the regular stroker if (sx == sy && render_priv->state.stroker) { int error; - error = FT_Glyph_StrokeBorder((FT_Glyph *) glyph, - render_priv->state.stroker, 0, 1); - if (error) + unsigned n_points, n_contours; + + FT_StrokerBorder border = FT_Outline_GetOutsideBorder(outline); + error = FT_Stroker_ParseOutline(render_priv->state.stroker, outline, 0); + if (error) { ass_msg(render_priv->library, MSGL_WARN, - "FT_Glyph_Stroke error: %d", error); + "FT_Stroker_ParseOutline failed, error: %d", error); + } + error = FT_Stroker_GetBorderCounts(render_priv->state.stroker, border, + &n_points, &n_contours); + if (error) { + ass_msg(render_priv->library, MSGL_WARN, + "FT_Stroker_GetBorderCounts failed, error: %d", error); + } + FT_Outline_Done(render_priv->ftlibrary, outline); + FT_Outline_New(render_priv->ftlibrary, n_points, n_contours, outline); + outline->n_points = outline->n_contours = 0; + FT_Stroker_ExportBorder(render_priv->state.stroker, border, outline); // "Stroke" with the outline emboldener in two passes. // The outlines look uglier, but the emboldening never adds any points } else { int i; - FT_Outline *ol = &(*glyph)->outline; FT_Outline nol; - FT_Outline_New(render_priv->ftlibrary, ol->n_points, - ol->n_contours, &nol); - FT_Outline_Copy(ol, &nol); - FT_Outline_Embolden(ol, sx * 2); - FT_Outline_Translate(ol, -sx, -sx); + FT_Outline_New(render_priv->ftlibrary, outline->n_points, + outline->n_contours, &nol); + FT_Outline_Copy(outline, &nol); + + FT_Outline_Embolden(outline, sx * 2); + FT_Outline_Translate(outline, -sx, -sx); FT_Outline_Embolden(&nol, sy * 2); FT_Outline_Translate(&nol, -sy, -sy); - for (i = 0; i < ol->n_points; i++) - ol->points[i].y = nol.points[i].y; + for (i = 0; i < outline->n_points; i++) + outline->points[i].y = nol.points[i].y; FT_Outline_Done(render_priv->ftlibrary, &nol); } @@ -1030,37 +1024,41 @@ static void stroke_outline_glyph(ASS_Ren * \brief Prepare glyph hash */ static void -fill_glyph_hash(ASS_Renderer *priv, GlyphHashKey *key, - ASS_Drawing *drawing, uint32_t ch) +fill_glyph_hash(ASS_Renderer *priv, OutlineHashKey *outline_key, + GlyphInfo *info) { - if (drawing->hash) { - key->scale_x = double_to_d16(priv->state.scale_x); - key->scale_y = double_to_d16(priv->state.scale_y); - key->outline.x = priv->state.border_x * 0xFFFF; - key->outline.y = priv->state.border_y * 0xFFFF; + if (info->drawing) { + DrawingHashKey *key = &outline_key->u.drawing; + outline_key->type = OUTLINE_DRAWING; + key->scale_x = double_to_d16(info->scale_x); + key->scale_y = double_to_d16(info->scale_y); + key->outline.x = double_to_d16(info->border_x); + key->outline.y = double_to_d16(info->border_y); key->border_style = priv->state.style->BorderStyle; - key->drawing_hash = drawing->hash; - // not very clean, but works - key->size = drawing->scale; - key->ch = -1; + key->hash = info->drawing->hash; + key->text = info->drawing->text; + key->pbo = info->drawing->pbo; + key->scale = info->drawing->scale; } else { - key->font = priv->state.font; - key->size = priv->state.font_size; - key->ch = ch; - key->bold = priv->state.bold; - key->italic = priv->state.italic; - key->scale_x = double_to_d16(priv->state.scale_x); - key->scale_y = double_to_d16(priv->state.scale_y); - key->outline.x = priv->state.border_x * 0xFFFF; - key->outline.y = priv->state.border_y * 0xFFFF; - key->flags = priv->state.flags; + GlyphHashKey *key = &outline_key->u.glyph; + outline_key->type = OUTLINE_GLYPH; + key->font = info->font; + key->size = info->font_size; + key->face_index = info->face_index; + key->glyph_index = info->glyph_index; + key->bold = info->bold; + key->italic = info->italic; + key->scale_x = double_to_d16(info->scale_x); + key->scale_y = double_to_d16(info->scale_y); + key->outline.x = double_to_d16(info->border_x); + key->outline.y = double_to_d16(info->border_y); + key->flags = info->flags; key->border_style = priv->state.style->BorderStyle; } } /** * \brief Get normal and outline (border) glyphs - * \param symbol ucs4 char * \param info out: struct filled with extracted data * Tries to get both glyphs from cache. * If they can't be found, gets a glyph from font face, generates outline with FT_Stroker, @@ -1068,80 +1066,101 @@ fill_glyph_hash(ASS_Renderer *priv, Glyp * The glyphs are returned in info->glyph and info->outline_glyph */ static void -get_outline_glyph(ASS_Renderer *render_priv, int symbol, GlyphInfo *info, - ASS_Drawing *drawing) +get_outline_glyph(ASS_Renderer *priv, GlyphInfo *info) { - GlyphHashValue *val; - GlyphHashKey key; + OutlineHashValue *val; + OutlineHashKey key; - memset(&key, 0, sizeof(key)); - memset(info, 0, sizeof(GlyphInfo)); + memset(&info->hash_key, 0, sizeof(key)); - fill_glyph_hash(render_priv, &key, drawing, symbol); - val = cache_find_glyph(render_priv->cache.glyph_cache, &key); - if (val) { - info->glyph = val->glyph; - info->outline_glyph = val->outline_glyph; - info->bbox = val->bbox_scaled; - info->advance.x = val->advance.x; - info->advance.y = val->advance.y; - if (drawing->hash) { - drawing->asc = val->asc; - drawing->desc = val->desc; - } - } else { - GlyphHashValue v; - if (drawing->hash) { + fill_glyph_hash(priv, &key, info); + val = ass_cache_get(priv->cache.outline_cache, &key); + + if (!val) { + OutlineHashValue v; + memset(&v, 0, sizeof(v)); + + if (info->drawing) { + ASS_Drawing *drawing = info->drawing; + ass_drawing_hash(drawing); if(!ass_drawing_parse(drawing, 0)) return; - info->glyph = (FT_Glyph) drawing->glyph; + outline_copy(priv->ftlibrary, &drawing->outline, + &v.outline); + v.advance.x = drawing->advance.x; + v.advance.y = drawing->advance.y; + v.asc = drawing->asc; + v.desc = drawing->desc; + key.u.drawing.text = strdup(drawing->text); } else { - info->glyph = - ass_font_get_glyph(render_priv->fontconfig_priv, - render_priv->state.font, symbol, - render_priv->settings.hinting, - render_priv->state.flags); + ass_face_set_size(info->font->faces[info->face_index], + info->font_size); + ass_font_set_transform(info->font, info->scale_x, + info->scale_y, NULL); + FT_Glyph glyph = + ass_font_get_glyph(priv->fontconfig_priv, info->font, + info->symbol, info->face_index, info->glyph_index, + priv->settings.hinting, info->flags); + if (glyph != NULL) { + outline_copy(priv->ftlibrary, + &((FT_OutlineGlyph)glyph)->outline, &v.outline); + if (priv->settings.shaper == ASS_SHAPING_SIMPLE) { + v.advance.x = d16_to_d6(glyph->advance.x); + v.advance.y = d16_to_d6(glyph->advance.y); + } + FT_Done_Glyph(glyph); + ass_font_get_asc_desc(info->font, info->symbol, + &v.asc, &v.desc); + v.asc *= info->scale_y; + v.desc *= info->scale_y; + } } - if (!info->glyph) + + if (!v.outline) return; - info->advance.x = d16_to_d6(info->glyph->advance.x); - info->advance.y = d16_to_d6(info->glyph->advance.y); - FT_Glyph_Get_CBox(info->glyph, FT_GLYPH_BBOX_SUBPIXELS, &info->bbox); + FT_Outline_Get_CBox(v.outline, &v.bbox_scaled); - if (render_priv->state.style->BorderStyle == 3 && - (render_priv->state.border_x > 0|| - render_priv->state.border_y > 0)) { - FT_Glyph_Copy(info->glyph, &info->outline_glyph); - draw_opaque_box(render_priv, symbol, info->outline_glyph, - double_to_d6(render_priv->state.border_x * - render_priv->border_scale), - double_to_d6(render_priv->state.border_y * - render_priv->border_scale)); - } else if ((render_priv->state.border_x > 0 - || render_priv->state.border_y > 0) - && key.scale_x && key.scale_y) { + if (priv->state.style->BorderStyle == 3 && + (info->border_x > 0 || info->border_y > 0)) { + FT_Vector advance; - FT_Glyph_Copy(info->glyph, &info->outline_glyph); - stroke_outline_glyph(render_priv, - (FT_OutlineGlyph *) &info->outline_glyph, - double_to_d6(render_priv->state.border_x * - render_priv->border_scale), - double_to_d6(render_priv->state.border_y * - render_priv->border_scale)); - } + v.border = calloc(1, sizeof(FT_Outline)); - memset(&v, 0, sizeof(v)); - v.glyph = info->glyph; - v.outline_glyph = info->outline_glyph; - v.advance = info->advance; - v.bbox_scaled = info->bbox; - if (drawing->hash) { - v.asc = drawing->asc; - v.desc = drawing->desc; + if (priv->settings.shaper == ASS_SHAPING_SIMPLE || info->drawing) + advance = v.advance; + else + advance = info->advance; + + draw_opaque_box(priv, v.asc, v.desc, v.border, advance, + double_to_d6(info->border_x * priv->border_scale), + double_to_d6(info->border_y * priv->border_scale)); + + } else if ((info->border_x > 0 || info->border_y > 0) + && double_to_d6(info->scale_x) && double_to_d6(info->scale_y)) { + + outline_copy(priv->ftlibrary, v.outline, &v.border); + stroke_outline(priv, v.border, + double_to_d6(info->border_x * priv->border_scale), + double_to_d6(info->border_y * priv->border_scale)); } - cache_add_glyph(render_priv->cache.glyph_cache, &key, &v); + + v.lib = priv->ftlibrary; + val = ass_cache_put(priv->cache.outline_cache, &key, &v); + } + + info->hash_key.u.outline.outline = val; + info->outline = val->outline; + info->border = val->border; + info->bbox = val->bbox_scaled; + if (info->drawing || priv->settings.shaper == ASS_SHAPING_SIMPLE) { + info->cluster_advance.x = info->advance.x = val->advance.x; + info->cluster_advance.y = info->advance.y = val->advance.y; } + info->asc = val->asc; + info->desc = val->desc; + + ass_drawing_free(info->drawing); } /** @@ -1150,7 +1169,7 @@ get_outline_glyph(ASS_Renderer *render_p * onto the screen plane. */ static void -transform_3d_points(FT_Vector shift, FT_Glyph glyph, double frx, double fry, +transform_3d_points(FT_Vector shift, FT_Outline *outline, double frx, double fry, double frz, double fax, double fay, double scale, int yshift) { @@ -1160,7 +1179,6 @@ transform_3d_points(FT_Vector shift, FT_ double cx = cos(frx); double cy = cos(fry); double cz = cos(frz); - FT_Outline *outline = &((FT_OutlineGlyph) glyph)->outline; FT_Vector *p = outline->points; double x, y, z, xx, yy, zz; int i, dist; @@ -1203,19 +1221,19 @@ transform_3d_points(FT_Vector shift, FT_ * Rotates both glyphs by frx, fry and frz. Shift vector is added before rotation and subtracted after it. */ static void -transform_3d(FT_Vector shift, FT_Glyph *glyph, FT_Glyph *glyph2, +transform_3d(FT_Vector shift, FT_Outline *outline, FT_Outline *border, double frx, double fry, double frz, double fax, double fay, double scale, int yshift) { frx = -frx; frz = -frz; if (frx != 0. || fry != 0. || frz != 0. || fax != 0. || fay != 0.) { - if (glyph && *glyph) - transform_3d_points(shift, *glyph, frx, fry, frz, + if (outline) + transform_3d_points(shift, outline, frx, fry, frz, fax, fay, scale, yshift); - if (glyph2 && *glyph2) - transform_3d_points(shift, *glyph2, frx, fry, frz, + if (border) + transform_3d_points(shift, border, frx, fry, frz, fax, fay, scale, yshift); } } @@ -1232,81 +1250,80 @@ static void get_bitmap_glyph(ASS_Renderer *render_priv, GlyphInfo *info) { BitmapHashValue *val; - BitmapHashKey *key = &info->hash_key; + OutlineBitmapHashKey *key = &info->hash_key.u.outline; - val = cache_find_bitmap(render_priv->cache.bitmap_cache, key); + if (!info->outline || info->symbol == '\n' || info->symbol == 0 || info->skip) + return; - if (val) { - info->bm = val->bm; - info->bm_o = val->bm_o; - info->bm_s = val->bm_s; - } else { + val = ass_cache_get(render_priv->cache.bitmap_cache, &info->hash_key); + + if (!val) { FT_Vector shift; BitmapHashValue hash_val; int error; double fax_scaled, fay_scaled; - info->bm = info->bm_o = info->bm_s = 0; - if (info->glyph && info->symbol != '\n' && info->symbol != 0 - && !info->skip) { - FT_Glyph glyph; - FT_Glyph outline; - double scale_x = render_priv->font_scale_x; + FT_Outline *outline, *border; + double scale_x = render_priv->font_scale_x; - FT_Glyph_Copy(info->glyph, &glyph); - FT_Glyph_Copy(info->outline_glyph, &outline); - // calculating rotation shift vector (from rotation origin to the glyph basepoint) - shift.x = key->shift_x; - shift.y = key->shift_y; - fax_scaled = info->fax * - render_priv->state.scale_x; - fay_scaled = info->fay * render_priv->state.scale_y; - // apply rotation - transform_3d(shift, &glyph, &outline, - info->frx, info->fry, info->frz, fax_scaled, - fay_scaled, render_priv->font_scale, info->asc); + hash_val.bm = hash_val.bm_o = hash_val.bm_s = 0; - // PAR correction scaling - FT_Matrix m = { double_to_d16(scale_x), 0, - 0, double_to_d16(1.0) }; + outline_copy(render_priv->ftlibrary, info->outline, &outline); + outline_copy(render_priv->ftlibrary, info->border, &border); - // subpixel shift - if (glyph) { - FT_Outline *outl = &((FT_OutlineGlyph) glyph)->outline; - if (scale_x != 1.0) - FT_Outline_Transform(outl, &m); - FT_Outline_Translate(outl, key->advance.x, -key->advance.y); - } - if (outline) { - FT_Outline *outl = &((FT_OutlineGlyph) outline)->outline; - if (scale_x != 1.0) - FT_Outline_Transform(outl, &m); - FT_Outline_Translate(outl, key->advance.x, -key->advance.y); - } - // render glyph - error = glyph_to_bitmap(render_priv->library, - render_priv->synth_priv, - glyph, outline, - &info->bm, &info->bm_o, - &info->bm_s, info->be, - info->blur * render_priv->border_scale, - key->shadow_offset, key->border_style); - if (error) - info->symbol = 0; + // calculating rotation shift vector (from rotation origin to the glyph basepoint) + shift.x = key->shift_x; + shift.y = key->shift_y; + fax_scaled = info->fax * render_priv->state.scale_x; + fay_scaled = info->fay * render_priv->state.scale_y; - // add bitmaps to cache - hash_val.bm_o = info->bm_o; - hash_val.bm = info->bm; - hash_val.bm_s = info->bm_s; - cache_add_bitmap(render_priv->cache.bitmap_cache, key, &hash_val); + // apply rotation + transform_3d(shift, outline, border, + info->frx, info->fry, info->frz, fax_scaled, + fay_scaled, render_priv->font_scale, info->asc); - FT_Done_Glyph(glyph); - FT_Done_Glyph(outline); + // PAR correction scaling + FT_Matrix m = { double_to_d16(scale_x), 0, + 0, double_to_d16(1.0) }; + + // subpixel shift + if (outline) { + if (scale_x != 1.0) + FT_Outline_Transform(outline, &m); + FT_Outline_Translate(outline, key->advance.x, -key->advance.y); } + if (border) { + if (scale_x != 1.0) + FT_Outline_Transform(border, &m); + FT_Outline_Translate(border, key->advance.x, -key->advance.y); + } + + // render glyph + error = outline_to_bitmap3(render_priv->library, + render_priv->synth_priv, + render_priv->ftlibrary, + outline, border, + &hash_val.bm, &hash_val.bm_o, + &hash_val.bm_s, info->be, + info->blur * render_priv->border_scale, + key->shadow_offset, + render_priv->state.style->BorderStyle); + if (error) + info->symbol = 0; + + val = ass_cache_put(render_priv->cache.bitmap_cache, &info->hash_key, + &hash_val); + + outline_free(render_priv->ftlibrary, outline); + outline_free(render_priv->ftlibrary, border); } + info->bm = val->bm; + info->bm_o = val->bm_o; + info->bm_s = val->bm_s; + // VSFilter compatibility: invisible fill and no border? // In this case no shadow is supposed to be rendered. - if (!info->outline_glyph && (info->c[0] & 0xFF) == 0xFF) + if (!info->border && (info->c[0] & 0xFF) == 0xFF) info->bm_s = 0; } @@ -1434,6 +1451,7 @@ wrap_lines_smart(ASS_Renderer *render_pr double pen_shift_x; double pen_shift_y; int cur_line; + int run_offset; TextInfo *text_info = &render_priv->text_info; last_space = -1; @@ -1474,12 +1492,13 @@ wrap_lines_smart(ASS_Renderer *render_pr sizeof(LineInfo) * text_info->max_lines); } - if (lead < text_info->length) + if (lead < text_info->length) { text_info->glyphs[lead].linebreak = break_type; - last_space = -1; - s1 = text_info->glyphs + lead; - s_offset = d6_to_double(s1->bbox.xMin + s1->pos.x); - text_info->n_lines++; + last_space = -1; + s1 = text_info->glyphs + lead; + s_offset = d6_to_double(s1->bbox.xMin + s1->pos.x); + text_info->n_lines++; + } } } #define DIFF(x,y) (((x) < (y)) ? (y - x) : (x - y)) @@ -1543,6 +1562,7 @@ wrap_lines_smart(ASS_Renderer *render_pr pen_shift_x = 0.; pen_shift_y = 0.; cur_line = 1; + run_offset = 0; i = 0; cur = text_info->glyphs + i; @@ -1558,86 +1578,31 @@ wrap_lines_smart(ASS_Renderer *render_pr double height = text_info->lines[cur_line - 1].desc + text_info->lines[cur_line].asc; + text_info->lines[cur_line - 1].len = i - + text_info->lines[cur_line - 1].offset; + text_info->lines[cur_line].offset = i; cur_line++; + run_offset++; pen_shift_x = d6_to_double(-cur->pos.x); pen_shift_y += height + render_priv->settings.line_spacing; ass_msg(render_priv->library, MSGL_DBG2, "shifting from %d to %d by (%f, %f)", i, text_info->length - 1, pen_shift_x, pen_shift_y); } + cur->bm_run_id += run_offset; cur->pos.x += double_to_d6(pen_shift_x); cur->pos.y += double_to_d6(pen_shift_y); } -} - -/** - * \brief determine karaoke effects - * Karaoke effects cannot be calculated during parse stage (get_next_char()), - * so they are done in a separate step. - * Parse stage: when karaoke style override is found, its parameters are stored in the next glyph's - * (the first glyph of the karaoke word)'s effect_type and effect_timing. - * This function: - * 1. sets effect_type for all glyphs in the word (_karaoke_ word) - * 2. sets effect_timing for all glyphs to x coordinate of the border line between the left and right karaoke parts - * (left part is filled with PrimaryColour, right one - with SecondaryColour). - */ -static void process_karaoke_effects(ASS_Renderer *render_priv) -{ - GlyphInfo *cur, *cur2; - GlyphInfo *s1, *e1; // start and end of the current word - GlyphInfo *s2; // start of the next word - int i; - int timing; // current timing - int tm_start, tm_end; // timings at start and end of the current word - int tm_current; - double dt; - int x; - int x_start, x_end; - - tm_current = render_priv->time - render_priv->state.event->Start; - timing = 0; - s1 = s2 = 0; - for (i = 0; i <= render_priv->text_info.length; ++i) { - cur = render_priv->text_info.glyphs + i; - if ((i == render_priv->text_info.length) - || (cur->effect_type != EF_NONE)) { - s1 = s2; - s2 = cur; - if (s1) { - e1 = s2 - 1; - tm_start = timing + s1->effect_skip_timing; - tm_end = tm_start + s1->effect_timing; - timing = tm_end; - x_start = 1000000; - x_end = -1000000; - for (cur2 = s1; cur2 <= e1; ++cur2) { - x_start = FFMIN(x_start, d6_to_int(cur2->bbox.xMin + cur2->pos.x)); - x_end = FFMAX(x_end, d6_to_int(cur2->bbox.xMax + cur2->pos.x)); - } - - dt = (tm_current - tm_start); - if ((s1->effect_type == EF_KARAOKE) - || (s1->effect_type == EF_KARAOKE_KO)) { - if (dt > 0) - x = x_end + 1; - else - x = x_start; - } else if (s1->effect_type == EF_KARAOKE_KF) { - dt /= (tm_end - tm_start); - x = x_start + (x_end - x_start) * dt; - } else { - ass_msg(render_priv->library, MSGL_ERR, - "Unknown effect type"); - continue; - } + text_info->lines[cur_line - 1].len = + text_info->length - text_info->lines[cur_line - 1].offset; - for (cur2 = s1; cur2 <= e1; ++cur2) { - cur2->effect_type = s1->effect_type; - cur2->effect_timing = x - d6_to_int(cur2->pos.x); - } - } - } +#if 0 + // print line info + for (i = 0; i < text_info->n_lines; i++) { + printf("line %d offset %d length %d\n", i, text_info->lines[i].offset, + text_info->lines[i].len); } +#endif } /** @@ -1680,38 +1645,22 @@ static void get_base_point(DBBox *bbox, * Prepare bitmap hash key of a glyph */ static void -fill_bitmap_hash(ASS_Renderer *priv, BitmapHashKey *hash_key, - ASS_Drawing *drawing, FT_Vector pen, uint32_t code) +fill_bitmap_hash(ASS_Renderer *priv, GlyphInfo *info, + OutlineBitmapHashKey *hash_key) { - if (!drawing->hash) { - hash_key->font = priv->state.font; - hash_key->size = priv->state.font_size; - hash_key->bold = priv->state.bold; - hash_key->italic = priv->state.italic; - } else { - hash_key->drawing_hash = drawing->hash; - hash_key->size = drawing->scale; - } - hash_key->ch = code; - hash_key->outline.x = double_to_d16(priv->state.border_x); - hash_key->outline.y = double_to_d16(priv->state.border_y); - hash_key->scale_x = double_to_d16(priv->state.scale_x); - hash_key->scale_y = double_to_d16(priv->state.scale_y); - hash_key->frx = rot_key(priv->state.frx); - hash_key->fry = rot_key(priv->state.fry); - hash_key->frz = rot_key(priv->state.frz); - hash_key->fax = double_to_d16(priv->state.fax); - hash_key->fay = double_to_d16(priv->state.fay); - hash_key->be = priv->state.be; - hash_key->blur = priv->state.blur; - hash_key->border_style = priv->state.style->BorderStyle; + hash_key->frx = rot_key(info->frx); + hash_key->fry = rot_key(info->fry); + hash_key->frz = rot_key(info->frz); + hash_key->fax = double_to_d16(info->fax); + hash_key->fay = double_to_d16(info->fay); + hash_key->be = info->be; + hash_key->blur = info->blur; hash_key->shadow_offset.x = double_to_d6( - priv->state.shadow_x * priv->border_scale - - (int) (priv->state.shadow_x * priv->border_scale)); + info->shadow_x * priv->border_scale - + (int) (info->shadow_x * priv->border_scale)); hash_key->shadow_offset.y = double_to_d6( - priv->state.shadow_y * priv->border_scale - - (int) (priv->state.shadow_y * priv->border_scale)); - hash_key->flags = priv->state.flags; + info->shadow_y * priv->border_scale - + (int) (info->shadow_y * priv->border_scale)); } /** @@ -1734,7 +1683,6 @@ ass_render_event(ASS_Renderer *render_pr int MarginL, MarginR, MarginV; int last_break; int alignment, halign, valign; - int kern = render_priv->track->Kerning; double device_x = 0; double device_y = 0; TextInfo *text_info = &render_priv->text_info; @@ -1754,11 +1702,9 @@ ass_render_event(ASS_Renderer *render_pr drawing = render_priv->state.drawing; text_info->length = 0; - pen.x = 0; - pen.y = 0; - previous = 0; num_glyphs = 0; p = event->Text; + // Event parsing. while (1) { // get next char, executing style override @@ -1769,15 +1715,26 @@ ass_render_event(ASS_Renderer *render_pr ass_drawing_add_char(drawing, (char) code); } while (code && render_priv->state.drawing_mode); // skip everything in drawing mode + if (text_info->length >= text_info->max_glyphs) { + // Raise maximum number of glyphs + text_info->max_glyphs *= 2; + text_info->glyphs = glyphs = + realloc(text_info->glyphs, + sizeof(GlyphInfo) * text_info->max_glyphs); + } + + // Clear current GlyphInfo + memset(&glyphs[text_info->length], 0, sizeof(GlyphInfo)); + // Parse drawing if (drawing->i) { drawing->scale_x = render_priv->state.scale_x * render_priv->font_scale; drawing->scale_y = render_priv->state.scale_y * render_priv->font_scale; - ass_drawing_hash(drawing); p--; - code = -1; + code = 0xfffc; // object replacement character + glyphs[text_info->length].drawing = drawing; } // face could have been changed in get_next_char @@ -1789,61 +1746,9 @@ ass_render_event(ASS_Renderer *render_pr if (code == 0) break; - if (text_info->length >= text_info->max_glyphs) { - // Raise maximum number of glyphs - text_info->max_glyphs *= 2; - text_info->glyphs = glyphs = - realloc(text_info->glyphs, - sizeof(GlyphInfo) * text_info->max_glyphs); - } - - // Add kerning to pen - if (kern && previous && code && !drawing->hash) { - FT_Vector delta; - delta = - ass_font_get_kerning(render_priv->state.font, previous, - code); - pen.x += delta.x * render_priv->state.scale_x; - pen.y += delta.y * render_priv->state.scale_y; - } - - ass_font_set_transform(render_priv->state.font, - render_priv->state.scale_x, - render_priv->state.scale_y, NULL); - - get_outline_glyph(render_priv, code, - glyphs + text_info->length, drawing); - - // Add additional space after italic to non-italic style changes - if (text_info->length && - glyphs[text_info->length - 1].hash_key.italic && - !render_priv->state.italic) { - int back = text_info->length - 1; - GlyphInfo *og = &glyphs[back]; - while (back && og->bbox.xMax - og->bbox.xMin == 0 - && og->hash_key.italic) - og = &glyphs[--back]; - if (og->bbox.xMax > og->advance.x) { - // The FreeType oblique slants by 6/16 - pen.x += og->bbox.yMax * 0.375; - } - } - - glyphs[text_info->length].pos.x = pen.x; - glyphs[text_info->length].pos.y = pen.y; - - pen.x += glyphs[text_info->length].advance.x; - pen.x += double_to_d6(render_priv->state.hspacing * - render_priv->font_scale - * render_priv->state.scale_x); - pen.y += glyphs[text_info->length].advance.y; - pen.y += (render_priv->state.fay * render_priv->state.scale_y) * - glyphs[text_info->length].advance.x; - - previous = code; - + // Fill glyph information glyphs[text_info->length].symbol = code; - glyphs[text_info->length].linebreak = 0; + glyphs[text_info->length].font = render_priv->state.font; for (i = 0; i < 4; ++i) { uint32_t clr = render_priv->state.c[i]; change_alpha(&clr, @@ -1855,53 +1760,108 @@ ass_render_event(ASS_Renderer *render_pr render_priv->state.effect_timing; glyphs[text_info->length].effect_skip_timing = render_priv->state.effect_skip_timing; + glyphs[text_info->length].font_size = ensure_font_size(render_priv, + render_priv->state.font_size * render_priv->font_scale); glyphs[text_info->length].be = render_priv->state.be; glyphs[text_info->length].blur = render_priv->state.blur; glyphs[text_info->length].shadow_x = render_priv->state.shadow_x; glyphs[text_info->length].shadow_y = render_priv->state.shadow_y; + glyphs[text_info->length].scale_x= render_priv->state.scale_x; + glyphs[text_info->length].scale_y = render_priv->state.scale_y; + glyphs[text_info->length].border_x= render_priv->state.border_x; + glyphs[text_info->length].border_y = render_priv->state.border_y; + glyphs[text_info->length].bold = render_priv->state.bold; + glyphs[text_info->length].italic = render_priv->state.italic; + glyphs[text_info->length].flags = render_priv->state.flags; glyphs[text_info->length].frx = render_priv->state.frx; glyphs[text_info->length].fry = render_priv->state.fry; glyphs[text_info->length].frz = render_priv->state.frz; glyphs[text_info->length].fax = render_priv->state.fax; glyphs[text_info->length].fay = render_priv->state.fay; - if (drawing->hash) { - glyphs[text_info->length].asc = drawing->asc; - glyphs[text_info->length].desc = drawing->desc; - } else { - ass_font_get_asc_desc(render_priv->state.font, code, - &glyphs[text_info->length].asc, - &glyphs[text_info->length].desc); + glyphs[text_info->length].bm_run_id = render_priv->state.bm_run_id; - glyphs[text_info->length].asc *= render_priv->state.scale_y; - glyphs[text_info->length].desc *= render_priv->state.scale_y; + if (glyphs[text_info->length].drawing) { + drawing = render_priv->state.drawing = + ass_drawing_new(render_priv->library, render_priv->ftlibrary); } - // fill bitmap hash - fill_bitmap_hash(render_priv, &glyphs[text_info->length].hash_key, - drawing, pen, code); - text_info->length++; render_priv->state.effect_type = EF_NONE; render_priv->state.effect_timing = 0; render_priv->state.effect_skip_timing = 0; - if (drawing->hash) { - ass_drawing_free(drawing); - drawing = render_priv->state.drawing = - ass_drawing_new(render_priv->fontconfig_priv, - render_priv->state.font, - render_priv->ftlibrary); - } } - if (text_info->length == 0) { // no valid symbols in the event; this can be smth like {comment} free_render_context(render_priv); return 1; } + // Find shape runs and shape text + ass_shaper_set_base_direction(render_priv->shaper, + resolve_base_direction(render_priv->state.font_encoding)); + ass_shaper_find_runs(render_priv->shaper, render_priv, glyphs, + text_info->length); + ass_shaper_shape(render_priv->shaper, text_info); + + // Retrieve glyphs + for (i = 0; i < text_info->length; i++) { + GlyphInfo *info = glyphs + i; + while (info) { + get_outline_glyph(render_priv, info); + info = info->next; + } + info = glyphs + i; + + // Add additional space after italic to non-italic style changes + if (i && glyphs[i - 1].italic && !info->italic) { + int back = i - 1; + GlyphInfo *og = &glyphs[back]; + while (back && og->bbox.xMax - og->bbox.xMin == 0 + && og->italic) + og = &glyphs[--back]; + if (og->bbox.xMax > og->cluster_advance.x) + og->cluster_advance.x = og->bbox.xMax; + } + + // add horizontal letter spacing + info->cluster_advance.x += double_to_d6(render_priv->state.hspacing * + render_priv->font_scale * info->scale_x); + + // add displacement for vertical shearing + info->cluster_advance.y += (info->fay * info->scale_y) * info->cluster_advance.x; + + } + + // Preliminary layout (for line wrapping) + previous = 0; + pen.x = 0; + pen.y = 0; + for (i = 0; i < text_info->length; i++) { + GlyphInfo *info = glyphs + i; + FT_Vector cluster_pen = pen; + while (info) { + info->pos.x = cluster_pen.x; + info->pos.y = cluster_pen.y; + + cluster_pen.x += info->advance.x; + cluster_pen.y += info->advance.y; + + // fill bitmap hash + info->hash_key.type = BITMAP_OUTLINE; + fill_bitmap_hash(render_priv, info, &info->hash_key.u.outline); + + info = info->next; + } + info = glyphs + i; + pen.x += info->cluster_advance.x; + pen.y += info->cluster_advance.y; + previous = info->symbol; + } + + // depends on glyph x coordinates being monotonous, so it should be done before line wrap process_karaoke_effects(render_priv); @@ -1917,40 +1877,64 @@ ass_render_event(ASS_Renderer *render_pr MarginV = (event->MarginV) ? event->MarginV : render_priv->state.style->MarginV; - if (render_priv->state.evt_type != EVENT_HSCROLL) { - double max_text_width; - - // calculate max length of a line - max_text_width = - x2scr(render_priv, - render_priv->track->PlayResX - MarginR) - - x2scr(render_priv, MarginL); + // calculate max length of a line + double max_text_width = + x2scr(render_priv, render_priv->track->PlayResX - MarginR) - + x2scr(render_priv, MarginL); + // wrap lines + if (render_priv->state.evt_type != EVENT_HSCROLL) { // rearrange text in several lines wrap_lines_smart(render_priv, max_text_width); + } else { + // no breaking or wrapping, everything in a single line + text_info->lines[0].offset = 0; + text_info->lines[0].len = text_info->length; + text_info->n_lines = 1; + measure_text(render_priv); + } - // align text - last_break = -1; - for (i = 1; i < text_info->length + 1; ++i) { // (text_info->length + 1) is the end of the last line - if ((i == text_info->length) - || glyphs[i].linebreak) { - double width, shift = 0; - GlyphInfo *first_glyph = - glyphs + last_break + 1; - GlyphInfo *last_glyph = glyphs + i - 1; - - while (first_glyph < last_glyph && first_glyph->skip) - first_glyph++; + // Reorder text into visual order + FriBidiStrIndex *cmap = ass_shaper_reorder(render_priv->shaper, text_info); - while ((last_glyph > first_glyph) - && ((last_glyph->symbol == '\n') - || (last_glyph->symbol == 0) - || (last_glyph->skip))) - last_glyph--; + // Reposition according to the map + pen.x = 0; + pen.y = 0; + int lineno = 1; + for (i = 0; i < text_info->length; i++) { + GlyphInfo *info = glyphs + cmap[i]; + if (glyphs[i].linebreak) { + pen.x = 0; + pen.y += double_to_d6(text_info->lines[lineno-1].desc); + pen.y += double_to_d6(text_info->lines[lineno].asc); + pen.y += double_to_d6(render_priv->settings.line_spacing); + lineno++; + } + if (info->skip) continue; + FT_Vector cluster_pen = pen; + while (info) { + info->pos.x = info->offset.x + cluster_pen.x; + info->pos.y = info->offset.y + cluster_pen.y; + cluster_pen.x += info->advance.x; + cluster_pen.y += info->advance.y; + info = info->next; + } + info = glyphs + cmap[i]; + pen.x += info->cluster_advance.x; + pen.y += info->cluster_advance.y; + } - width = d6_to_double( - last_glyph->pos.x + last_glyph->advance.x - - first_glyph->pos.x); + // align lines + if (render_priv->state.evt_type != EVENT_HSCROLL) { + last_break = -1; + double width = 0; + for (i = 0; i <= text_info->length; ++i) { // (text_info->length + 1) is the end of the last line + if ((i == text_info->length) || glyphs[i].linebreak) { + // remove letter spacing (which is included in cluster_advance) + if (i > 0) + width -= render_priv->state.hspacing * render_priv->font_scale * + glyphs[i-1].scale_x; + double shift = 0; if (halign == HALIGN_LEFT) { // left aligned, no action shift = 0; } else if (halign == HALIGN_RIGHT) { // right aligned @@ -1959,13 +1943,20 @@ ass_render_event(ASS_Renderer *render_pr shift = (max_text_width - width) / 2.0; } for (j = last_break + 1; j < i; ++j) { - glyphs[j].pos.x += double_to_d6(shift); + GlyphInfo *info = glyphs + j; + while (info) { + info->pos.x += double_to_d6(shift); + info = info->next; + } } last_break = i - 1; + width = 0; + } + if (i < text_info->length && !glyphs[i].skip && + glyphs[i].symbol != '\n' && glyphs[i].symbol != 0) { + width += d6_to_double(glyphs[i].cluster_advance.x); } } - } else { // render_priv->state.evt_type == EVENT_HSCROLL - measure_text(render_priv); } // determing text bounding box @@ -2091,32 +2082,38 @@ ass_render_event(ASS_Renderer *render_pr for (i = 0; i < text_info->length; ++i) { GlyphInfo *info = glyphs + i; + while (info) { + OutlineBitmapHashKey *key = &info->hash_key.u.outline; - if (info->hash_key.frx || info->hash_key.fry - || info->hash_key.frz || info->hash_key.fax - || info->hash_key.fay) { - info->hash_key.shift_x = info->pos.x + double_to_d6(device_x - center.x); - info->hash_key.shift_y = - -(info->pos.y + double_to_d6(device_y - center.y)); - } else { - info->hash_key.shift_x = 0; - info->hash_key.shift_y = 0; + if (key->frx || key->fry || key->frz || key->fax || key->fay) { + key->shift_x = info->pos.x + double_to_d6(device_x - center.x); + key->shift_y = -(info->pos.y + double_to_d6(device_y - center.y)); + } else { + key->shift_x = 0; + key->shift_y = 0; + } + info = info->next; } } } // convert glyphs to bitmaps - device_x *= render_priv->font_scale_x; + int left = render_priv->settings.left_margin; + device_x = (device_x - left) * render_priv->font_scale_x + left; for (i = 0; i < text_info->length; ++i) { - GlyphInfo *g = glyphs + i; - g->pos.x *= render_priv->font_scale_x; - g->hash_key.advance.x = - double_to_d6(device_x - (int) device_x + - d6_to_double(g->pos.x & SUBPIXEL_MASK)) & ~SUBPIXEL_ACCURACY; - g->hash_key.advance.y = - double_to_d6(device_y - (int) device_y + - d6_to_double(g->pos.y & SUBPIXEL_MASK)) & ~SUBPIXEL_ACCURACY; - get_bitmap_glyph(render_priv, glyphs + i); + GlyphInfo *info = glyphs + i; + while (info) { + OutlineBitmapHashKey *key = &info->hash_key.u.outline; + info->pos.x *= render_priv->font_scale_x; + key->advance.x = + double_to_d6(device_x - (int) device_x + + d6_to_double(info->pos.x & SUBPIXEL_MASK)) & ~SUBPIXEL_ACCURACY; + key->advance.y = + double_to_d6(device_y - (int) device_y + + d6_to_double(info->pos.y & SUBPIXEL_MASK)) & ~SUBPIXEL_ACCURACY; + get_bitmap_glyph(render_priv, info); + info = info->next; + } } memset(event_images, 0, sizeof(*event_images)); @@ -2131,6 +2128,7 @@ ass_render_event(ASS_Renderer *render_pr event_images->event = event; event_images->imgs = render_text(render_priv, (int) device_x, (int) device_y); + ass_shaper_cleanup(render_priv->shaper, text_info); free_render_context(render_priv); return 0; @@ -2154,24 +2152,16 @@ void ass_free_images(ASS_Image *img) */ static void check_cache_limits(ASS_Renderer *priv, CacheStore *cache) { - if (cache->bitmap_cache->cache_size > cache->bitmap_max_size) { - ass_msg(priv->library, MSGL_V, - "Hitting hard bitmap cache limit (was: %ld bytes), " - "resetting.", (long) cache->bitmap_cache->cache_size); - cache->bitmap_cache = ass_bitmap_cache_reset(cache->bitmap_cache); - cache->composite_cache = ass_composite_cache_reset( - cache->composite_cache); + if (ass_cache_empty(cache->bitmap_cache, cache->bitmap_max_size)) { + ass_cache_empty(cache->composite_cache, 0); ass_free_images(priv->prev_images_root); priv->prev_images_root = 0; } - - if (cache->glyph_cache->count > cache->glyph_max - || cache->glyph_cache->cache_size > cache->bitmap_max_size) { - ass_msg(priv->library, MSGL_V, - "Hitting hard glyph cache limit (was: %d glyphs, %ld bytes), " - "resetting.", - cache->glyph_cache->count, (long) cache->glyph_cache->cache_size); - cache->glyph_cache = ass_glyph_cache_reset(cache->glyph_cache); + if (ass_cache_empty(cache->outline_cache, cache->glyph_max)) { + ass_cache_empty(cache->bitmap_cache, 0); + ass_cache_empty(cache->composite_cache, 0); + ass_free_images(priv->prev_images_root); + priv->prev_images_root = 0; } } @@ -2202,7 +2192,7 @@ ass_start_frame(ASS_Renderer *render_pri render_priv->track = track; render_priv->time = now; - ass_lazy_track_init(render_priv); + ass_lazy_track_init(render_priv->library, render_priv->track); render_priv->font_scale = settings_priv->font_size_coeff * render_priv->orig_height / render_priv->track->PlayResY; @@ -2213,6 +2203,11 @@ ass_start_frame(ASS_Renderer *render_pri else render_priv->border_scale = 1.; + ass_shaper_set_kerning(render_priv->shaper, track->Kerning); + if (track->Language) + ass_shaper_set_language(render_priv->shaper, track->Language); + ass_shaper_set_level(render_priv->shaper, render_priv->settings.shaper); + // PAR correction render_priv->font_scale_x = render_priv->settings.aspect / render_priv->settings.storage_aspect; Modified: trunk/libass/ass_render.h ============================================================================== --- trunk/libass/ass_render.h Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass_render.h Sat Dec 3 22:35:56 2011 (r34383) @@ -27,6 +27,9 @@ #include FT_GLYPH_H #include FT_SYNTHESIS_H +// XXX: fix the inclusion mess so we can avoid doing this here +typedef struct ass_shaper ASS_Shaper; + #include "ass.h" #include "ass_font.h" #include "ass_bitmap.h" @@ -73,6 +76,7 @@ typedef struct { double aspect; // frame aspect ratio, d_width / d_height. double storage_aspect; // pixel ratio of the source image ASS_Hinting hinting; + ASS_ShapingLevel shaper; char *default_font; char *default_family; @@ -96,19 +100,26 @@ typedef enum { // describes a glyph // GlyphInfo and TextInfo are used for text centering and word-wrapping operations -typedef struct { +typedef struct glyph_info { unsigned symbol; unsigned skip; // skip glyph when layouting text - FT_Glyph glyph; - FT_Glyph outline_glyph; + ASS_Font *font; + int face_index; + int glyph_index; + double font_size; + ASS_Drawing *drawing; + FT_Outline *outline; + FT_Outline *border; Bitmap *bm; // glyph bitmap Bitmap *bm_o; // outline bitmap Bitmap *bm_s; // shadow bitmap FT_BBox bbox; FT_Vector pos; + FT_Vector offset; char linebreak; // the first (leading) glyph of some line ? uint32_t c[4]; // colors FT_Vector advance; // 26.6 + FT_Vector cluster_advance; Effect effect_type; int effect_timing; // time duration of current karaoke word // after process_karaoke_effects: distance in pixels from the glyph origin. @@ -121,12 +132,24 @@ typedef struct { double shadow_y; double frx, fry, frz; // rotation double fax, fay; // text shearing + double scale_x, scale_y; + double border_x, border_y; + unsigned italic; + unsigned bold; + int flags; + + int bm_run_id; + int shape_run_id; BitmapHashKey hash_key; + + // next glyph in this cluster + struct glyph_info *next; } GlyphInfo; typedef struct { double asc, desc; + int offset, len; } LineInfo; typedef struct { @@ -147,7 +170,6 @@ typedef struct { int parsed_tags; ASS_Font *font; - char *font_path; double font_size; int flags; // decoration flags (underline/strike-through) @@ -186,6 +208,9 @@ typedef struct { int effect_timing; int effect_skip_timing; + // bitmap run id (used for final bitmap rendering) + int bm_run_id; + enum { SCROLL_LR, // left-to-right SCROLL_RL, @@ -200,13 +225,14 @@ typedef struct { unsigned italic; int treat_family_as_pattern; int wrap_style; + int font_encoding; } RenderContext; typedef struct { - Hashmap *font_cache; - Hashmap *glyph_cache; - Hashmap *bitmap_cache; - Hashmap *composite_cache; + Cache *font_cache; + Cache *outline_cache; + Cache *bitmap_cache; + Cache *composite_cache; size_t glyph_max; size_t bitmap_max_size; } CacheStore; @@ -218,6 +244,7 @@ struct ass_renderer { ASS_Settings settings; int render_id; ASS_SynthPriv *synth_priv; + ASS_Shaper *shaper; ASS_Image *images_root; // rendering result is stored here ASS_Image *prev_images_root; @@ -265,4 +292,7 @@ typedef struct { void reset_render_context(ASS_Renderer *render_priv); void ass_free_images(ASS_Image *img); +// XXX: this is actually in ass.c, includes should be fixed later on +void ass_lazy_track_init(ASS_Library *lib, ASS_Track *track); + #endif /* LIBASS_RENDER_H */ Modified: trunk/libass/ass_render_api.c ============================================================================== --- trunk/libass/ass_render_api.c Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass_render_api.c Sat Dec 3 22:35:56 2011 (r34383) @@ -25,12 +25,9 @@ static void ass_reconfigure(ASS_Renderer ASS_Settings *settings = &priv->settings; priv->render_id++; - priv->cache.glyph_cache = - ass_glyph_cache_reset(priv->cache.glyph_cache); - priv->cache.bitmap_cache = - ass_bitmap_cache_reset(priv->cache.bitmap_cache); - priv->cache.composite_cache = - ass_composite_cache_reset(priv->cache.composite_cache); + ass_cache_empty(priv->cache.outline_cache, 0); + ass_cache_empty(priv->cache.bitmap_cache, 0); + ass_cache_empty(priv->cache.composite_cache, 0); ass_free_images(priv->prev_images_root); priv->prev_images_root = 0; @@ -61,6 +58,17 @@ void ass_set_frame_size(ASS_Renderer *pr } } +void ass_set_shaper(ASS_Renderer *priv, ASS_ShapingLevel level) +{ +#ifdef CONFIG_HARFBUZZ + // select the complex shaper for illegal values + if (level == ASS_SHAPING_SIMPLE || level == ASS_SHAPING_COMPLEX) + priv->settings.shaper = level; + else + priv->settings.shaper = ASS_SHAPING_COMPLEX; +#endif +} + void ass_set_margins(ASS_Renderer *priv, int t, int b, int l, int r) { if (priv->settings.left_margin != l || priv->settings.right_margin != r || Modified: trunk/libass/ass_types.h ============================================================================== --- trunk/libass/ass_types.h Sat Dec 3 22:33:28 2011 (r34382) +++ trunk/libass/ass_types.h Sat Dec 3 22:35:56 2011 (r34383) @@ -112,6 +112,7 @@ typedef struct ass_track { int WrapStyle; int ScaledBorderAndShadow; int Kerning; + char *Language; int default_style; // index of default style char *name; // file name in case of external subs, 0 for streams From subversion at mplayerhq.hu Sat Dec 3 23:06:51 2011 From: subversion at mplayerhq.hu (reimar) Date: Sat, 3 Dec 2011 23:06:51 +0100 (CET) Subject: [MPlayer-cvslog] r34384 - trunk/libvo/vo_quartz.c Message-ID: <20111203220651.2D9E81226BF@avserver.banki.hu> Author: reimar Date: Sat Dec 3 23:06:50 2011 New Revision: 34384 Log: Remove variable that is only assigned but never used. Modified: trunk/libvo/vo_quartz.c Modified: trunk/libvo/vo_quartz.c ============================================================================== --- trunk/libvo/vo_quartz.c Sat Dec 3 22:35:56 2011 (r34383) +++ trunk/libvo/vo_quartz.c Sat Dec 3 23:06:50 2011 (r34384) @@ -471,7 +471,6 @@ static void quartz_CreateWindow(uint32_t { CFStringRef titleKey; CFStringRef windowTitle; - OSStatus result; MenuItemIndex index; CFStringRef movMenuTitle; @@ -556,7 +555,7 @@ static void quartz_CreateWindow(uint32_t // Set window title titleKey = CFSTR("MPlayer - The Movie Player"); windowTitle = CFCopyLocalizedString(titleKey, NULL); - result = SetWindowTitleWithCFString(theWindow, windowTitle); + SetWindowTitleWithCFString(theWindow, windowTitle); CFRelease(titleKey); CFRelease(windowTitle); From subversion at mplayerhq.hu Sat Dec 3 23:26:47 2011 From: subversion at mplayerhq.hu (reimar) Date: Sat, 3 Dec 2011 23:26:47 +0100 (CET) Subject: [MPlayer-cvslog] r34385 - trunk/libvo/vo_quartz.c Message-ID: <20111203222647.F3E07122F5A@avserver.banki.hu> Author: reimar Date: Sat Dec 3 23:26:47 2011 New Revision: 34385 Log: Support -title with -vo quartz. Modified: trunk/libvo/vo_quartz.c Modified: trunk/libvo/vo_quartz.c ============================================================================== --- trunk/libvo/vo_quartz.c Sat Dec 3 23:06:50 2011 (r34384) +++ trunk/libvo/vo_quartz.c Sat Dec 3 23:26:47 2011 (r34385) @@ -469,9 +469,6 @@ static OSStatus WindowEventHandler(Event static void quartz_CreateWindow(uint32_t d_width, uint32_t d_height, WindowAttributes windowAttrs) { - CFStringRef titleKey; - CFStringRef windowTitle; - MenuItemIndex index; CFStringRef movMenuTitle; CFStringRef aspMenuTitle; @@ -552,13 +549,6 @@ static void quartz_CreateWindow(uint32_t CreateWindowGroup(0, &winGroup); SetWindowGroup(theWindow, winGroup); - // Set window title - titleKey = CFSTR("MPlayer - The Movie Player"); - windowTitle = CFCopyLocalizedString(titleKey, NULL); - SetWindowTitleWithCFString(theWindow, windowTitle); - CFRelease(titleKey); - CFRelease(windowTitle); - // Install event handler InstallApplicationEventHandler(NewEventHandlerUPP(KeyEventHandler), GetEventTypeCount(key_events), key_events, NULL, NULL); InstallApplicationEventHandler(NewEventHandlerUPP(MouseEventHandler), GetEventTypeCount(mouse_events), mouse_events, NULL, NULL); @@ -608,6 +598,7 @@ static void free_video_specific(void) static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) { + CFStringRef windowTitle; WindowAttributes windowAttrs; OSErr qterr; CGRect tmpBounds; @@ -669,6 +660,11 @@ static int config(uint32_t width, uint32 SizeWindow(theWindow, d_width, d_height, 1); } + // Set window title + windowTitle = CFStringCreateWithCString(NULL, vo_wintitle ? vo_wintitle : title, kCFStringEncodingUTF8); + SetWindowTitleWithCFString(theWindow, windowTitle); + CFRelease(windowTitle); + switch (image_format) { case IMGFMT_RGB32: From subversion at mplayerhq.hu Sat Dec 3 23:29:25 2011 From: subversion at mplayerhq.hu (cboesch) Date: Sat, 3 Dec 2011 23:29:25 +0100 (CET) Subject: [MPlayer-cvslog] r34386 - trunk/libmpcodecs/vd_ffmpeg.c Message-ID: <20111203222925.86F97122F47@avserver.banki.hu> Author: cboesch Date: Sat Dec 3 23:29:25 2011 New Revision: 34386 Log: vd_ffmpeg: fix comment typo (sepcified ? specified) Modified: trunk/libmpcodecs/vd_ffmpeg.c Modified: trunk/libmpcodecs/vd_ffmpeg.c ============================================================================== --- trunk/libmpcodecs/vd_ffmpeg.c Sat Dec 3 23:26:47 2011 (r34385) +++ trunk/libmpcodecs/vd_ffmpeg.c Sat Dec 3 23:29:25 2011 (r34386) @@ -180,7 +180,7 @@ static int control(sh_video_t *sh, int c avcodec_flush_buffers(avctx); return CONTROL_TRUE; case VDCTRL_QUERY_UNSEEN_FRAMES: - // "has_b_frames" contains the (e.g. reorder) delay as sepcified + // "has_b_frames" contains the (e.g. reorder) delay as specified // in the standard. "delay" contains the libavcodec-specific delay // e.g. due to frame multithreading return avctx->has_b_frames + avctx->delay + 10; From subversion at mplayerhq.hu Sat Dec 3 23:36:50 2011 From: subversion at mplayerhq.hu (reimar) Date: Sat, 3 Dec 2011 23:36:50 +0100 (CET) Subject: [MPlayer-cvslog] r34387 - trunk/libvo/vo_corevideo.m Message-ID: <20111203223650.BB2AE122EDD@avserver.banki.hu> Author: reimar Date: Sat Dec 3 23:36:50 2011 New Revision: 34387 Log: Support -title for -vo corevideo. Modified: trunk/libvo/vo_corevideo.m Modified: trunk/libvo/vo_corevideo.m ============================================================================== --- trunk/libvo/vo_corevideo.m Sat Dec 3 23:29:25 2011 (r34386) +++ trunk/libvo/vo_corevideo.m Sat Dec 3 23:36:50 2011 (r34387) @@ -203,6 +203,7 @@ static int config(uint32_t width, uint32 //config OpenGL View [mpGLView config]; [mpGLView reshape]; + [[mpGLView window] setTitle:[NSString stringWithCString:vo_wintitle ? vo_wintitle : title]]; } else { From subversion at mplayerhq.hu Sun Dec 4 00:08:03 2011 From: subversion at mplayerhq.hu (reimar) Date: Sun, 4 Dec 2011 00:08:03 +0100 (CET) Subject: [MPlayer-cvslog] r34388 - in trunk/libass: ass_shaper.c ass_shaper.h Message-ID: <20111203230803.9A4DD122F4B@avserver.banki.hu> Author: reimar Date: Sun Dec 4 00:08:03 2011 New Revision: 34388 Log: Commit added forgotten in previous commit. Added: trunk/libass/ass_shaper.c trunk/libass/ass_shaper.h Added: trunk/libass/ass_shaper.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/libass/ass_shaper.c Sun Dec 4 00:08:03 2011 (r34388) @@ -0,0 +1,733 @@ +/* + * Copyright (C) 2011 Grigori Goronzy + * + * This file is part of libass. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "config.h" + +#include + +#include "ass_shaper.h" +#include "ass_render.h" +#include "ass_font.h" +#include "ass_parse.h" +#include "ass_cache.h" + +#define MAX_RUNS 50 + +#ifdef CONFIG_HARFBUZZ +#include +enum { + VERT = 0, + VKNA, + KERN +}; +#define NUM_FEATURES 3 +#endif + +struct ass_shaper { + ASS_ShapingLevel shaping_level; + + // FriBidi log2vis + int n_glyphs; + FriBidiChar *event_text; + FriBidiCharType *ctypes; + FriBidiLevel *emblevels; + FriBidiStrIndex *cmap; + FriBidiParType base_direction; + +#ifdef CONFIG_HARFBUZZ + // OpenType features + int n_features; + hb_feature_t *features; + hb_language_t language; + + // Glyph metrics cache, to speed up shaping + Cache *metrics_cache; +#endif +}; + +#ifdef CONFIG_HARFBUZZ +struct ass_shaper_metrics_data { + Cache *metrics_cache; + GlyphMetricsHashKey hash_key; + int vertical; +}; + +struct ass_shaper_font_data { + hb_font_t *fonts[ASS_FONT_MAX_FACES]; + hb_font_funcs_t *font_funcs[ASS_FONT_MAX_FACES]; + struct ass_shaper_metrics_data *metrics_data[ASS_FONT_MAX_FACES]; +}; +#endif + +/** + * \brief Print version information + */ +void ass_shaper_info(ASS_Library *lib) +{ + ass_msg(lib, MSGL_V, "Shaper: FriBidi " + FRIBIDI_VERSION " (SIMPLE)" +#ifdef CONFIG_HARFBUZZ + " HarfBuzz-ng %s (COMPLEX)", hb_version_string() +#endif + ); +} + +/** + * \brief grow arrays, if needed + * \param new_size requested size + */ +static void check_allocations(ASS_Shaper *shaper, size_t new_size) +{ + if (new_size > shaper->n_glyphs) { + shaper->event_text = realloc(shaper->event_text, sizeof(FriBidiChar) * new_size); + shaper->ctypes = realloc(shaper->ctypes, sizeof(FriBidiCharType) * new_size); + shaper->emblevels = realloc(shaper->emblevels, sizeof(FriBidiLevel) * new_size); + shaper->cmap = realloc(shaper->cmap, sizeof(FriBidiStrIndex) * new_size); + } +} + +/** + * \brief Free shaper and related data + */ +void ass_shaper_free(ASS_Shaper *shaper) +{ +#ifdef CONFIG_HARFBUZZ + ass_cache_done(shaper->metrics_cache); + free(shaper->features); +#endif + free(shaper->event_text); + free(shaper->ctypes); + free(shaper->emblevels); + free(shaper->cmap); + free(shaper); +} + +void ass_shaper_font_data_free(ASS_ShaperFontData *priv) +{ +#ifdef CONFIG_HARFBUZZ + int i; + for (i = 0; i < ASS_FONT_MAX_FACES; i++) + if (priv->fonts[i]) { + free(priv->metrics_data[i]); + hb_font_destroy(priv->fonts[i]); + hb_font_funcs_destroy(priv->font_funcs[i]); + } + free(priv); +#endif +} + +#ifdef CONFIG_HARFBUZZ +/** + * \brief set up the HarfBuzz OpenType feature list with some + * standard features. + */ +static void init_features(ASS_Shaper *shaper) +{ + shaper->features = calloc(sizeof(hb_feature_t), NUM_FEATURES); + + shaper->n_features = NUM_FEATURES; + shaper->features[VERT].tag = HB_TAG('v', 'e', 'r', 't'); + shaper->features[VERT].end = INT_MAX; + shaper->features[VKNA].tag = HB_TAG('v', 'k', 'n', 'a'); + shaper->features[VKNA].end = INT_MAX; + shaper->features[KERN].tag = HB_TAG('k', 'e', 'r', 'n'); + shaper->features[KERN].end = INT_MAX; +} + +/** + * \brief Set features depending on properties of the run + */ +static void set_run_features(ASS_Shaper *shaper, GlyphInfo *info) +{ + // enable vertical substitutions for @font runs + if (info->font->desc.vertical) + shaper->features[VERT].value = shaper->features[VKNA].value = 1; + else + shaper->features[VERT].value = shaper->features[VKNA].value = 0; +} + +/** + * \brief Update HarfBuzz's idea of font metrics + * \param hb_font HarfBuzz font + * \param face associated FreeType font face + */ +static void update_hb_size(hb_font_t *hb_font, FT_Face face) +{ + hb_font_set_scale (hb_font, + ((uint64_t) face->size->metrics.x_scale * (uint64_t) face->units_per_EM) >> 16, + ((uint64_t) face->size->metrics.y_scale * (uint64_t) face->units_per_EM) >> 16); + hb_font_set_ppem (hb_font, face->size->metrics.x_ppem, + face->size->metrics.y_ppem); +} + + +/* + * Cached glyph metrics getters follow + * + * These functions replace HarfBuzz' standard FreeType font functions + * and provide cached access to essential glyph metrics. This usually + * speeds up shaping a lot. It also allows us to use custom load flags. + * + */ + +GlyphMetricsHashValue * +get_cached_metrics(struct ass_shaper_metrics_data *metrics, FT_Face face, + hb_codepoint_t glyph) +{ + GlyphMetricsHashValue *val; + + metrics->hash_key.glyph_index = glyph; + val = ass_cache_get(metrics->metrics_cache, &metrics->hash_key); + + if (!val) { + int load_flags = FT_LOAD_DEFAULT | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH + | FT_LOAD_IGNORE_TRANSFORM; + GlyphMetricsHashValue new_val; + + if (FT_Load_Glyph(face, glyph, load_flags)) + return NULL; + + memcpy(&new_val.metrics, &face->glyph->metrics, sizeof(FT_Glyph_Metrics)); + val = ass_cache_put(metrics->metrics_cache, &metrics->hash_key, &new_val); + } + + return val; +} + +static hb_bool_t +get_glyph(hb_font_t *font, void *font_data, hb_codepoint_t unicode, + hb_codepoint_t variation, hb_codepoint_t *glyph, void *user_data) +{ + FT_Face face = font_data; + + if (variation) + *glyph = FT_Face_GetCharVariantIndex(face, unicode, variation); + else + *glyph = FT_Get_Char_Index(face, unicode); + + return *glyph != 0; +} + +static hb_position_t +cached_h_advance(hb_font_t *font, void *font_data, hb_codepoint_t glyph, + void *user_data) +{ + FT_Face face = font_data; + struct ass_shaper_metrics_data *metrics_priv = user_data; + GlyphMetricsHashValue *metrics = get_cached_metrics(metrics_priv, face, glyph); + + if (!metrics) + return 0; + + if (metrics_priv->vertical && glyph > VERTICAL_LOWER_BOUND) + return metrics->metrics.vertAdvance; + + return metrics->metrics.horiAdvance; +} + +static hb_position_t +cached_v_advance(hb_font_t *font, void *font_data, hb_codepoint_t glyph, + void *user_data) +{ + FT_Face face = font_data; + struct ass_shaper_metrics_data *metrics_priv = user_data; + GlyphMetricsHashValue *metrics = get_cached_metrics(metrics_priv, face, glyph); + + if (!metrics) + return 0; + + return metrics->metrics.vertAdvance; + +} + +static hb_bool_t +cached_h_origin(hb_font_t *font, void *font_data, hb_codepoint_t glyph, + hb_position_t *x, hb_position_t *y, void *user_data) +{ + return 1; +} + +static hb_bool_t +cached_v_origin(hb_font_t *font, void *font_data, hb_codepoint_t glyph, + hb_position_t *x, hb_position_t *y, void *user_data) +{ + FT_Face face = font_data; + struct ass_shaper_metrics_data *metrics_priv = user_data; + GlyphMetricsHashValue *metrics = get_cached_metrics(metrics_priv, face, glyph); + + if (!metrics) + return 0; + + *x = metrics->metrics.horiBearingX - metrics->metrics.vertBearingX; + *y = metrics->metrics.horiBearingY - (-metrics->metrics.vertBearingY); + + return 1; +} + +static hb_position_t +get_h_kerning(hb_font_t *font, void *font_data, hb_codepoint_t first, + hb_codepoint_t second, void *user_data) +{ + FT_Face face = font_data; + FT_Vector kern; + + if (FT_Get_Kerning (face, first, second, FT_KERNING_DEFAULT, &kern)) + return 0; + + return kern.x; +} + +static hb_position_t +get_v_kerning(hb_font_t *font, void *font_data, hb_codepoint_t first, + hb_codepoint_t second, void *user_data) +{ + return 0; +} + +static hb_bool_t +cached_extents(hb_font_t *font, void *font_data, hb_codepoint_t glyph, + hb_glyph_extents_t *extents, void *user_data) +{ + FT_Face face = font_data; + struct ass_shaper_metrics_data *metrics_priv = user_data; + GlyphMetricsHashValue *metrics = get_cached_metrics(metrics_priv, face, glyph); + + if (!metrics) + return 0; + + extents->x_bearing = metrics->metrics.horiBearingX; + extents->y_bearing = metrics->metrics.horiBearingY; + extents->width = metrics->metrics.width; + extents->height = metrics->metrics.height; + + return 1; +} + +static hb_bool_t +get_contour_point(hb_font_t *font, void *font_data, hb_codepoint_t glyph, + unsigned int point_index, hb_position_t *x, + hb_position_t *y, void *user_data) +{ + FT_Face face = font_data; + int load_flags = FT_LOAD_DEFAULT | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH + | FT_LOAD_IGNORE_TRANSFORM; + + if (FT_Load_Glyph(face, glyph, load_flags)) + return 0; + + if (point_index >= (unsigned)face->glyph->outline.n_points) + return 0; + + *x = face->glyph->outline.points[point_index].x; + *y = face->glyph->outline.points[point_index].y; + + return 1; +} + +/** + * \brief Retrieve HarfBuzz font from cache. + * Create it from FreeType font, if needed. + * \param info glyph cluster + * \return HarfBuzz font + */ +static hb_font_t *get_hb_font(ASS_Shaper *shaper, GlyphInfo *info) +{ + ASS_Font *font = info->font; + hb_font_t **hb_fonts; + + if (!font->shaper_priv) + font->shaper_priv = calloc(sizeof(ASS_ShaperFontData), 1); + + + hb_fonts = font->shaper_priv->fonts; + if (!hb_fonts[info->face_index]) { + hb_fonts[info->face_index] = + hb_ft_font_create(font->faces[info->face_index], NULL); + + // set up cached metrics access + font->shaper_priv->metrics_data[info->face_index] = + calloc(sizeof(struct ass_shaper_metrics_data), 1); + struct ass_shaper_metrics_data *metrics = + font->shaper_priv->metrics_data[info->face_index]; + metrics->metrics_cache = shaper->metrics_cache; + metrics->vertical = info->font->desc.vertical; + + hb_font_funcs_t *funcs = hb_font_funcs_create(); + font->shaper_priv->font_funcs[info->face_index] = funcs; + hb_font_funcs_set_glyph_func(funcs, get_glyph, + metrics, NULL); + hb_font_funcs_set_glyph_h_advance_func(funcs, cached_h_advance, + metrics, NULL); + hb_font_funcs_set_glyph_v_advance_func(funcs, cached_v_advance, + metrics, NULL); + hb_font_funcs_set_glyph_h_origin_func(funcs, cached_h_origin, + metrics, NULL); + hb_font_funcs_set_glyph_v_origin_func(funcs, cached_v_origin, + metrics, NULL); + hb_font_funcs_set_glyph_h_kerning_func(funcs, get_h_kerning, + metrics, NULL); + hb_font_funcs_set_glyph_v_kerning_func(funcs, get_v_kerning, + metrics, NULL); + hb_font_funcs_set_glyph_extents_func(funcs, cached_extents, + metrics, NULL); + hb_font_funcs_set_glyph_contour_point_func(funcs, get_contour_point, + metrics, NULL); + hb_font_set_funcs(hb_fonts[info->face_index], funcs, + font->faces[info->face_index], NULL); + } + + ass_face_set_size(font->faces[info->face_index], info->font_size); + update_hb_size(hb_fonts[info->face_index], font->faces[info->face_index]); + + // update hash key for cached metrics + struct ass_shaper_metrics_data *metrics = + font->shaper_priv->metrics_data[info->face_index]; + metrics->hash_key.font = info->font; + metrics->hash_key.face_index = info->face_index; + metrics->hash_key.size = info->font_size; + metrics->hash_key.scale_x = double_to_d6(info->scale_x); + metrics->hash_key.scale_y = double_to_d6(info->scale_y); + + return hb_fonts[info->face_index]; +} + +/** + * \brief Shape event text with HarfBuzz. Full OpenType shaping. + * \param glyphs glyph clusters + * \param len number of clusters + */ +static void shape_harfbuzz(ASS_Shaper *shaper, GlyphInfo *glyphs, size_t len) +{ + int i, j; + int run = 0; + struct { + int offset; + int end; + hb_buffer_t *buf; + hb_font_t *font; + } runs[MAX_RUNS]; + + + for (i = 0; i < len && run < MAX_RUNS; i++, run++) { + // get length and level of the current run + int k = i; + int level = glyphs[i].shape_run_id; + int direction = shaper->emblevels[k] % 2; + while (i < (len - 1) && level == glyphs[i+1].shape_run_id) + i++; + runs[run].offset = k; + runs[run].end = i; + runs[run].buf = hb_buffer_create(); + runs[run].font = get_hb_font(shaper, glyphs + k); + set_run_features(shaper, glyphs + k); + hb_buffer_pre_allocate(runs[run].buf, i - k + 1); + hb_buffer_set_direction(runs[run].buf, direction ? HB_DIRECTION_RTL : + HB_DIRECTION_LTR); + hb_buffer_set_language(runs[run].buf, shaper->language); + hb_buffer_add_utf32(runs[run].buf, shaper->event_text + k, i - k + 1, + 0, i - k + 1); + hb_shape(runs[run].font, runs[run].buf, shaper->features, + shaper->n_features); + } + + // Initialize: skip all glyphs, this is undone later as needed + for (i = 0; i < len; i++) + glyphs[i].skip = 1; + + // Update glyph indexes, positions and advances from the shaped runs + for (i = 0; i < run; i++) { + int num_glyphs = hb_buffer_get_length(runs[i].buf); + hb_glyph_info_t *glyph_info = hb_buffer_get_glyph_infos(runs[i].buf, NULL); + hb_glyph_position_t *pos = hb_buffer_get_glyph_positions(runs[i].buf, NULL); + + for (j = 0; j < num_glyphs; j++) { + int idx = glyph_info[j].cluster + runs[i].offset; + GlyphInfo *info = glyphs + idx; + GlyphInfo *root = info; + + // if we have more than one glyph per cluster, allocate a new one + // and attach to the root glyph + if (info->skip == 0) { + while (info->next) + info = info->next; + info->next = malloc(sizeof(GlyphInfo)); + memcpy(info->next, info, sizeof(GlyphInfo)); + info = info->next; + info->next = NULL; + } + + // set position and advance + info->skip = 0; + info->glyph_index = glyph_info[j].codepoint; + info->offset.x = pos[j].x_offset * info->scale_x; + info->offset.y = -pos[j].y_offset * info->scale_y; + info->advance.x = pos[j].x_advance * info->scale_x; + info->advance.y = -pos[j].y_advance * info->scale_y; + + // accumulate advance in the root glyph + root->cluster_advance.x += info->advance.x; + root->cluster_advance.y += info->advance.y; + } + } + + // Free runs and associated data + for (i = 0; i < run; i++) { + hb_buffer_destroy(runs[i].buf); + } + +} +#endif + +/** + * \brief Shape event text with FriBidi. Does mirroring and simple + * Arabic shaping. + * \param len number of clusters + */ +static void shape_fribidi(ASS_Shaper *shaper, GlyphInfo *glyphs, size_t len) +{ + int i; + FriBidiJoiningType *joins = calloc(sizeof(*joins), len); + + // shape on codepoint level + fribidi_get_joining_types(shaper->event_text, len, joins); + fribidi_join_arabic(shaper->ctypes, len, shaper->emblevels, joins); + fribidi_shape(FRIBIDI_FLAGS_DEFAULT | FRIBIDI_FLAGS_ARABIC, + shaper->emblevels, len, joins, shaper->event_text); + + // update indexes + for (i = 0; i < len; i++) { + GlyphInfo *info = glyphs + i; + FT_Face face = info->font->faces[info->face_index]; + info->symbol = shaper->event_text[i]; + info->glyph_index = FT_Get_Char_Index(face, shaper->event_text[i]); + } + + free(joins); +} + +/** + * \brief Toggle kerning for HarfBuzz shaping. + * NOTE: currently only works with OpenType fonts, the TrueType fallback *always* + * kerns. It's a bug in HarfBuzz. + */ +void ass_shaper_set_kerning(ASS_Shaper *shaper, int kern) +{ +#ifdef CONFIG_HARFBUZZ + shaper->features[KERN].value = !!kern; +#endif +} + +/** + * \brief Find shape runs according to the event's selected fonts + */ +void ass_shaper_find_runs(ASS_Shaper *shaper, ASS_Renderer *render_priv, + GlyphInfo *glyphs, size_t len) +{ + int i; + int shape_run = 0; + + for (i = 0; i < len; i++) { + GlyphInfo *last = glyphs + i - 1; + GlyphInfo *info = glyphs + i; + // skip drawings + if (info->symbol == 0xfffc) + continue; + // set size and get glyph index + ass_font_get_index(render_priv->fontconfig_priv, info->font, + info->symbol, &info->face_index, &info->glyph_index); + // shape runs share the same font face and size + if (i > 0 && (last->font != info->font || + last->font_size != info->font_size || + last->face_index != info->face_index)) + shape_run++; + info->shape_run_id = shape_run; + } + +} + +/** + * \brief Set base direction (paragraph direction) of the text. + * \param dir base direction + */ +void ass_shaper_set_base_direction(ASS_Shaper *shaper, FriBidiParType dir) +{ + shaper->base_direction = dir; +} + +/** + * \brief Set language hint. Some languages have specific character variants, + * like Serbian Cyrillic. + * \param lang ISO 639-1 two-letter language code + */ +void ass_shaper_set_language(ASS_Shaper *shaper, const char *code) +{ +#ifdef CONFIG_HARFBUZZ + shaper->language = hb_language_from_string(code, -1); +#endif +} + +/** + * Set shaping level. Essentially switches between FriBidi and HarfBuzz. + */ +void ass_shaper_set_level(ASS_Shaper *shaper, ASS_ShapingLevel level) +{ + shaper->shaping_level = level; +} + +/** + * \brief Shape an event's text. Calculates directional runs and shapes them. + * \param text_info event's text + */ +void ass_shaper_shape(ASS_Shaper *shaper, TextInfo *text_info) +{ + int i, last_break; + FriBidiParType dir; + GlyphInfo *glyphs = text_info->glyphs; + + check_allocations(shaper, text_info->length); + + // Get bidi character types and embedding levels + last_break = 0; + for (i = 0; i < text_info->length; i++) { + shaper->event_text[i] = glyphs[i].symbol; + // embedding levels should be calculated paragraph by paragraph + if (glyphs[i].symbol == '\n' || i == text_info->length - 1) { + dir = shaper->base_direction; + fribidi_get_bidi_types(shaper->event_text + last_break, + i - last_break + 1, shaper->ctypes + last_break); + fribidi_get_par_embedding_levels(shaper->ctypes + last_break, + i - last_break + 1, &dir, shaper->emblevels + last_break); + last_break = i + 1; + } + } + + // add embedding levels to shape runs for final runs + for (i = 0; i < text_info->length; i++) { + glyphs[i].shape_run_id += shaper->emblevels[i]; + } + +#ifdef CONFIG_HARFBUZZ + switch (shaper->shaping_level) { + case ASS_SHAPING_SIMPLE: + shape_fribidi(shaper, glyphs, text_info->length); + break; + case ASS_SHAPING_COMPLEX: + shape_harfbuzz(shaper, glyphs, text_info->length); + break; + } +#else + shape_fribidi(shaper, glyphs, text_info->length); +#endif + + + // clean up + for (i = 0; i < text_info->length; i++) { + // Skip direction override control characters + // NOTE: Behdad said HarfBuzz is supposed to remove these, but this hasn't + // been implemented yet + if (glyphs[i].symbol <= 0x202F && glyphs[i].symbol >= 0x202a) { + glyphs[i].symbol = 0; + glyphs[i].skip++; + } + } +} + +/** + * \brief Create a new shaper instance and preallocate data structures + * \param prealloc preallocation size + */ +ASS_Shaper *ass_shaper_new(size_t prealloc) +{ + ASS_Shaper *shaper = calloc(sizeof(*shaper), 1); + + shaper->base_direction = FRIBIDI_PAR_ON; + check_allocations(shaper, prealloc); + +#ifdef CONFIG_HARFBUZZ + init_features(shaper); + shaper->metrics_cache = ass_glyph_metrics_cache_create(); +#endif + + return shaper; +} + + +/** + * \brief clean up additional data temporarily needed for shaping and + * (e.g. additional glyphs allocated) + */ +void ass_shaper_cleanup(ASS_Shaper *shaper, TextInfo *text_info) +{ + int i; + + for (i = 0; i < text_info->length; i++) { + GlyphInfo *info = text_info->glyphs + i; + info = info->next; + while (info) { + GlyphInfo *next = info->next; + free(info); + info = next; + } + } +} + +/** + * \brief Calculate reorder map to render glyphs in visual order + */ +FriBidiStrIndex *ass_shaper_reorder(ASS_Shaper *shaper, TextInfo *text_info) +{ + int i; + + // Initialize reorder map + for (i = 0; i < text_info->length; i++) + shaper->cmap[i] = i; + + // Create reorder map line-by-line + for (i = 0; i < text_info->n_lines; i++) { + LineInfo *line = text_info->lines + i; + int level; + FriBidiParType dir = FRIBIDI_PAR_ON; + + level = fribidi_reorder_line(0, + shaper->ctypes + line->offset, line->len, 0, dir, + shaper->emblevels + line->offset, NULL, + shaper->cmap + line->offset); + } + + return shaper->cmap; +} + +/** + * \brief Resolve a Windows font encoding number to a suitable + * base direction. 177 and 178 are Hebrew and Arabic respectively, and + * they map to RTL. 1 is autodetection and is mapped to just that. + * Everything else is mapped to LTR. + * \param enc Windows font encoding + */ +FriBidiParType resolve_base_direction(int enc) +{ + switch (enc) { + case 1: + return FRIBIDI_PAR_ON; + case 177: + case 178: + return FRIBIDI_PAR_RTL; + default: + return FRIBIDI_PAR_LTR; + } +} Added: trunk/libass/ass_shaper.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/libass/ass_shaper.h Sun Dec 4 00:08:03 2011 (r34388) @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011 Grigori Goronzy + * + * This file is part of libass. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef LIBASS_SHAPER_H +#define LIBASS_SHAPER_H + +#include "config.h" + +#include +#include "ass_render.h" + +void ass_shaper_info(ASS_Library *lib); +ASS_Shaper *ass_shaper_new(size_t prealloc); +void ass_shaper_free(ASS_Shaper *shaper); +void ass_shaper_set_kerning(ASS_Shaper *shaper, int kern); +void ass_shaper_find_runs(ASS_Shaper *shaper, ASS_Renderer *render_priv, + GlyphInfo *glyphs, size_t len); +void ass_shaper_set_base_direction(ASS_Shaper *shaper, FriBidiParType dir); +void ass_shaper_set_language(ASS_Shaper *shaper, const char *code); +void ass_shaper_set_level(ASS_Shaper *shaper, ASS_ShapingLevel level); +void ass_shaper_shape(ASS_Shaper *shaper, TextInfo *text_info); +void ass_shaper_cleanup(ASS_Shaper *shaper, TextInfo *text_info); +FriBidiStrIndex *ass_shaper_reorder(ASS_Shaper *shaper, TextInfo *text_info); +FriBidiParType resolve_base_direction(int font_encoding); + +void ass_shaper_font_data_free(ASS_ShaperFontData *priv); + +#endif From yumkam at mail.ru Sun Dec 4 10:06:31 2011 From: yumkam at mail.ru (Yuriy Kaminskiy) Date: Sun, 04 Dec 2011 13:06:31 +0400 Subject: [MPlayer-cvslog] r34388 - in trunk/libass: ass_shaper.c ass_shaper.h In-Reply-To: <20111203230803.9A4DD122F4B@avserver.banki.hu> References: <20111203230803.9A4DD122F4B@avserver.banki.hu> Message-ID: reimar wrote: > Author: reimar > Date: Sun Dec 4 00:08:03 2011 > New Revision: 34388 > > Log: > Commit added forgotten in previous commit. > > Added: > trunk/libass/ass_shaper.c > trunk/libass/ass_shaper.h > [...] > Added: trunk/libass/ass_shaper.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ trunk/libass/ass_shaper.h Sun Dec 4 00:08:03 2011 (r34388) > @@ -0,0 +1,43 @@ > +/* ... > + */ > + > +#ifndef LIBASS_SHAPER_H > +#define LIBASS_SHAPER_H > + > +#include "config.h" > + > +#include 1) now ass-internal unconditionally requires fribidi (missing configure check); not sure about version check - maybe it should be updated too; external libass configure.ac says it requires fribidi >= 0.19.0, mplayer's configure seems accept earlier versions; 2) missing configure check for CONFIG_HARFBUZZ; From Reimar.Doeffinger at gmx.de Sun Dec 4 10:40:00 2011 From: Reimar.Doeffinger at gmx.de (Reimar =?iso-8859-1?Q?D=F6ffinger?=) Date: Sun, 4 Dec 2011 10:40:00 +0100 Subject: [MPlayer-cvslog] r34388 - in trunk/libass: ass_shaper.c ass_shaper.h In-Reply-To: References: <20111203230803.9A4DD122F4B@avserver.banki.hu> Message-ID: <20111204094000.GA2908@1und1.de> On Sun, Dec 04, 2011 at 01:06:31PM +0400, Yuriy Kaminskiy wrote: > reimar wrote: > > Author: reimar > > Date: Sun Dec 4 00:08:03 2011 > > New Revision: 34388 > > > > Log: > > Commit added forgotten in previous commit. > > > > Added: > > trunk/libass/ass_shaper.c > > trunk/libass/ass_shaper.h > > > [...] > > Added: trunk/libass/ass_shaper.h > > ============================================================================== > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ trunk/libass/ass_shaper.h Sun Dec 4 00:08:03 2011 (r34388) > > @@ -0,0 +1,43 @@ > > +/* > ... > > + */ > > + > > +#ifndef LIBASS_SHAPER_H > > +#define LIBASS_SHAPER_H > > + > > +#include "config.h" > > + > > +#include > > 1) now ass-internal unconditionally requires fribidi (missing configure check); > not sure about version check - maybe it should be updated too; external libass > configure.ac says it requires fribidi >= 0.19.0, mplayer's configure seems > accept earlier versions; Ugh, my fault for not checking more carefully. fribidi seems to me like nothing that should be required, how many users does it affect? < 1%? Unfortunately the way it was designed it seems near impossible to extract. > 2) missing configure check for CONFIG_HARFBUZZ; Actually that was intentional, doesn't seem all that useful and people can still link against external libass. Rather configure should be changed to prefer external unless it is (seriously) outdated. From subversion at mplayerhq.hu Sun Dec 4 14:30:54 2011 From: subversion at mplayerhq.hu (reimar) Date: Sun, 4 Dec 2011 14:30:54 +0100 (CET) Subject: [MPlayer-cvslog] r34389 - trunk/libvo/x11_common.c Message-ID: <20111204133055.1149F123143@avserver.banki.hu> Author: reimar Date: Sun Dec 4 14:30:54 2011 New Revision: 34389 Log: Add workaround for CTRL key getting stuck for X11 backend due to the KeyRelease event going somewhere else. Modified: trunk/libvo/x11_common.c Modified: trunk/libvo/x11_common.c ============================================================================== --- trunk/libvo/x11_common.c Sun Dec 4 00:08:03 2011 (r34388) +++ trunk/libvo/x11_common.c Sun Dec 4 14:30:54 2011 (r34389) @@ -812,6 +812,7 @@ int vo_x11_check_events(Display * mydisp char buf[100]; KeySym keySym; static XComposeStatus stat; + static int ctrl_state; if (vo_mouse_autohide && mouse_waiting_hide && (GetTimerMS() - mouse_timer >= 1000)) { @@ -858,11 +859,22 @@ int vo_x11_check_events(Display * mydisp ((keySym & 0xff00) != 0 ? ((keySym & 0x00ff) + 256) : (keySym)); if (key == wsLeftCtrl || key == wsRightCtrl) { + ctrl_state = Event.type == KeyPress; mplayer_put_key(KEY_CTRL | - (Event.type == KeyPress ? MP_KEY_DOWN : 0)); + (ctrl_state ? MP_KEY_DOWN : 0)); } else if (Event.type == KeyRelease) { break; - } else if (!vo_x11_putkey_ext(keySym)) { + } + // Attempt to fix if somehow our state got out of + // sync with reality. + // This usually happens when a shortcut involving CTRL + // was used to switch to a different window/workspace. + if (ctrl_state != !!(Event.xkey.state & 4)) { + ctrl_state = !!(Event.xkey.state & 4); + mplayer_put_key(KEY_CTRL | + (ctrl_state ? MP_KEY_DOWN : 0)); + } + if (!vo_x11_putkey_ext(keySym)) { vo_x11_putkey(key); } ret |= VO_EVENT_KEYPRESS; From subversion at mplayerhq.hu Sun Dec 4 23:41:32 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Sun, 4 Dec 2011 23:41:32 +0100 (CET) Subject: [MPlayer-cvslog] r34390 - in trunk: etc/codecs.conf libmpdemux/mp_taglists.c Message-ID: <20111204224132.99356121996@avserver.banki.hu> Author: cehoyos Date: Sun Dec 4 23:41:31 2011 New Revision: 34390 Log: Map FFmpeg's Escape 124 decoder to new MPlayer internal FourCC. Based on a patch by Paul B. Mahol, onemda gmail Playback does not work correctly. Partially fixes bug 2023. Modified: trunk/etc/codecs.conf trunk/libmpdemux/mp_taglists.c Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Sun Dec 4 14:30:54 2011 (r34389) +++ trunk/etc/codecs.conf Sun Dec 4 23:41:31 2011 (r34390) @@ -3543,6 +3543,14 @@ videocodec ffeatgv dll eatgv out BGR8 +videocodec ffescape124 + info "FFmpeg Escape 124" + status buggy + fourcc E124 ; internal MPlayer FourCC + driver ffmpeg + dll escape124 + out BGR15 + ; raw formats: (now RGB formats are autodetected) ; these raw codecs are used mostly by TV input Modified: trunk/libmpdemux/mp_taglists.c ============================================================================== --- trunk/libmpdemux/mp_taglists.c Sun Dec 4 14:30:54 2011 (r34389) +++ trunk/libmpdemux/mp_taglists.c Sun Dec 4 23:41:31 2011 (r34390) @@ -81,6 +81,7 @@ static const struct AVCodecTag mp_codeci { CODEC_ID_DTS, 0x2001}, { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'd')}, { CODEC_ID_EAC3, MKTAG('E', 'A', 'C', '3')}, + { CODEC_ID_ESCAPE124, MKTAG('E', '1', '2', '4')}, { CODEC_ID_FLV1, MKTAG('F', 'L', 'V', '1')}, { CODEC_ID_G729, MKTAG('G', '7', '2', '9')}, { CODEC_ID_H264, MKTAG('H', '2', '6', '4')}, From subversion at mplayerhq.hu Sun Dec 4 23:52:58 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Sun, 4 Dec 2011 23:52:58 +0100 (CET) Subject: [MPlayer-cvslog] r34391 - in trunk: etc/codecs.conf libmpdemux/mp_taglists.c Message-ID: <20111204225258.59DCC1231C8@avserver.banki.hu> Author: cehoyos Date: Sun Dec 4 23:52:58 2011 New Revision: 34391 Log: Support FFmpeg vdmaudio decoder. Patch by Paul B. Mahol, onemda gmail Modified: trunk/etc/codecs.conf trunk/libmpdemux/mp_taglists.c Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Sun Dec 4 23:41:31 2011 (r34390) +++ trunk/etc/codecs.conf Sun Dec 4 23:52:58 2011 (r34391) @@ -5114,6 +5114,13 @@ audiocodec hwdts format 0x2001 driver hwac3 +audiocodec ffvmdaudio + info "FFmpeg Sierra VMD audio" + status working + fourcc VMDA ; intermal MPlayer FourCC + driver ffmpeg + dll "vmdaudio" + audiocodec ffvorbis info "FFmpeg Vorbis" status working Modified: trunk/libmpdemux/mp_taglists.c ============================================================================== --- trunk/libmpdemux/mp_taglists.c Sun Dec 4 23:41:31 2011 (r34390) +++ trunk/libmpdemux/mp_taglists.c Sun Dec 4 23:52:58 2011 (r34391) @@ -62,6 +62,7 @@ static const struct AVCodecTag mp_wav_ta { CODEC_ID_SPEEX, MKTAG('s', 'p', 'x', ' ')}, { CODEC_ID_TTA, MKTAG('T', 'T', 'A', '1')}, { CODEC_ID_TWINVQ, MKTAG('T', 'W', 'I', '2')}, + { CODEC_ID_VMDAUDIO, MKTAG('V', 'M', 'D', 'A')}, { CODEC_ID_WAVPACK, MKTAG('W', 'V', 'P', 'K')}, { CODEC_ID_WESTWOOD_SND1, MKTAG('S', 'N', 'D', '1')}, { CODEC_ID_XAN_DPCM, MKTAG('A', 'x', 'a', 'n')}, From subversion at mplayerhq.hu Mon Dec 5 00:03:24 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Mon, 5 Dec 2011 00:03:24 +0100 (CET) Subject: [MPlayer-cvslog] r34392 - in trunk: etc/codecs.conf libmpdemux/mp_taglists.c Message-ID: <20111204230324.C3B6E12227D@avserver.banki.hu> Author: cehoyos Date: Mon Dec 5 00:03:24 2011 New Revision: 34392 Log: Support FFmpeg's EA MAD decoder. Patch by Paul B. Mahol, onemda gmail Modified: trunk/etc/codecs.conf trunk/libmpdemux/mp_taglists.c Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Sun Dec 4 23:52:58 2011 (r34391) +++ trunk/etc/codecs.conf Mon Dec 5 00:03:24 2011 (r34392) @@ -53,6 +53,14 @@ videocodec ffeacmv dll eacmv out BGR8 +videocodec ffeamad + info "FFmpeg EA MAD" + status working + fourcc MADk ; internal MPlayer FourCC + driver ffmpeg + dll eamad + out YV12 + videocodec ffmvi1 info "FFmpeg Motion Pixels" status working Modified: trunk/libmpdemux/mp_taglists.c ============================================================================== --- trunk/libmpdemux/mp_taglists.c Sun Dec 4 23:52:58 2011 (r34391) +++ trunk/libmpdemux/mp_taglists.c Mon Dec 5 00:03:24 2011 (r34392) @@ -125,6 +125,7 @@ static const struct AVCodecTag mp_bmp_ta { CODEC_ID_IDCIN, MKTAG('I', 'D', 'C', 'I')}, { CODEC_ID_INTERPLAY_VIDEO, MKTAG('I', 'N', 'P', 'V')}, { CODEC_ID_JV, MKTAG('F', 'F', 'J', 'V')}, + { CODEC_ID_MAD, MKTAG('M', 'A', 'D', 'k')}, { CODEC_ID_MDEC, MKTAG('M', 'D', 'E', 'C')}, { CODEC_ID_MOTIONPIXELS, MKTAG('M', 'V', 'I', '1')}, { CODEC_ID_MXPEG, MKTAG('M', 'X', 'P', 'G')}, From subversion at mplayerhq.hu Mon Dec 5 00:13:46 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Mon, 5 Dec 2011 00:13:46 +0100 (CET) Subject: [MPlayer-cvslog] r34393 - in trunk: etc/codecs.conf libmpdemux/mp_taglists.c Message-ID: <20111204231346.BBCCB123161@avserver.banki.hu> Author: cehoyos Date: Mon Dec 5 00:13:46 2011 New Revision: 34393 Log: Support FFmpeg's PCM 16-bit little-endian planar decoder. Modified: trunk/etc/codecs.conf trunk/libmpdemux/mp_taglists.c Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Mon Dec 5 00:03:24 2011 (r34392) +++ trunk/etc/codecs.conf Mon Dec 5 00:13:46 2011 (r34393) @@ -4634,6 +4634,13 @@ audiocodec ffpcmdaud driver ffmpeg dll "pcm_s24daud" +audiocodec ffpcms16leplanar + info "FFmpeg PCM 16-bit little-endian planar" + status working + fourcc 16PL ; internal MPlayer FourCC + driver ffmpeg + dll pcm_s16le_planar + audiocodec ffwmav1 info "DivX audio v1 (FFmpeg)" status untested Modified: trunk/libmpdemux/mp_taglists.c ============================================================================== --- trunk/libmpdemux/mp_taglists.c Mon Dec 5 00:03:24 2011 (r34392) +++ trunk/libmpdemux/mp_taglists.c Mon Dec 5 00:13:46 2011 (r34393) @@ -53,6 +53,7 @@ static const struct AVCodecTag mp_wav_ta { CODEC_ID_MUSEPACK8, MKTAG('M', 'P', 'C', '8')}, { CODEC_ID_NELLYMOSER, MKTAG('n', 'm', 'o', 's')}, { CODEC_ID_PCM_LXF, MKTAG('P', 'L', 'X', 'F')}, + { CODEC_ID_PCM_S16LE_PLANAR, MKTAG('1', '6', 'P', 'L')}, { CODEC_ID_QCELP, MKTAG('Q', 'c', 'l', 'p')}, { CODEC_ID_QDM2, MKTAG('Q', 'D', 'M', '2')}, { CODEC_ID_RA_144, MKTAG('1', '4', '_', '4')}, From subversion at mplayerhq.hu Mon Dec 5 12:38:16 2011 From: subversion at mplayerhq.hu (diego) Date: Mon, 5 Dec 2011 12:38:16 +0100 (CET) Subject: [MPlayer-cvslog] r34396 - trunk/configure Message-ID: <20111205113816.6E42D1238DE@avserver.banki.hu> Author: diego Date: Mon Dec 5 12:38:15 2011 New Revision: 34396 Log: configure: (internal) libass depends on FriBiDi now; check availability Modified: trunk/configure Modified: trunk/configure ============================================================================== --- trunk/configure Mon Dec 5 12:38:13 2011 (r34395) +++ trunk/configure Mon Dec 5 12:38:15 2011 (r34396) @@ -5911,12 +5911,44 @@ fi echores "$_fontconfig" +echocheck "fribidi with charsets" +if test "$_fribidi" = auto ; then + cat > $TMPC << EOF +#include +/* workaround for fribidi 0.10.4 and below */ +#define FRIBIDI_CHARSET_UTF8 FRIBIDI_CHAR_SET_UTF8 +#include +int main(void) { + if (fribidi_parse_charset("UTF-8") != FRIBIDI_CHAR_SET_UTF8) + exit(1); + return 0; +} +EOF + _fribidi=no + cc_check -lfribidi && _fribidi=yes && extra_ldflags="$extra_ldflags -lfribidi" + if $_pkg_config --exists fribidi > /dev/null 2>&1 && + test "$_fribidi" = no ; then + inc_tmp="$($_pkg_config --cflags fribidi)" + ld_tmp="$($_pkg_config --libs fribidi)" + cc_check $inc_tmp $ld_tmp && _fribidi=yes && + extra_cflags="$extra_cflags $inc_tmp" && + extra_ldflags="$extra_ldflags $ld_tmp" + fi +fi +if test "$_fribidi" = yes ; then + def_fribidi='#define CONFIG_FRIBIDI 1' +else + def_fribidi='#undef CONFIG_FRIBIDI' +fi +echores "$_fribidi" + + echocheck "SSA/ASS support" -# libass depends on FreeType -if test "$_freetype" = no ; then +# libass depends on FreeType and FriBiDi +if test "$_freetype" = no || test "$_fribidi" = no ; then _ass=no ass_internal=no - res_comment="FreeType support needed" + res_comment="FreeType and FriBiDi support needed" fi if test "$_ass" = auto ; then @@ -5967,38 +5999,6 @@ fi echores "$_ass" -echocheck "fribidi with charsets" -if test "$_fribidi" = auto ; then - cat > $TMPC << EOF -#include -/* workaround for fribidi 0.10.4 and below */ -#define FRIBIDI_CHARSET_UTF8 FRIBIDI_CHAR_SET_UTF8 -#include -int main(void) { - if (fribidi_parse_charset("UTF-8") != FRIBIDI_CHAR_SET_UTF8) - exit(1); - return 0; -} -EOF - _fribidi=no - cc_check -lfribidi && _fribidi=yes && extra_ldflags="$extra_ldflags -lfribidi" - if $_pkg_config --exists fribidi > /dev/null 2>&1 && - test "$_fribidi" = no ; then - inc_tmp="$($_pkg_config --cflags fribidi)" - ld_tmp="$($_pkg_config --libs fribidi)" - cc_check $inc_tmp $ld_tmp && _fribidi=yes && - extra_cflags="$extra_cflags $inc_tmp" && - extra_ldflags="$extra_ldflags $ld_tmp" - fi -fi -if test "$_fribidi" = yes ; then - def_fribidi='#define CONFIG_FRIBIDI 1' -else - def_fribidi='#undef CONFIG_FRIBIDI' -fi -echores "$_fribidi" - - echocheck "ENCA" if test "$_enca" = auto ; then _enca=no From subversion at mplayerhq.hu Mon Dec 5 19:08:30 2011 From: subversion at mplayerhq.hu (reimar) Date: Mon, 5 Dec 2011 19:08:30 +0100 (CET) Subject: [MPlayer-cvslog] r34397 - trunk/libmpcodecs/vd_ffmpeg.c Message-ID: <20111205180830.721AF123BFD@avserver.banki.hu> Author: reimar Date: Mon Dec 5 19:08:29 2011 New Revision: 34397 Log: Discard frames where the size does not match the AVCodecContext width/height. This avoids possible crashes on video size changes. The problem is that we reinitialize the vo on get_buffer but due to codec delay libavcodec might still return frames with the old size afterwards, which the vo might no longer be able to handle. Ideally libavcodec should not show this behaviour, since it requires that any application using DR1 can handle frames of different sizes simultaneously - which seems a bit extreme. Modified: trunk/libmpcodecs/vd_ffmpeg.c Modified: trunk/libmpcodecs/vd_ffmpeg.c ============================================================================== --- trunk/libmpcodecs/vd_ffmpeg.c Mon Dec 5 12:38:15 2011 (r34396) +++ trunk/libmpcodecs/vd_ffmpeg.c Mon Dec 5 19:08:29 2011 (r34397) @@ -897,12 +897,18 @@ static mp_image_t *decode(sh_video_t *sh if(!mpi) mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE, - avctx->width, avctx->height); + pic->width, pic->height); if(!mpi){ // temporary! mp_msg(MSGT_DECVIDEO, MSGL_WARN, MSGTR_MPCODECS_CouldntAllocateImageForCodec); return NULL; } + if (mpi->w != pic->width || mpi->h != pic->height || + pic->width != avctx->width || pic->height != avctx->height) { + mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Dropping frame with size not matching configured size\n"); + return NULL; + } + if(!dr1){ mpi->planes[0]=pic->data[0]; mpi->planes[1]=pic->data[1]; From subversion at mplayerhq.hu Mon Dec 5 19:09:21 2011 From: subversion at mplayerhq.hu (reimar) Date: Mon, 5 Dec 2011 19:09:21 +0100 (CET) Subject: [MPlayer-cvslog] r34398 - trunk/libvo/vo_kva.c Message-ID: <20111205180921.A691F123C06@avserver.banki.hu> Author: reimar Date: Mon Dec 5 19:09:21 2011 New Revision: 34398 Log: vo_kva: support -title. Modified: trunk/libvo/vo_kva.c Modified: trunk/libvo/vo_kva.c ============================================================================== --- trunk/libvo/vo_kva.c Mon Dec 5 19:08:29 2011 (r34397) +++ trunk/libvo/vo_kva.c Mon Dec 5 19:09:21 2011 (r34398) @@ -673,6 +673,9 @@ static int config(uint32_t width, uint32 { RECTL rcl; + if (vo_wintitle) + title = vo_wintitle; + mp_msg(MSGT_VO, MSGL_V, "KVA: Using 0x%X (%s) image format, vo_config_count = %d\n", format, vo_format_name(format), vo_config_count); From subversion at mplayerhq.hu Mon Dec 5 19:22:56 2011 From: subversion at mplayerhq.hu (reimar) Date: Mon, 5 Dec 2011 19:22:56 +0100 (CET) Subject: [MPlayer-cvslog] r34399 - trunk/libmpcodecs/dec_video.c Message-ID: <20111205182256.C0092123C36@avserver.banki.hu> Author: reimar Date: Mon Dec 5 19:22:56 2011 New Revision: 34399 Log: Make emms/femms code simpler/more obvious. Modified: trunk/libmpcodecs/dec_video.c Modified: trunk/libmpcodecs/dec_video.c ============================================================================== --- trunk/libmpcodecs/dec_video.c Mon Dec 5 19:09:21 2011 (r34398) +++ trunk/libmpcodecs/dec_video.c Mon Dec 5 19:22:56 2011 (r34399) @@ -420,15 +420,13 @@ void *decode_video(sh_video_t *sh_video, } } -#if HAVE_MMX // some codecs are broken, and doesn't restore MMX state :( // it happens usually with broken/damaged files. - if (gCpuCaps.has3DNow) { + if (HAVE_AMD3DNOW && gCpuCaps.has3DNow) { __asm__ volatile ("femms\n\t":::"memory"); - } else if (gCpuCaps.hasMMX) { + } else if (HAVE_MMX && gCpuCaps.hasMMX) { __asm__ volatile ("emms\n\t":::"memory"); } -#endif t2 = GetTimer(); t = t2 - t; From subversion at mplayerhq.hu Mon Dec 5 19:27:40 2011 From: subversion at mplayerhq.hu (reimar) Date: Mon, 5 Dec 2011 19:27:40 +0100 (CET) Subject: [MPlayer-cvslog] r34400 - in trunk: libmpdemux/demuxer.c libmpdemux/demuxer.h mplayer.c Message-ID: <20111205182741.0A7CF121EC2@avserver.banki.hu> Author: reimar Date: Mon Dec 5 19:27:40 2011 New Revision: 34400 Log: Fix OSD time and e.g. frame number displayed with osd_fractions getting out of sync by using the same source for both. Patch by Roger Pack [rogerdpack2 gmail com]. Modified: trunk/libmpdemux/demuxer.c trunk/libmpdemux/demuxer.h trunk/mplayer.c Modified: trunk/libmpdemux/demuxer.c ============================================================================== --- trunk/libmpdemux/demuxer.c Mon Dec 5 19:22:56 2011 (r34399) +++ trunk/libmpdemux/demuxer.c Mon Dec 5 19:27:40 2011 (r34400) @@ -1480,7 +1480,7 @@ double demuxer_get_time_length(demuxer_t * 0 otherwise * \return the current play time */ -int demuxer_get_current_time(demuxer_t *demuxer) +double demuxer_get_current_time(demuxer_t *demuxer) { double get_time_ans = 0; sh_video_t *sh_video = demuxer->video->sh; @@ -1488,7 +1488,7 @@ int demuxer_get_current_time(demuxer_t * get_time_ans = demuxer->stream_pts; else if (sh_video) get_time_ans = sh_video->pts; - return (int) get_time_ans; + return get_time_ans; } int demuxer_get_percent_pos(demuxer_t *demuxer) Modified: trunk/libmpdemux/demuxer.h ============================================================================== --- trunk/libmpdemux/demuxer.h Mon Dec 5 19:22:56 2011 (r34399) +++ trunk/libmpdemux/demuxer.h Mon Dec 5 19:27:40 2011 (r34400) @@ -437,7 +437,7 @@ char* demux_info_get(demuxer_t *demuxer, int demux_info_print(demuxer_t *demuxer); int demux_control(demuxer_t *demuxer, int cmd, void *arg); -int demuxer_get_current_time(demuxer_t *demuxer); +double demuxer_get_current_time(demuxer_t *demuxer); double demuxer_get_time_length(demuxer_t *demuxer); int demuxer_get_percent_pos(demuxer_t *demuxer); int demuxer_switch_audio(demuxer_t *demuxer, int index); Modified: trunk/mplayer.c ============================================================================== --- trunk/mplayer.c Mon Dec 5 19:22:56 2011 (r34399) +++ trunk/mplayer.c Mon Dec 5 19:27:40 2011 (r34400) @@ -1584,7 +1584,8 @@ static void update_osd_msg(void) int percentage = -1; char percentage_text[10]; char fractions_text[4]; - int pts = demuxer_get_current_time(mpctx->demuxer); + double pts = demuxer_get_current_time(mpctx->demuxer); + int pts_seconds = pts; if (mpctx->osd_show_percentage) percentage = demuxer_get_percent_pos(mpctx->demuxer); @@ -1597,7 +1598,7 @@ static void update_osd_msg(void) if (osd_fractions == 1) { // print fractions as sub-second timestamp snprintf(fractions_text, sizeof(fractions_text), ".%02d", - (int)((mpctx->sh_video->pts - pts) * 100) % 100); + (int)((pts - pts_seconds) * 100) % 100); } else if (osd_fractions == 2) { // print fractions by estimating the frame count within the // second @@ -1608,7 +1609,7 @@ static void update_osd_msg(void) // we add 0.2 and cut off at the decimal point, which proved // as good heuristic snprintf(fractions_text, sizeof(fractions_text), ".%02d", - (int)((mpctx->sh_video->pts - pts) * + (int)((pts - pts_seconds) * mpctx->sh_video->fps + 0.2)); } else { // do not print fractions @@ -1618,13 +1619,13 @@ static void update_osd_msg(void) if (osd_level == 3) snprintf(osd_text_timer, 63, "%c %02d:%02d:%02d%s / %02d:%02d:%02d%s", - mpctx->osd_function, pts / 3600, (pts / 60) % 60, pts % 60, + mpctx->osd_function, pts_seconds / 3600, (pts_seconds / 60) % 60, pts_seconds % 60, fractions_text, len / 3600, (len / 60) % 60, len % 60, percentage_text); else snprintf(osd_text_timer, 63, "%c %02d:%02d:%02d%s%s", - mpctx->osd_function, pts / 3600, (pts / 60) % 60, - pts % 60, fractions_text, percentage_text); + mpctx->osd_function, pts_seconds / 3600, (pts_seconds / 60) % 60, + pts_seconds % 60, fractions_text, percentage_text); } else osd_text_timer[0] = 0; From Reimar.Doeffinger at gmx.de Mon Dec 5 19:53:18 2011 From: Reimar.Doeffinger at gmx.de (Reimar =?iso-8859-1?Q?D=F6ffinger?=) Date: Mon, 5 Dec 2011 19:53:18 +0100 Subject: [MPlayer-cvslog] r34396 - trunk/configure In-Reply-To: <20111205113816.6E42D1238DE@avserver.banki.hu> References: <20111205113816.6E42D1238DE@avserver.banki.hu> Message-ID: <20111205185318.GA3528@1und1.de> On Mon, Dec 05, 2011 at 12:38:16PM +0100, diego wrote: > echocheck "SSA/ASS support" > -# libass depends on FreeType > -if test "$_freetype" = no ; then > +# libass depends on FreeType and FriBiDi > +if test "$_freetype" = no || test "$_fribidi" = no ; then > _ass=no > ass_internal=no > - res_comment="FreeType support needed" > + res_comment="FreeType and FriBiDi support needed" > fi I am not sure about freetype, but external libass should still be detected and used even if fribidi is not detected - e.g. it might just be fribidi headers missing or and older libass that does not need it. From ib at wupperonline.de Tue Dec 6 18:52:14 2011 From: ib at wupperonline.de (=?ISO-8859-1?Q?Ingo=20Br=FCckl?=) Date: Tue, 06 Dec 2011 18:52:14 +0100 Subject: [MPlayer-cvslog] r34257 - in trunk: cfg-common.h cfg-mplayer.h m_option.c m_option.h In-Reply-To: <20111027222433.GC18730@1und1.de> Message-ID: <4ede5d76.4218c28d.bm000@wupperonline.de> Reimar D?ffinger wrote on Fri, 28 Oct 2011 00:24:33 +0200: > On Wed, Oct 26, 2011 at 10:07:45PM +0200, Ingo Br?ckl wrote: >> Reimar D?ffinger wrote on Wed, 26 Oct 2011 20:22:53 +0200: >> >> > On Wed, Oct 26, 2011 at 07:31:15PM +0200, Ingo Br?ckl wrote: >> >> reimar wrote on Tue, 25 Oct 2011 22:18:35 +0200 (CEST): >> >> >> >> > Author: reimar >> >> > Date: Tue Oct 25 22:18:35 2011 >> >> > New Revision: 34257 >> >> >> >> > Log: >> >> > Sanitize include behaviour. >> >> >> >> > The normal func_param argument type will iterate over all previous >> >> > values each time a new value is assigned. >> >> > This leads e.g. to a complete mess and non-working recursion limiting >> >> > when creating a config file that includes itself. >> >> > Seem to also fix bug #1994. >> >> >> >> > Modified: >> >> > trunk/cfg-common.h >> >> > trunk/cfg-mplayer.h >> >> > trunk/m_option.c >> >> > trunk/m_option.h >> >> >> >> > Modified: trunk/cfg-mplayer.h >> >> > ========================================================================= ===== >> >> > +++ trunk/cfg-mplayer.h Tue Oct 25 22:18:35 2011 (r34257) >> >> > @@ -301,7 +301,7 @@ const m_option_t mplayer_opts[]={ >> >> > {"noenqueue", &enqueue, CONF_TYPE_FLAG, 0, 1, 0, NULL}, >> >> > {"guiwid", "-guiwid has been removed, use -gui-wid instead.\n", >> >> > CONF_TYPE_PRINT, 0, 0, 0, NULL}, >> >> > {"gui-wid", &guiWinID, CONF_TYPE_INT, 0, 0, 0, NULL}, >> >> > - {"gui-include", cfg_gui_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, NULL}, >> >> > + {"gui-include", cfg_gui_include, CONF_TYPE_FUNC_PARAM_IMMEDIATE, CONF_NOSAVE, 0, 0, NULL}, >> >> >> >> This segfaults the GUI. >> >> >> >> If I understand CONF_TYPE_FUNC_PARAM_IMMEDIATE correctly, this isn't the >> >> desired behaviour either. >> >> >> >> Option gui-include is meant to override the gui.conf settings. In order to do >> >> this, MPlayer must have called cfg_read() where gui.conf is read and >> >> m_config_t *gui_conf is set. CONF_TYPE_FUNC_PARAM_IMMEDIATE seems to act >> >> prior to this, thus gui_conf still is NULL. >> >> >> >> As the GUI's config files don't allow includes anyway, it seems save to >> >> stay with CONF_TYPE_FUNC_PARAM. >> >> > However you will end up with some really strange behaviour if someone >> > ever uses multiple gui_include (recursion is just the case where it is >> > most obvious). >> >> I was just doing some tests, but could not figure out any problems. Every >> gui-include seems to override properly what the previous gui-include may >> have set. Maybe you could give me a hint what to look or check for? > Profiles and thus probably also per-protocol or extension options > probably will not be working properly. > No idea if they are supposed to anyway though. At the moment I don't see a practical use in per-any gui configs. >> > And rather not call it include, when it doesn't really behave like that. >> >> I does behave like include, but limited to the gui options which are a subset >> of the MPlayer options > No, it doesn't really. As said, for example a second "include" will > cause all previous includes to be re-evaluated. > Especially with section this has all kinds of funny and unexpected > effects. > You probably should be able to also see it if you do something like > gui-include=cache.conf # configures cache > nocache=yes > gui-include=empty.conf > should result in cache being enabled at the end. This actually segfaults for the very same reason (MPlayer didn't have called cfg_read() before). I suggest the attached patch. Ingo -------------- next part -------------- A non-text attachment was scrubbed... Name: gui-include.patch Type: text/x-diff Size: 662 bytes Desc: not available URL: From subversion at mplayerhq.hu Tue Dec 6 20:59:17 2011 From: subversion at mplayerhq.hu (reimar) Date: Tue, 6 Dec 2011 20:59:17 +0100 (CET) Subject: [MPlayer-cvslog] r34401 - in trunk: libmpcodecs/vd_ffmpeg.c libmpdemux/aviheader.c libmpdemux/stheader.h Message-ID: <20111206195917.9A04712424F@avserver.banki.hu> Author: reimar Date: Tue Dec 6 20:59:16 2011 New Revision: 34401 Log: Try harder to extract a sensible palette from extradata. Fixes samples/V-codecs/QPEG/MITSUMI.AVI. Modified: trunk/libmpcodecs/vd_ffmpeg.c trunk/libmpdemux/aviheader.c trunk/libmpdemux/stheader.h Modified: trunk/libmpcodecs/vd_ffmpeg.c ============================================================================== --- trunk/libmpcodecs/vd_ffmpeg.c Mon Dec 5 19:27:40 2011 (r34400) +++ trunk/libmpcodecs/vd_ffmpeg.c Tue Dec 6 20:59:16 2011 (r34401) @@ -787,15 +787,21 @@ static mp_image_t *decode(sh_video_t *sh pkt.flags = AV_PKT_FLAG_KEY; if (!ctx->palette_sent && sh->bih && sh->bih->biBitCount <= 8) { /* Pass palette to codec */ + uint8_t *pal_data = (uint8_t *)(sh->bih+1); unsigned palsize = sh->bih->biSize - sizeof(*sh->bih); - if (palsize == 0) { - /* Palette size in biClrUsed */ - palsize = sh->bih->biClrUsed * 4; + unsigned needed_size = 4 << sh->bih->biBitCount; + // Assume palette outside bih in rest of chunk. + // Fixes samples/V-codecs/QPEG/MITSUMI.AVI + if (palsize < needed_size && + sh->bih_size > sh->bih->biSize && + sh->bih_size - sh->bih->biSize > palsize) { + pal_data = (uint8_t *)sh->bih + sh->bih->biSize; + palsize = sh->bih_size - sh->bih->biSize; } // if still 0, we simply have no palette in extradata. if (palsize) { uint8_t *pal = av_packet_new_side_data(&pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); - memcpy(pal, sh->bih+1, FFMIN(palsize, AVPALETTE_SIZE)); + memcpy(pal, pal_data, FFMIN(palsize, AVPALETTE_SIZE)); } ctx->palette_sent = 1; } Modified: trunk/libmpdemux/aviheader.c ============================================================================== --- trunk/libmpdemux/aviheader.c Mon Dec 5 19:27:40 2011 (r34400) +++ trunk/libmpdemux/aviheader.c Tue Dec 6 20:59:16 2011 (r34401) @@ -267,7 +267,8 @@ while(1){ break; } case ckidSTREAMFORMAT: { // read 'strf' if(last_fccType==streamtypeVIDEO){ - sh_video->bih=calloc(FFMAX(chunksize, sizeof(*sh_video->bih)), 1); + sh_video->bih_size = FFMAX(chunksize, sizeof(*sh_video->bih)); + sh_video->bih=calloc(sh_video->bih_size, 1); // sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize); mp_msg(MSGT_HEADER, MSGL_V, "Found 'bih', %u bytes of %zu\n", chunksize, sizeof(*sh_video->bih)); Modified: trunk/libmpdemux/stheader.h ============================================================================== --- trunk/libmpdemux/stheader.h Mon Dec 5 19:27:40 2011 (r34400) +++ trunk/libmpdemux/stheader.h Tue Dec 6 20:59:16 2011 (r34401) @@ -116,6 +116,7 @@ typedef struct sh_video { // win32-compatible codec parameters: AVIStreamHeader video; BITMAPINFOHEADER* bih; + int bih_size; void* ImageDesc; // for quicktime codecs } sh_video_t; From subversion at mplayerhq.hu Thu Dec 8 03:44:20 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Thu, 8 Dec 2011 03:44:20 +0100 (CET) Subject: [MPlayer-cvslog] r34402 - trunk/etc/codecs.conf Message-ID: <20111208024420.2DAB71246D9@avserver.banki.hu> Author: cehoyos Date: Thu Dec 8 03:44:19 2011 New Revision: 34402 Log: ffmjpeg does not incorrectly output BGR32 anymore for ljpeg. Modified: trunk/etc/codecs.conf Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Tue Dec 6 20:59:16 2011 (r34401) +++ trunk/etc/codecs.conf Thu Dec 8 03:44:19 2011 (r34402) @@ -1631,7 +1631,7 @@ videocodec ffmjpeg out 440P out YUY2 ; queried (conversion from yuv422p) out YV12,I420,IYUV - out BGR32 ; lossless JPEG + out BGR24 ; lossless JPEG out RGB24 ; JPEG-LS out Y800 From subversion at mplayerhq.hu Thu Dec 8 13:05:00 2011 From: subversion at mplayerhq.hu (ib) Date: Thu, 8 Dec 2011 13:05:00 +0100 (CET) Subject: [MPlayer-cvslog] r34403 - in trunk/gui/win32: gui.c interface.c skinload.c skinload.h Message-ID: <20111208120501.06E23124C7F@avserver.banki.hu> Author: ib Date: Thu Dec 8 13:05:00 2011 New Revision: 34403 Log: Remove event evDropFile from Win32 GUI. This event doesn't exist in the X11/GTK GUI and it is identical to evLoadPlay. Modified: trunk/gui/win32/gui.c trunk/gui/win32/interface.c trunk/gui/win32/skinload.c trunk/gui/win32/skinload.h Modified: trunk/gui/win32/gui.c ============================================================================== --- trunk/gui/win32/gui.c Thu Dec 8 03:44:19 2011 (r34402) +++ trunk/gui/win32/gui.c Thu Dec 8 13:05:00 2011 (r34403) @@ -238,7 +238,7 @@ static void handlemsg(HWND hWnd, int msg case evLoadPlay: case evLoad: if(display_openfilewindow(gui, 0) && (msg == evLoadPlay)) - handlemsg(hWnd, evDropFile); + handlemsg(hWnd, evLoadPlay); return; case evLoadSubtitle: display_opensubtitlewindow(gui); @@ -501,13 +501,13 @@ static LRESULT CALLBACK SubProc(HWND hWn gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0); } DragFinish((HDROP) wParam); - handlemsg(hWnd, evDropFile); + handlemsg(hWnd, evLoadPlay); } else { gui->playlist->clear_playlist(gui->playlist); gui->playlist->add_track(gui->playlist, (const char *) wParam, NULL, NULL, 0); - handlemsg(hWnd, evDropFile); + handlemsg(hWnd, evLoadPlay); } SetForegroundWindow(gui->subwindow); return 0; @@ -790,13 +790,13 @@ static LRESULT CALLBACK EventProc(HWND h gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0); } DragFinish((HDROP) wParam); - handlemsg(hWnd, evDropFile); + handlemsg(hWnd, evLoadPlay); } else { gui->playlist->clear_playlist(gui->playlist); gui->playlist->add_track(gui->playlist, (const char *) wParam, NULL, NULL, 0); - handlemsg(hWnd, evDropFile); + handlemsg(hWnd, evLoadPlay); } SetForegroundWindow(gui->mainwindow); return 0; @@ -1118,7 +1118,7 @@ static LRESULT CALLBACK EventProc(HWND h static void startplay(gui_t *gui) { - handlemsg(gui->mainwindow, evDropFile); + handlemsg(gui->mainwindow, evLoadPlay); } /* returns the bits per pixel of the desktop */ Modified: trunk/gui/win32/interface.c ============================================================================== --- trunk/gui/win32/interface.c Thu Dec 8 03:44:19 2011 (r34402) +++ trunk/gui/win32/interface.c Thu Dec 8 13:05:00 2011 (r34403) @@ -227,7 +227,6 @@ static void guiSetEvent(int event) mp_input_queue_cmd(cmd); break; } - case evDropFile: case evLoadPlay: { switch(guiInfo.StreamType) Modified: trunk/gui/win32/skinload.c ============================================================================== --- trunk/gui/win32/skinload.c Thu Dec 8 03:44:19 2011 (r34402) +++ trunk/gui/win32/skinload.c Thu Dec 8 13:05:00 2011 (r34403) @@ -47,7 +47,6 @@ static const evName evNames[] = { { evNone, "evNone" }, { evPlay, "evPlay" }, - { evDropFile, "evDropFile" }, { evStop, "evStop" }, { evPause, "evPause" }, { evPrev, "evPrev" }, Modified: trunk/gui/win32/skinload.h ============================================================================== --- trunk/gui/win32/skinload.h Thu Dec 8 03:44:19 2011 (r34402) +++ trunk/gui/win32/skinload.h Thu Dec 8 13:05:00 2011 (r34403) @@ -183,7 +183,6 @@ skin_t *loadskin(char *skindir, int desk #define evSetAspect 44 #define evSetAudio 45 #define evSetVideo 46 -#define evDropFile 47 #define evPlayCD 48 #define evExit 1000 From subversion at mplayerhq.hu Thu Dec 8 13:09:00 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Thu, 8 Dec 2011 13:09:00 +0100 (CET) Subject: [MPlayer-cvslog] r34404 - in trunk: etc/codecs.conf libmpdemux/mp_taglists.c Message-ID: <20111208120900.802DE125985@avserver.banki.hu> Author: cehoyos Date: Thu Dec 8 13:09:00 2011 New Revision: 34404 Log: Support decoding newer rpl files with FFmpeg's Escape 130 decoder. Modified: trunk/etc/codecs.conf trunk/libmpdemux/mp_taglists.c Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Thu Dec 8 13:05:00 2011 (r34403) +++ trunk/etc/codecs.conf Thu Dec 8 13:09:00 2011 (r34404) @@ -3559,6 +3559,14 @@ videocodec ffescape124 dll escape124 out BGR15 +videocodec ffescape130 + info "FFmpeg Escape 130" + status working + fourcc E130 ; internal MPlayer FourCC + driver ffmpeg + dll escape130 + out YV12 + ; raw formats: (now RGB formats are autodetected) ; these raw codecs are used mostly by TV input Modified: trunk/libmpdemux/mp_taglists.c ============================================================================== --- trunk/libmpdemux/mp_taglists.c Thu Dec 8 13:05:00 2011 (r34403) +++ trunk/libmpdemux/mp_taglists.c Thu Dec 8 13:09:00 2011 (r34404) @@ -32,7 +32,6 @@ static const struct AVCodecTag mp_wav_ta { CODEC_ID_ADPCM_EA, MKTAG('A', 'D', 'E', 'A')}, { CODEC_ID_ADPCM_EA_MAXIS_XA, MKTAG('A', 'D', 'X', 'A')}, { CODEC_ID_ADPCM_IMA_EA_EACS, MKTAG('E', 'A', 'C', 'S')}, - { CODEC_ID_ADPCM_IMA_EA_SEAD, MKTAG('S', 'E', 'A', 'D')}, { CODEC_ID_ADPCM_IMA_ISS, MKTAG('A', 'I', 'S', 'S')}, { CODEC_ID_ADPCM_IMA_WS, MKTAG('A', 'I', 'W', 'S')}, { CODEC_ID_ADPCM_THP, MKTAG('T', 'H', 'P', 'A')}, @@ -79,11 +78,13 @@ static const struct AVCodecTag mp_codeci { CODEC_ID_AAC, MKTAG('M', 'P', '4', 'A')}, { CODEC_ID_AAC_LATM, MKTAG('M', 'P', '4', 'L')}, { CODEC_ID_AC3, 0x2000}, + { CODEC_ID_ADPCM_IMA_EA_SEAD, MKTAG('S', 'E', 'A', 'D')}, { CODEC_ID_ADPCM_IMA_AMV, MKTAG('A', 'M', 'V', 'A')}, { CODEC_ID_DTS, 0x2001}, { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'd')}, { CODEC_ID_EAC3, MKTAG('E', 'A', 'C', '3')}, { CODEC_ID_ESCAPE124, MKTAG('E', '1', '2', '4')}, + { CODEC_ID_ESCAPE130, MKTAG('E', '1', '3', '0')}, { CODEC_ID_FLV1, MKTAG('F', 'L', 'V', '1')}, { CODEC_ID_G729, MKTAG('G', '7', '2', '9')}, { CODEC_ID_H264, MKTAG('H', '2', '6', '4')}, From subversion at mplayerhq.hu Thu Dec 8 16:38:36 2011 From: subversion at mplayerhq.hu (ib) Date: Thu, 8 Dec 2011 16:38:36 +0100 (CET) Subject: [MPlayer-cvslog] r34405 - in trunk/gui: app.c app.h win32/skinload.c win32/skinload.h Message-ID: <20111208153836.C0E5E125A2D@avserver.banki.hu> Author: ib Date: Thu Dec 8 16:38:35 2011 New Revision: 34405 Log: Cosmetic: Rearrange and group GUI user events. Modified: trunk/gui/app.c trunk/gui/app.h trunk/gui/win32/skinload.c trunk/gui/win32/skinload.h Modified: trunk/gui/app.c ============================================================================== --- trunk/gui/app.c Thu Dec 8 13:09:00 2011 (r34404) +++ trunk/gui/app.c Thu Dec 8 16:38:35 2011 (r34405) @@ -41,45 +41,45 @@ static const evName evNames[] = { { evPrev, "evPrev" }, { evNext, "evNext" }, { evLoad, "evLoad" }, - { evEqualizer, "evEqualizer" }, - { evPlayList, "evPlaylist" }, - { evExit, "evExit" }, - { evIconify, "evIconify" }, - { evIncBalance, "evIncBalance" }, // NOTE TO MYSELF: not all of these events - { evDecBalance, "evDecBalance" }, // are actually implemented, and update doc - { evFullScreen, "evFullScreen" }, - { evFName, "evFName" }, - { evMovieTime, "evMovieTime" }, - { evAbout, "evAbout" }, { evLoadPlay, "evLoadPlay" }, - { evPreferences, "evPreferences" }, - { evSkinBrowser, "evSkinBrowser" }, + { evLoadAudioFile, "evLoadAudioFile" }, + { evLoadSubtitle, "evLoadSubtitle" }, + { evDropSubtitle, "evDropSubtitle" }, + { evPlayList, "evPlaylist" }, + { evPlayVCD, "evPlayVCD" }, + { evPlayDVD, "evPlayDVD" }, + { evSetURL, "evSetURL" }, + { evPlaySwitchToPause, "evPlaySwitchToPause" }, + { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, { evBackward10sec, "evBackward10sec" }, { evForward10sec, "evForward10sec" }, { evBackward1min, "evBackward1min" }, { evForward1min, "evForward1min" }, { evBackward10min, "evBackward10min" }, { evForward10min, "evForward10min" }, + { evSetMoviePosition, "evSetMoviePosition" }, + { evNormalSize, "evHalfSize" }, + { evDoubleSize, "evDoubleSize" }, + { evFullScreen, "evFullScreen" }, + { evNormalSize, "evNormalSize" }, { evIncVolume, "evIncVolume" }, { evDecVolume, "evDecVolume" }, + { evSetVolume, "evSetVolume" }, { evMute, "evMute" }, + { evSetBalance, "evSetBalance" }, + { evEqualizer, "evEqualizer" }, + { evAbout, "evAbout" }, + { evPreferences, "evPreferences" }, + { evSkinBrowser, "evSkinBrowser" }, + { evIconify, "evIconify" }, + { evExit, "evExit" }, + { evIncBalance, "evIncBalance" }, // NOTE TO MYSELF: not all of these events + { evDecBalance, "evDecBalance" }, // are actually implemented, and update doc + { evFName, "evFName" }, + { evMovieTime, "evMovieTime" }, { evIncAudioBufDelay, "evIncAudioBufDelay" }, { evDecAudioBufDelay, "evDecAudioBufDelay" }, - { evPlaySwitchToPause, "evPlaySwitchToPause" }, - { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, - { evNormalSize, "evHalfSize" }, - { evNormalSize, "evNormalSize" }, - { evDoubleSize, "evDoubleSize" }, - { evSetMoviePosition, "evSetMoviePosition" }, - { evSetVolume, "evSetVolume" }, - { evSetBalance, "evSetBalance" }, { evHelp, "evHelp" }, - { evLoadSubtitle, "evLoadSubtitle" }, - { evPlayDVD, "evPlayDVD" }, - { evPlayVCD, "evPlayVCD" }, - { evSetURL, "evSetURL" }, - { evLoadAudioFile, "evLoadAudioFile" }, - { evDropSubtitle, "evDropSubtitle" }, { evSetAspect, "evSetAspect" } }; Modified: trunk/gui/app.h ============================================================================== --- trunk/gui/app.h Thu Dec 8 13:09:00 2011 (r34404) +++ trunk/gui/app.h Thu Dec 8 16:38:35 2011 (r34405) @@ -25,19 +25,21 @@ // User events #define evNone 0 + #define evPlay 1 #define evStop 2 #define evPause 3 #define evPrev 6 #define evNext 7 #define evLoad 8 -#define evEqualizer 9 -#define evPlayList 10 -#define evIconify 11 -#define evAbout 12 #define evLoadPlay 13 -#define evPreferences 14 -#define evSkinBrowser 15 +#define evLoadAudioFile 42 +#define evLoadSubtitle 38 +#define evDropSubtitle 43 +#define evPlayList 10 +#define evPlayVCD 40 +#define evPlayDVD 39 +#define evSetURL 5013 #define evPlaySwitchToPause 16 #define evPauseSwitchToPlay 17 @@ -47,19 +49,29 @@ #define evForward1min 21 #define evBackward10min 22 #define evForward10min 23 +#define evSetMoviePosition 27 #define evHalfSize 301 -#define evNormalSize 24 #define evDoubleSize 25 #define evFullScreen 26 +#define evNormalSize 24 -#define evSetMoviePosition 27 +#define evIncVolume 31 +#define evDecVolume 32 #define evSetVolume 28 -#define evSetBalance 29 #define evMute 30 +#define evSetBalance 29 +#define evEqualizer 9 + +#define evAbout 12 +#define evPreferences 14 +#define evSkinBrowser 15 + +#define evIconify 11 +#define evExit 1000 + +// Internal events -#define evIncVolume 31 -#define evDecVolume 32 #define evIncAudioBufDelay 33 // NOTE TO MYSELF: not all of these events #define evDecAudioBufDelay 34 // are actually implemented, and update doc #define evIncBalance 35 @@ -67,19 +79,12 @@ #define evHelp 37 -#define evLoadSubtitle 38 -#define evDropSubtitle 43 -#define evPlayDVD 39 -#define evPlayVCD 40 #define evPlayNetwork 41 -#define evLoadAudioFile 42 #define evSetAspect 44 #define evSetAudio 45 #define evSetVideo 46 #define evSetSubtitle 47 -#define evExit 1000 - // General events #define evFileLoaded 5000 @@ -95,7 +100,6 @@ #define evSetDVDChapter 5010 #define evSubtitleLoaded 5011 #define evSetVCDTrack 5012 -#define evSetURL 5013 #define evFName 7000 #define evMovieTime 7001 Modified: trunk/gui/win32/skinload.c ============================================================================== --- trunk/gui/win32/skinload.c Thu Dec 8 13:09:00 2011 (r34404) +++ trunk/gui/win32/skinload.c Thu Dec 8 16:38:35 2011 (r34405) @@ -52,44 +52,44 @@ static const evName evNames[] = { evPrev, "evPrev" }, { evNext, "evNext" }, { evLoad, "evLoad" }, - { evEqualizer, "evEqualizer" }, - { evPlayList, "evPlaylist" }, - { evExit, "evExit" }, - { evIconify, "evIconify" }, - { evIncBalance, "evIncBalance" }, - { evDecBalance, "evDecBalance" }, - { evFullScreen, "evFullScreen" }, - { evFName, "evFName" }, - { evMovieTime, "evMovieTime" }, - { evAbout, "evAbout" }, { evLoadPlay, "evLoadPlay" }, - { evPreferences, "evPreferences" }, - { evSkinBrowser, "evSkinBrowser" }, + { evLoadAudioFile, "evLoadAudioFile" }, + { evLoadSubtitle, "evLoadSubtitle" }, + { evDropSubtitle, "evDropSubtitle" }, + { evPlayList, "evPlaylist" }, + { evPlayVCD, "evPlayVCD" }, + { evPlayDVD, "evPlayDVD" }, + { evSetURL, "evSetURL" }, + { evPlaySwitchToPause, "evPlaySwitchToPause" }, + { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, { evBackward10sec, "evBackward10sec" }, { evForward10sec, "evForward10sec" }, { evBackward1min, "evBackward1min" }, { evForward1min, "evForward1min" }, { evBackward10min, "evBackward10min" }, { evForward10min, "evForward10min" }, + { evSetMoviePosition, "evSetMoviePosition" }, + { evDoubleSize, "evDoubleSize" }, + { evFullScreen, "evFullScreen" }, + { evNormalSize, "evNormalSize" }, { evIncVolume, "evIncVolume" }, { evDecVolume, "evDecVolume" }, + { evSetVolume, "evSetVolume" }, { evMute, "evMute" }, + { evSetBalance, "evSetBalance" }, + { evEqualizer, "evEqualizer" }, + { evAbout, "evAbout" }, + { evPreferences, "evPreferences" }, + { evSkinBrowser, "evSkinBrowser" }, + { evIconify, "evIconify" }, + { evExit, "evExit" }, + { evIncBalance, "evIncBalance" }, + { evDecBalance, "evDecBalance" }, + { evFName, "evFName" }, + { evMovieTime, "evMovieTime" }, { evIncAudioBufDelay, "evIncAudioBufDelay" }, { evDecAudioBufDelay, "evDecAudioBufDelay" }, - { evPlaySwitchToPause, "evPlaySwitchToPause" }, - { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, - { evNormalSize, "evNormalSize" }, - { evDoubleSize, "evDoubleSize" }, - { evSetMoviePosition, "evSetMoviePosition" }, - { evSetVolume, "evSetVolume" }, - { evSetBalance, "evSetBalance" }, { evHelp, "evHelp" }, - { evLoadSubtitle, "evLoadSubtitle" }, - { evPlayDVD, "evPlayDVD" }, - { evPlayVCD, "evPlayVCD" }, - { evSetURL, "evSetURL" }, - { evLoadAudioFile, "evLoadAudioFile" }, - { evDropSubtitle, "evDropSubtitle" }, { evSetAspect, "evSetAspect" } }; Modified: trunk/gui/win32/skinload.h ============================================================================== --- trunk/gui/win32/skinload.h Thu Dec 8 13:09:00 2011 (r34404) +++ trunk/gui/win32/skinload.h Thu Dec 8 16:38:35 2011 (r34405) @@ -139,13 +139,14 @@ skin_t *loadskin(char *skindir, int desk #define evPrev 6 #define evNext 7 #define evLoad 8 -#define evEqualizer 9 -#define evPlayList 10 -#define evIconify 11 -#define evAbout 12 #define evLoadPlay 13 -#define evPreferences 14 -#define evSkinBrowser 15 +#define evLoadAudioFile 42 +#define evLoadSubtitle 38 +#define evDropSubtitle 43 +#define evPlayList 10 +#define evPlayVCD 40 +#define evPlayDVD 39 +#define evSetURL 5013 #define evPlaySwitchToPause 16 #define evPauseSwitchToPlay 17 @@ -155,18 +156,28 @@ skin_t *loadskin(char *skindir, int desk #define evForward1min 21 #define evBackward10min 22 #define evForward10min 23 +#define evSetMoviePosition 27 -#define evNormalSize 24 #define evDoubleSize 25 #define evFullScreen 26 +#define evNormalSize 24 -#define evSetMoviePosition 27 +#define evIncVolume 31 +#define evDecVolume 32 #define evSetVolume 28 -#define evSetBalance 29 #define evMute 30 +#define evSetBalance 29 +#define evEqualizer 9 + +#define evAbout 12 +#define evPreferences 14 +#define evSkinBrowser 15 + +#define evIconify 11 +#define evExit 1000 + +// --- Internal events --- -#define evIncVolume 31 -#define evDecVolume 32 #define evIncAudioBufDelay 33 #define evDecAudioBufDelay 34 #define evIncBalance 35 @@ -174,19 +185,12 @@ skin_t *loadskin(char *skindir, int desk #define evHelp 37 -#define evLoadSubtitle 38 -#define evDropSubtitle 43 -#define evPlayDVD 39 -#define evPlayVCD 40 #define evPlayNetwork 41 -#define evLoadAudioFile 42 #define evSetAspect 44 #define evSetAudio 45 #define evSetVideo 46 #define evPlayCD 48 -#define evExit 1000 - // --- General events --- #define evFileLoaded 5000 @@ -202,7 +206,6 @@ skin_t *loadskin(char *skindir, int desk #define evSetDVDChapter 5010 #define evSubtitleLoaded 5011 #define evSetVCDTrack 5012 -#define evSetURL 5013 #define evFName 7000 #define evMovieTime 7001 From subversion at mplayerhq.hu Thu Dec 8 16:48:18 2011 From: subversion at mplayerhq.hu (ib) Date: Thu, 8 Dec 2011 16:48:18 +0100 (CET) Subject: [MPlayer-cvslog] r34407 - trunk/gui/app.c Message-ID: <20111208154818.40193125A90@avserver.banki.hu> Author: ib Date: Thu Dec 8 16:48:17 2011 New Revision: 34407 Log: Fix bug with evHalfSize event. It set the size to normal instead to half. Modified: trunk/gui/app.c Modified: trunk/gui/app.c ============================================================================== --- trunk/gui/app.c Thu Dec 8 16:39:49 2011 (r34406) +++ trunk/gui/app.c Thu Dec 8 16:48:17 2011 (r34407) @@ -58,7 +58,7 @@ static const evName evNames[] = { { evBackward10min, "evBackward10min" }, { evForward10min, "evForward10min" }, { evSetMoviePosition, "evSetMoviePosition" }, - { evNormalSize, "evHalfSize" }, + { evHalfSize, "evHalfSize" }, { evDoubleSize, "evDoubleSize" }, { evFullScreen, "evFullScreen" }, { evNormalSize, "evNormalSize" }, From subversion at mplayerhq.hu Thu Dec 8 16:58:18 2011 From: subversion at mplayerhq.hu (ib) Date: Thu, 8 Dec 2011 16:58:18 +0100 (CET) Subject: [MPlayer-cvslog] r34408 - in trunk/gui/win32: skinload.c skinload.h Message-ID: <20111208155819.0B7E4125A9E@avserver.banki.hu> Author: ib Date: Thu Dec 8 16:58:18 2011 New Revision: 34408 Log: Add evHalfSize event to the Win32 GUI. Although it doesn't do anything in the Win32 GUI (like all the other size events), it's a valid skin message. Modified: trunk/gui/win32/skinload.c trunk/gui/win32/skinload.h Modified: trunk/gui/win32/skinload.c ============================================================================== --- trunk/gui/win32/skinload.c Thu Dec 8 16:48:17 2011 (r34407) +++ trunk/gui/win32/skinload.c Thu Dec 8 16:58:18 2011 (r34408) @@ -69,6 +69,7 @@ static const evName evNames[] = { evBackward10min, "evBackward10min" }, { evForward10min, "evForward10min" }, { evSetMoviePosition, "evSetMoviePosition" }, + { evHalfSize, "evHalfSize" }, { evDoubleSize, "evDoubleSize" }, { evFullScreen, "evFullScreen" }, { evNormalSize, "evNormalSize" }, Modified: trunk/gui/win32/skinload.h ============================================================================== --- trunk/gui/win32/skinload.h Thu Dec 8 16:48:17 2011 (r34407) +++ trunk/gui/win32/skinload.h Thu Dec 8 16:58:18 2011 (r34408) @@ -158,6 +158,7 @@ skin_t *loadskin(char *skindir, int desk #define evForward10min 23 #define evSetMoviePosition 27 +#define evHalfSize 301 #define evDoubleSize 25 #define evFullScreen 26 #define evNormalSize 24 From subversion at mplayerhq.hu Thu Dec 8 17:06:24 2011 From: subversion at mplayerhq.hu (ib) Date: Thu, 8 Dec 2011 17:06:24 +0100 (CET) Subject: [MPlayer-cvslog] r34409 - in trunk/gui: app.c app.h ui/gtk/menu.c ui/main.c ui/widgets.c win32/gui.c win32/skinload.c win32/skinload.h Message-ID: <20111208160624.848D8125ABE@avserver.banki.hu> Author: ib Date: Thu Dec 8 17:06:24 2011 New Revision: 34409 Log: Cosmetic: Synchronize evPlaylist event and message names. Modified: trunk/gui/app.c trunk/gui/app.h trunk/gui/ui/gtk/menu.c trunk/gui/ui/main.c trunk/gui/ui/widgets.c trunk/gui/win32/gui.c trunk/gui/win32/skinload.c trunk/gui/win32/skinload.h Modified: trunk/gui/app.c ============================================================================== --- trunk/gui/app.c Thu Dec 8 16:58:18 2011 (r34408) +++ trunk/gui/app.c Thu Dec 8 17:06:24 2011 (r34409) @@ -45,7 +45,7 @@ static const evName evNames[] = { { evLoadAudioFile, "evLoadAudioFile" }, { evLoadSubtitle, "evLoadSubtitle" }, { evDropSubtitle, "evDropSubtitle" }, - { evPlayList, "evPlaylist" }, + { evPlaylist, "evPlaylist" }, { evPlayVCD, "evPlayVCD" }, { evPlayDVD, "evPlayDVD" }, { evSetURL, "evSetURL" }, Modified: trunk/gui/app.h ============================================================================== --- trunk/gui/app.h Thu Dec 8 16:58:18 2011 (r34408) +++ trunk/gui/app.h Thu Dec 8 17:06:24 2011 (r34409) @@ -36,7 +36,7 @@ #define evLoadAudioFile 42 #define evLoadSubtitle 38 #define evDropSubtitle 43 -#define evPlayList 10 +#define evPlaylist 10 #define evPlayVCD 40 #define evPlayDVD 39 #define evSetURL 5013 Modified: trunk/gui/ui/gtk/menu.c ============================================================================== --- trunk/gui/ui/gtk/menu.c Thu Dec 8 16:58:18 2011 (r34408) +++ trunk/gui/ui/gtk/menu.c Thu Dec 8 17:06:24 2011 (r34409) @@ -612,7 +612,7 @@ GtkWidget * create_PopUpMenu( void ) AddSeparator( Menu ); MenuItem=AddMenuCheckItem( window1, (const char*)sound_xpm, Menu,MSGTR_MENU_Mute,mixer->muted,evMute ); if ( !guiInfo.AudioChannels ) gtk_widget_set_sensitive( MenuItem,FALSE ); - AddMenuItem( window1, (const char*)playlist_xpm, Menu,MSGTR_MENU_PlayList, evPlayList ); + AddMenuItem( window1, (const char*)playlist_xpm, Menu,MSGTR_MENU_PlayList, evPlaylist ); AddMenuItem( window1, (const char*)skin_xpm, Menu,MSGTR_MENU_SkinBrowser, evSkinBrowser ); AddMenuItem( window1, (const char*)prefs_xpm, Menu,MSGTR_MENU_Preferences, evPreferences ); AddMenuItem( window1, (const char*)equalizer_xpm, Menu,MSGTR_Equalizer, evEqualizer ); Modified: trunk/gui/ui/main.c ============================================================================== --- trunk/gui/ui/main.c Thu Dec 8 16:58:18 2011 (r34408) +++ trunk/gui/ui/main.c Thu Dec 8 17:06:24 2011 (r34409) @@ -277,7 +277,7 @@ NoPause: case evPrev: uiPrev(); break; case evNext: uiNext(); break; - case evPlayList: gtkShow( evPlayList,NULL ); break; + case evPlaylist: gtkShow( evPlaylist,NULL ); break; case evSkinBrowser: gtkShow( evSkinBrowser,skinName ); break; case evAbout: gtkShow( evAbout,NULL ); break; case evPreferences: gtkShow( evPreferences,NULL ); break; Modified: trunk/gui/ui/widgets.c ============================================================================== --- trunk/gui/ui/widgets.c Thu Dec 8 16:58:18 2011 (r34408) +++ trunk/gui/ui/widgets.c Thu Dec 8 17:06:24 2011 (r34409) @@ -255,7 +255,7 @@ void gtkShow(int type, char *param) ShowPreferences(); break; - case evPlayList: + case evPlaylist: ShowPlayList(); gtkSetLayer(PlayList); break; Modified: trunk/gui/win32/gui.c ============================================================================== --- trunk/gui/win32/gui.c Thu Dec 8 16:58:18 2011 (r34408) +++ trunk/gui/win32/gui.c Thu Dec 8 17:06:24 2011 (r34409) @@ -246,7 +246,7 @@ static void handlemsg(HWND hWnd, int msg case evPreferences: display_prefswindow(gui); return; - case evPlayList: + case evPlaylist: display_playlistwindow(gui); return; case evSkinBrowser: @@ -1021,7 +1021,7 @@ static LRESULT CALLBACK EventProc(HWND h break; } case ID_PLAYLIST: - handlemsg(hWnd, evPlayList); + handlemsg(hWnd, evPlaylist); break; case ID_PREFS: handlemsg(hWnd, evPreferences); Modified: trunk/gui/win32/skinload.c ============================================================================== --- trunk/gui/win32/skinload.c Thu Dec 8 16:58:18 2011 (r34408) +++ trunk/gui/win32/skinload.c Thu Dec 8 17:06:24 2011 (r34409) @@ -56,7 +56,7 @@ static const evName evNames[] = { evLoadAudioFile, "evLoadAudioFile" }, { evLoadSubtitle, "evLoadSubtitle" }, { evDropSubtitle, "evDropSubtitle" }, - { evPlayList, "evPlaylist" }, + { evPlaylist, "evPlaylist" }, { evPlayVCD, "evPlayVCD" }, { evPlayDVD, "evPlayDVD" }, { evSetURL, "evSetURL" }, Modified: trunk/gui/win32/skinload.h ============================================================================== --- trunk/gui/win32/skinload.h Thu Dec 8 16:58:18 2011 (r34408) +++ trunk/gui/win32/skinload.h Thu Dec 8 17:06:24 2011 (r34409) @@ -143,7 +143,7 @@ skin_t *loadskin(char *skindir, int desk #define evLoadAudioFile 42 #define evLoadSubtitle 38 #define evDropSubtitle 43 -#define evPlayList 10 +#define evPlaylist 10 #define evPlayVCD 40 #define evPlayDVD 39 #define evSetURL 5013 From subversion at mplayerhq.hu Thu Dec 8 17:28:19 2011 From: subversion at mplayerhq.hu (ib) Date: Thu, 8 Dec 2011 17:28:19 +0100 (CET) Subject: [MPlayer-cvslog] r34410 - in trunk/gui: app.c app.h win32/skinload.c win32/skinload.h Message-ID: <20111208162820.14DDB125AD3@avserver.banki.hu> Author: ib Date: Thu Dec 8 17:28:19 2011 New Revision: 34410 Log: Cosmetic: Add evSetAspect event to video events. Modified: trunk/gui/app.c trunk/gui/app.h trunk/gui/win32/skinload.c trunk/gui/win32/skinload.h Modified: trunk/gui/app.c ============================================================================== --- trunk/gui/app.c Thu Dec 8 17:06:24 2011 (r34409) +++ trunk/gui/app.c Thu Dec 8 17:28:19 2011 (r34410) @@ -62,6 +62,7 @@ static const evName evNames[] = { { evDoubleSize, "evDoubleSize" }, { evFullScreen, "evFullScreen" }, { evNormalSize, "evNormalSize" }, + { evSetAspect, "evSetAspect" }, { evIncVolume, "evIncVolume" }, { evDecVolume, "evDecVolume" }, { evSetVolume, "evSetVolume" }, @@ -79,8 +80,7 @@ static const evName evNames[] = { { evMovieTime, "evMovieTime" }, { evIncAudioBufDelay, "evIncAudioBufDelay" }, { evDecAudioBufDelay, "evDecAudioBufDelay" }, - { evHelp, "evHelp" }, - { evSetAspect, "evSetAspect" } + { evHelp, "evHelp" } }; /** Modified: trunk/gui/app.h ============================================================================== --- trunk/gui/app.h Thu Dec 8 17:06:24 2011 (r34409) +++ trunk/gui/app.h Thu Dec 8 17:28:19 2011 (r34410) @@ -55,6 +55,7 @@ #define evDoubleSize 25 #define evFullScreen 26 #define evNormalSize 24 +#define evSetAspect 44 #define evIncVolume 31 #define evDecVolume 32 @@ -80,7 +81,6 @@ #define evHelp 37 #define evPlayNetwork 41 -#define evSetAspect 44 #define evSetAudio 45 #define evSetVideo 46 #define evSetSubtitle 47 Modified: trunk/gui/win32/skinload.c ============================================================================== --- trunk/gui/win32/skinload.c Thu Dec 8 17:06:24 2011 (r34409) +++ trunk/gui/win32/skinload.c Thu Dec 8 17:28:19 2011 (r34410) @@ -73,6 +73,7 @@ static const evName evNames[] = { evDoubleSize, "evDoubleSize" }, { evFullScreen, "evFullScreen" }, { evNormalSize, "evNormalSize" }, + { evSetAspect, "evSetAspect" }, { evIncVolume, "evIncVolume" }, { evDecVolume, "evDecVolume" }, { evSetVolume, "evSetVolume" }, @@ -90,8 +91,7 @@ static const evName evNames[] = { evMovieTime, "evMovieTime" }, { evIncAudioBufDelay, "evIncAudioBufDelay" }, { evDecAudioBufDelay, "evDecAudioBufDelay" }, - { evHelp, "evHelp" }, - { evSetAspect, "evSetAspect" } + { evHelp, "evHelp" } }; static const int evBoxs = sizeof(evNames) / sizeof(evName); Modified: trunk/gui/win32/skinload.h ============================================================================== --- trunk/gui/win32/skinload.h Thu Dec 8 17:06:24 2011 (r34409) +++ trunk/gui/win32/skinload.h Thu Dec 8 17:28:19 2011 (r34410) @@ -162,6 +162,7 @@ skin_t *loadskin(char *skindir, int desk #define evDoubleSize 25 #define evFullScreen 26 #define evNormalSize 24 +#define evSetAspect 44 #define evIncVolume 31 #define evDecVolume 32 @@ -187,7 +188,6 @@ skin_t *loadskin(char *skindir, int desk #define evHelp 37 #define evPlayNetwork 41 -#define evSetAspect 44 #define evSetAudio 45 #define evSetVideo 46 #define evPlayCD 48 From subversion at mplayerhq.hu Thu Dec 8 18:11:52 2011 From: subversion at mplayerhq.hu (ib) Date: Thu, 8 Dec 2011 18:11:52 +0100 (CET) Subject: [MPlayer-cvslog] r34412 - in trunk: DOCS/xml/cs/skin.xml DOCS/xml/de/skin.xml DOCS/xml/en/skin.xml DOCS/xml/es/skin.xml DOCS/xml/fr/skin.xml DOCS/xml/hu/skin.xml DOCS/xml/pl/skin.xml DOCS/xml/ru/skin.xml gui/app.c ... Message-ID: <20111208171153.083C2125AE7@avserver.banki.hu> Author: ib Date: Thu Dec 8 18:11:52 2011 New Revision: 34412 Log: Replace evSetURL by evLoadURL for consistency. Maintain evSetURL for legacy reasons. Modified: trunk/gui/app.c trunk/gui/app.h trunk/gui/ui/gtk/menu.c trunk/gui/ui/main.c trunk/gui/win32/skinload.c trunk/gui/win32/skinload.h Changes in other areas also in this revision: Modified: trunk/DOCS/xml/cs/skin.xml trunk/DOCS/xml/de/skin.xml trunk/DOCS/xml/en/skin.xml trunk/DOCS/xml/es/skin.xml trunk/DOCS/xml/fr/skin.xml trunk/DOCS/xml/hu/skin.xml trunk/DOCS/xml/pl/skin.xml trunk/DOCS/xml/ru/skin.xml Modified: trunk/gui/app.c ============================================================================== --- trunk/gui/app.c Thu Dec 8 17:37:42 2011 (r34411) +++ trunk/gui/app.c Thu Dec 8 18:11:52 2011 (r34412) @@ -48,7 +48,8 @@ static const evName evNames[] = { { evPlaylist, "evPlaylist" }, { evPlayVCD, "evPlayVCD" }, { evPlayDVD, "evPlayDVD" }, - { evSetURL, "evSetURL" }, + { evLoadURL, "evSetURL" }, // legacy + { evLoadURL, "evLoadURL" }, { evPlaySwitchToPause, "evPlaySwitchToPause" }, { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, { evBackward10sec, "evBackward10sec" }, Modified: trunk/gui/app.h ============================================================================== --- trunk/gui/app.h Thu Dec 8 17:37:42 2011 (r34411) +++ trunk/gui/app.h Thu Dec 8 18:11:52 2011 (r34412) @@ -39,7 +39,7 @@ #define evPlaylist 10 #define evPlayVCD 40 #define evPlayDVD 39 -#define evSetURL 5013 +#define evLoadURL 5013 #define evPlaySwitchToPause 16 #define evPauseSwitchToPlay 17 Modified: trunk/gui/ui/gtk/menu.c ============================================================================== --- trunk/gui/ui/gtk/menu.c Thu Dec 8 17:37:42 2011 (r34411) +++ trunk/gui/ui/gtk/menu.c Thu Dec 8 18:11:52 2011 (r34412) @@ -431,7 +431,7 @@ GtkWidget * create_PopUpMenu( void ) #ifdef CONFIG_DVDREAD AddMenuItem( window1, (const char*)playdvd_xpm, SubMenu,MSGTR_MENU_PlayDVD, evPlayDVD ); #endif - AddMenuItem( window1, (const char*)url_xpm, SubMenu,MSGTR_MENU_PlayURL, evSetURL ); + AddMenuItem( window1, (const char*)url_xpm, SubMenu,MSGTR_MENU_PlayURL, evLoadURL ); AddMenuItem( window1, (const char*)sub_xpm, SubMenu,MSGTR_MENU_LoadSubtitle" ", evLoadSubtitle ); AddMenuItem( window1, (const char*)nosub_xpm, SubMenu,MSGTR_MENU_DropSubtitle,evDropSubtitle ); AddMenuItem( window1, (const char*)loadeaf_xpm, SubMenu,MSGTR_MENU_LoadExternAudioFile, evLoadAudioFile ); Modified: trunk/gui/ui/main.c ============================================================================== --- trunk/gui/ui/main.c Thu Dec 8 17:37:42 2011 (r34411) +++ trunk/gui/ui/main.c Thu Dec 8 18:11:52 2011 (r34412) @@ -144,7 +144,7 @@ void uiEventHandling( int msg,float para mplayer( MPLAYER_EXIT_GUI, EXIT_QUIT, 0 ); break; - case evSetURL: + case evLoadURL: gtkShow( evPlayNetwork,NULL ); break; Modified: trunk/gui/win32/skinload.c ============================================================================== --- trunk/gui/win32/skinload.c Thu Dec 8 17:37:42 2011 (r34411) +++ trunk/gui/win32/skinload.c Thu Dec 8 18:11:52 2011 (r34412) @@ -59,7 +59,8 @@ static const evName evNames[] = { evPlaylist, "evPlaylist" }, { evPlayVCD, "evPlayVCD" }, { evPlayDVD, "evPlayDVD" }, - { evSetURL, "evSetURL" }, + { evLoadURL, "evSetURL" }, // legacy + { evLoadURL, "evLoadURL" }, { evPlaySwitchToPause, "evPlaySwitchToPause" }, { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, { evBackward10sec, "evBackward10sec" }, Modified: trunk/gui/win32/skinload.h ============================================================================== --- trunk/gui/win32/skinload.h Thu Dec 8 17:37:42 2011 (r34411) +++ trunk/gui/win32/skinload.h Thu Dec 8 18:11:52 2011 (r34412) @@ -146,7 +146,7 @@ skin_t *loadskin(char *skindir, int desk #define evPlaylist 10 #define evPlayVCD 40 #define evPlayDVD 39 -#define evSetURL 5013 +#define evLoadURL 5013 #define evPlaySwitchToPause 16 #define evPauseSwitchToPlay 17 From subversion at mplayerhq.hu Thu Dec 8 20:41:29 2011 From: subversion at mplayerhq.hu (ib) Date: Thu, 8 Dec 2011 20:41:29 +0100 (CET) Subject: [MPlayer-cvslog] r34413 - trunk/gui/win32/gui.c Message-ID: <20111208194129.37A921259D4@avserver.banki.hu> Author: ib Date: Thu Dec 8 20:41:28 2011 New Revision: 34413 Log: Fix bug in Win32 GUI introduced in r34403. When selecting a file to open in the open dialog, the open dialog just reappears. handlemsg() passes unknown messages (such as evDropFile) to the gui's playercontrol function (guiSetEvent()). We cannot replace the handlemsg(hWnd, evDropFile) call by handlemsg(hWnd, evLoadPlay), because evLoadPlay is known in handlemsg() and has a different meaning there. So we directly call gui->playercontrol(evLoadPlay) instead where evDropFile and evLoadPlay have the same meaning. Reported by Stephen Sheldon, sfsheldo gmail com. Modified: trunk/gui/win32/gui.c Modified: trunk/gui/win32/gui.c ============================================================================== --- trunk/gui/win32/gui.c Thu Dec 8 18:11:52 2011 (r34412) +++ trunk/gui/win32/gui.c Thu Dec 8 20:41:28 2011 (r34413) @@ -238,7 +238,7 @@ static void handlemsg(HWND hWnd, int msg case evLoadPlay: case evLoad: if(display_openfilewindow(gui, 0) && (msg == evLoadPlay)) - handlemsg(hWnd, evLoadPlay); + gui->playercontrol(evLoadPlay); return; case evLoadSubtitle: display_opensubtitlewindow(gui); @@ -501,13 +501,13 @@ static LRESULT CALLBACK SubProc(HWND hWn gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0); } DragFinish((HDROP) wParam); - handlemsg(hWnd, evLoadPlay); + gui->playercontrol(evLoadPlay); } else { gui->playlist->clear_playlist(gui->playlist); gui->playlist->add_track(gui->playlist, (const char *) wParam, NULL, NULL, 0); - handlemsg(hWnd, evLoadPlay); + gui->playercontrol(evLoadPlay); } SetForegroundWindow(gui->subwindow); return 0; @@ -790,13 +790,13 @@ static LRESULT CALLBACK EventProc(HWND h gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0); } DragFinish((HDROP) wParam); - handlemsg(hWnd, evLoadPlay); + gui->playercontrol(evLoadPlay); } else { gui->playlist->clear_playlist(gui->playlist); gui->playlist->add_track(gui->playlist, (const char *) wParam, NULL, NULL, 0); - handlemsg(hWnd, evLoadPlay); + gui->playercontrol(evLoadPlay); } SetForegroundWindow(gui->mainwindow); return 0; @@ -1118,7 +1118,7 @@ static LRESULT CALLBACK EventProc(HWND h static void startplay(gui_t *gui) { - handlemsg(gui->mainwindow, evLoadPlay); + gui->playercontrol(evLoadPlay); } /* returns the bits per pixel of the desktop */ From subversion at mplayerhq.hu Fri Dec 9 12:42:25 2011 From: subversion at mplayerhq.hu (ib) Date: Fri, 9 Dec 2011 12:42:25 +0100 (CET) Subject: [MPlayer-cvslog] r34414 - in trunk/gui: app.c app.h win32/skinload.c win32/skinload.h Message-ID: <20111209114225.EBF3E125D7F@avserver.banki.hu> Author: ib Date: Fri Dec 9 12:42:25 2011 New Revision: 34414 Log: Remove non-existing GUI user events. There is no code for this events. Modified: trunk/gui/app.c trunk/gui/app.h trunk/gui/win32/skinload.c trunk/gui/win32/skinload.h Modified: trunk/gui/app.c ============================================================================== --- trunk/gui/app.c Thu Dec 8 20:41:28 2011 (r34413) +++ trunk/gui/app.c Fri Dec 9 12:42:25 2011 (r34414) @@ -74,14 +74,7 @@ static const evName evNames[] = { { evPreferences, "evPreferences" }, { evSkinBrowser, "evSkinBrowser" }, { evIconify, "evIconify" }, - { evExit, "evExit" }, - { evIncBalance, "evIncBalance" }, // NOTE TO MYSELF: not all of these events - { evDecBalance, "evDecBalance" }, // are actually implemented, and update doc - { evFName, "evFName" }, - { evMovieTime, "evMovieTime" }, - { evIncAudioBufDelay, "evIncAudioBufDelay" }, - { evDecAudioBufDelay, "evDecAudioBufDelay" }, - { evHelp, "evHelp" } + { evExit, "evExit" } }; /** Modified: trunk/gui/app.h ============================================================================== --- trunk/gui/app.h Thu Dec 8 20:41:28 2011 (r34413) +++ trunk/gui/app.h Fri Dec 9 12:42:25 2011 (r34414) @@ -73,13 +73,6 @@ // Internal events -#define evIncAudioBufDelay 33 // NOTE TO MYSELF: not all of these events -#define evDecAudioBufDelay 34 // are actually implemented, and update doc -#define evIncBalance 35 -#define evDecBalance 36 - -#define evHelp 37 - #define evPlayNetwork 41 #define evSetAudio 45 #define evSetVideo 46 @@ -101,8 +94,6 @@ #define evSubtitleLoaded 5011 #define evSetVCDTrack 5012 -#define evFName 7000 -#define evMovieTime 7001 #define evRedraw 7002 #define evHideWindow 7003 #define evShowWindow 7004 Modified: trunk/gui/win32/skinload.c ============================================================================== --- trunk/gui/win32/skinload.c Thu Dec 8 20:41:28 2011 (r34413) +++ trunk/gui/win32/skinload.c Fri Dec 9 12:42:25 2011 (r34414) @@ -85,14 +85,7 @@ static const evName evNames[] = { evPreferences, "evPreferences" }, { evSkinBrowser, "evSkinBrowser" }, { evIconify, "evIconify" }, - { evExit, "evExit" }, - { evIncBalance, "evIncBalance" }, - { evDecBalance, "evDecBalance" }, - { evFName, "evFName" }, - { evMovieTime, "evMovieTime" }, - { evIncAudioBufDelay, "evIncAudioBufDelay" }, - { evDecAudioBufDelay, "evDecAudioBufDelay" }, - { evHelp, "evHelp" } + { evExit, "evExit" } }; static const int evBoxs = sizeof(evNames) / sizeof(evName); Modified: trunk/gui/win32/skinload.h ============================================================================== --- trunk/gui/win32/skinload.h Thu Dec 8 20:41:28 2011 (r34413) +++ trunk/gui/win32/skinload.h Fri Dec 9 12:42:25 2011 (r34414) @@ -180,13 +180,6 @@ skin_t *loadskin(char *skindir, int desk // --- Internal events --- -#define evIncAudioBufDelay 33 -#define evDecAudioBufDelay 34 -#define evIncBalance 35 -#define evDecBalance 36 - -#define evHelp 37 - #define evPlayNetwork 41 #define evSetAudio 45 #define evSetVideo 46 @@ -208,8 +201,6 @@ skin_t *loadskin(char *skindir, int desk #define evSubtitleLoaded 5011 #define evSetVCDTrack 5012 -#define evFName 7000 -#define evMovieTime 7001 #define evRedraw 7002 #define evHideWindow 7003 #define evShowWindow 7004 From subversion at mplayerhq.hu Fri Dec 9 13:05:37 2011 From: subversion at mplayerhq.hu (ib) Date: Fri, 9 Dec 2011 13:05:37 +0100 (CET) Subject: [MPlayer-cvslog] r34415 - trunk/gui/app.c Message-ID: <20111209120537.734AC123CA7@avserver.banki.hu> Author: ib Date: Fri Dec 9 13:05:37 2011 New Revision: 34415 Log: Add doxygen comment to app.c Additionally, revise a comment. Modified: trunk/gui/app.c Modified: trunk/gui/app.c ============================================================================== --- trunk/gui/app.c Fri Dec 9 12:42:25 2011 (r34414) +++ trunk/gui/app.c Fri Dec 9 13:05:37 2011 (r34415) @@ -16,6 +16,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +/** + * @file + * @brief GUI application helpers + */ + #include "app.h" #include "skin/font.h" @@ -31,7 +36,7 @@ guiItems guiApp = { }; /** - * @brief Events belonging to event names. + * @brief Event messages belonging to event names. */ static const evName evNames[] = { { evNone, "evNone" }, From subversion at mplayerhq.hu Fri Dec 9 13:11:03 2011 From: subversion at mplayerhq.hu (ib) Date: Fri, 9 Dec 2011 13:11:03 +0100 (CET) Subject: [MPlayer-cvslog] r34416 - in trunk/gui: app.c app.h Message-ID: <20111209121103.D91C4125DAE@avserver.banki.hu> Author: ib Date: Fri Dec 9 13:11:03 2011 New Revision: 34416 Log: Change parameter name and its declaration to const. Modified: trunk/gui/app.c trunk/gui/app.h Modified: trunk/gui/app.c ============================================================================== --- trunk/gui/app.c Fri Dec 9 13:05:37 2011 (r34415) +++ trunk/gui/app.c Fri Dec 9 13:11:03 2011 (r34416) @@ -132,16 +132,16 @@ void appFreeStruct(void) /** * @brief Find the event belonging to an event name. * - * @param str event name + * @param name event name * * @return event >= 0 (ok) or -1 (not found) */ -int appFindMessage(unsigned char *str) +int appFindMessage(const char *name) { unsigned int i; for (i = 0; i < FF_ARRAY_ELEMS(evNames); i++) - if (!strcmp(evNames[i].name, str)) + if (!strcmp(evNames[i].name, name)) return evNames[i].message; return -1; Modified: trunk/gui/app.h ============================================================================== --- trunk/gui/app.h Fri Dec 9 13:05:37 2011 (r34415) +++ trunk/gui/app.h Fri Dec 9 13:11:03 2011 (r34416) @@ -187,7 +187,7 @@ typedef struct { extern guiItems guiApp; -int appFindMessage(unsigned char *str); +int appFindMessage(const char *name); void appFreeStruct(void); void btnModify(int event, float state); void btnSet(int event, int set); From subversion at mplayerhq.hu Fri Dec 9 13:25:49 2011 From: subversion at mplayerhq.hu (ib) Date: Fri, 9 Dec 2011 13:25:49 +0100 (CET) Subject: [MPlayer-cvslog] r34417 - in trunk/gui: app.h ui/main.c ui/widgets.c win32/skinload.h Message-ID: <20111209122549.24AAA125DC4@avserver.banki.hu> Author: ib Date: Fri Dec 9 13:25:48 2011 New Revision: 34417 Log: Replace evPlayNetwork by evLoadURL. Use same event messages for uiEventHandling() and gtkShow() where possible. Modified: trunk/gui/app.h trunk/gui/ui/main.c trunk/gui/ui/widgets.c trunk/gui/win32/skinload.h Modified: trunk/gui/app.h ============================================================================== --- trunk/gui/app.h Fri Dec 9 13:11:03 2011 (r34416) +++ trunk/gui/app.h Fri Dec 9 13:25:48 2011 (r34417) @@ -73,7 +73,6 @@ // Internal events -#define evPlayNetwork 41 #define evSetAudio 45 #define evSetVideo 46 #define evSetSubtitle 47 Modified: trunk/gui/ui/main.c ============================================================================== --- trunk/gui/ui/main.c Fri Dec 9 13:11:03 2011 (r34416) +++ trunk/gui/ui/main.c Fri Dec 9 13:25:48 2011 (r34417) @@ -145,7 +145,7 @@ void uiEventHandling( int msg,float para break; case evLoadURL: - gtkShow( evPlayNetwork,NULL ); + gtkShow( evLoadURL,NULL ); break; case evSetAudio: Modified: trunk/gui/ui/widgets.c ============================================================================== --- trunk/gui/ui/widgets.c Fri Dec 9 13:11:03 2011 (r34416) +++ trunk/gui/ui/widgets.c Fri Dec 9 13:25:48 2011 (r34417) @@ -308,7 +308,7 @@ void gtkShow(int type, char *param) break; - case evPlayNetwork: + case evLoadURL: ShowURLDialogBox(); gtkSetLayer(URL); break; Modified: trunk/gui/win32/skinload.h ============================================================================== --- trunk/gui/win32/skinload.h Fri Dec 9 13:11:03 2011 (r34416) +++ trunk/gui/win32/skinload.h Fri Dec 9 13:25:48 2011 (r34417) @@ -180,7 +180,6 @@ skin_t *loadskin(char *skindir, int desk // --- Internal events --- -#define evPlayNetwork 41 #define evSetAudio 45 #define evSetVideo 46 #define evPlayCD 48 From subversion at mplayerhq.hu Fri Dec 9 13:42:47 2011 From: subversion at mplayerhq.hu (ib) Date: Fri, 9 Dec 2011 13:42:47 +0100 (CET) Subject: [MPlayer-cvslog] r34418 - in trunk/gui: app.h win32/skinload.h Message-ID: <20111209124247.873F1125DFC@avserver.banki.hu> Author: ib Date: Fri Dec 9 13:42:47 2011 New Revision: 34418 Log: Remove unused symbolic constant definitions for events. Modified: trunk/gui/app.h trunk/gui/win32/skinload.h Modified: trunk/gui/app.h ============================================================================== --- trunk/gui/app.h Fri Dec 9 13:25:48 2011 (r34417) +++ trunk/gui/app.h Fri Dec 9 13:42:47 2011 (r34418) @@ -79,23 +79,15 @@ // General events -#define evFileLoaded 5000 -#define evHideMouseCursor 5001 -#define evMessageBox 5002 -#define evGeneralTimer 5003 -#define evGtkIsOk 5004 #define evShowPopUpMenu 5005 #define evHidePopUpMenu 5006 #define evSetDVDAudio 5007 #define evSetDVDSubtitle 5008 #define evSetDVDTitle 5009 #define evSetDVDChapter 5010 -#define evSubtitleLoaded 5011 #define evSetVCDTrack 5012 #define evRedraw 7002 -#define evHideWindow 7003 -#define evShowWindow 7004 #define evFirstLoad 7005 typedef struct { Modified: trunk/gui/win32/skinload.h ============================================================================== --- trunk/gui/win32/skinload.h Fri Dec 9 13:25:48 2011 (r34417) +++ trunk/gui/win32/skinload.h Fri Dec 9 13:42:47 2011 (r34418) @@ -186,23 +186,15 @@ skin_t *loadskin(char *skindir, int desk // --- General events --- -#define evFileLoaded 5000 -#define evHideMouseCursor 5001 -#define evMessageBox 5002 -#define evGeneralTimer 5003 -#define evGtkIsOk 5004 #define evShowPopUpMenu 5005 #define evHidePopUpMenu 5006 #define evSetDVDAudio 5007 #define evSetDVDSubtitle 5008 #define evSetDVDTitle 5009 #define evSetDVDChapter 5010 -#define evSubtitleLoaded 5011 #define evSetVCDTrack 5012 #define evRedraw 7002 -#define evHideWindow 7003 -#define evShowWindow 7004 #define evFirstLoad 7005 #endif /* MPLAYER_GUI_SKINLOAD_H */ From subversion at mplayerhq.hu Fri Dec 9 13:47:29 2011 From: subversion at mplayerhq.hu (ib) Date: Fri, 9 Dec 2011 13:47:29 +0100 (CET) Subject: [MPlayer-cvslog] r34419 - in trunk/gui: app.h ui/widgets.c win32/skinload.h Message-ID: <20111209124729.47FA8125E10@avserver.banki.hu> Author: ib Date: Fri Dec 9 13:47:28 2011 New Revision: 34419 Log: Remove unused symbolic constant and code for evFirstLoad. Modified: trunk/gui/app.h trunk/gui/ui/widgets.c trunk/gui/win32/skinload.h Modified: trunk/gui/app.h ============================================================================== --- trunk/gui/app.h Fri Dec 9 13:42:47 2011 (r34418) +++ trunk/gui/app.h Fri Dec 9 13:47:28 2011 (r34419) @@ -88,7 +88,6 @@ #define evSetVCDTrack 5012 #define evRedraw 7002 -#define evFirstLoad 7005 typedef struct { int message; Modified: trunk/gui/ui/widgets.c ============================================================================== --- trunk/gui/ui/widgets.c Fri Dec 9 13:42:47 2011 (r34418) +++ trunk/gui/ui/widgets.c Fri Dec 9 13:47:28 2011 (r34419) @@ -265,11 +265,6 @@ void gtkShow(int type, char *param) gtkSetLayer(fsFileSelect); break; - case evFirstLoad: - ShowFileSelect(fsVideoSelector, 0); - gtkSetLayer(fsFileSelect); - break; - case evLoadSubtitle: ShowFileSelect(fsSubtitleSelector, 0); gtkSetLayer(fsFileSelect); Modified: trunk/gui/win32/skinload.h ============================================================================== --- trunk/gui/win32/skinload.h Fri Dec 9 13:42:47 2011 (r34418) +++ trunk/gui/win32/skinload.h Fri Dec 9 13:47:28 2011 (r34419) @@ -195,6 +195,5 @@ skin_t *loadskin(char *skindir, int desk #define evSetVCDTrack 5012 #define evRedraw 7002 -#define evFirstLoad 7005 #endif /* MPLAYER_GUI_SKINLOAD_H */ From subversion at mplayerhq.hu Fri Dec 9 14:14:24 2011 From: subversion at mplayerhq.hu (ib) Date: Fri, 9 Dec 2011 14:14:24 +0100 (CET) Subject: [MPlayer-cvslog] r34420 - trunk/gui/win32/skinload.h Message-ID: <20111209131424.76DF3125E48@avserver.banki.hu> Author: ib Date: Fri Dec 9 14:14:23 2011 New Revision: 34420 Log: Add evSetSubtitle event to the Win32 GUI. Although it doesn't exist in the Win32 GUI it should be defined as it is in the X11/GTK GUI. Additionally, move evPlayCD (currently only existing in the Win32 GUI) to the user event definitions. Modified: trunk/gui/win32/skinload.h Modified: trunk/gui/win32/skinload.h ============================================================================== --- trunk/gui/win32/skinload.h Fri Dec 9 13:47:28 2011 (r34419) +++ trunk/gui/win32/skinload.h Fri Dec 9 14:14:23 2011 (r34420) @@ -144,6 +144,7 @@ skin_t *loadskin(char *skindir, int desk #define evLoadSubtitle 38 #define evDropSubtitle 43 #define evPlaylist 10 +#define evPlayCD 48 #define evPlayVCD 40 #define evPlayDVD 39 #define evLoadURL 5013 @@ -182,7 +183,7 @@ skin_t *loadskin(char *skindir, int desk #define evSetAudio 45 #define evSetVideo 46 -#define evPlayCD 48 +#define evSetSubtitle 47 // --- General events --- From subversion at mplayerhq.hu Fri Dec 9 14:34:39 2011 From: subversion at mplayerhq.hu (ib) Date: Fri, 9 Dec 2011 14:34:39 +0100 (CET) Subject: [MPlayer-cvslog] r34421 - in trunk/gui: app.h interface.c ui/gtk/menu.c ui/main.c ui/playbar.c ui/sub.c ui/widgets.c win32/skinload.h Message-ID: <20111209133439.2F021125EB4@avserver.banki.hu> Author: ib Date: Fri Dec 9 14:34:38 2011 New Revision: 34421 Log: Change prefix for internal events from ev to iv. This is in order to distinguish them from the external ones. Modified: trunk/gui/app.h trunk/gui/interface.c trunk/gui/ui/gtk/menu.c trunk/gui/ui/main.c trunk/gui/ui/playbar.c trunk/gui/ui/sub.c trunk/gui/ui/widgets.c trunk/gui/win32/skinload.h Modified: trunk/gui/app.h ============================================================================== --- trunk/gui/app.h Fri Dec 9 14:14:23 2011 (r34420) +++ trunk/gui/app.h Fri Dec 9 14:34:38 2011 (r34421) @@ -73,21 +73,19 @@ // Internal events -#define evSetAudio 45 -#define evSetVideo 46 -#define evSetSubtitle 47 - -// General events +#define ivSetAudio 45 +#define ivSetVideo 46 +#define ivSetSubtitle 47 -#define evShowPopUpMenu 5005 -#define evHidePopUpMenu 5006 -#define evSetDVDAudio 5007 -#define evSetDVDSubtitle 5008 -#define evSetDVDTitle 5009 -#define evSetDVDChapter 5010 -#define evSetVCDTrack 5012 +#define ivShowPopUpMenu 5005 +#define ivHidePopUpMenu 5006 +#define ivSetDVDAudio 5007 +#define ivSetDVDSubtitle 5008 +#define ivSetDVDTitle 5009 +#define ivSetDVDChapter 5010 +#define ivSetVCDTrack 5012 -#define evRedraw 7002 +#define ivRedraw 7002 typedef struct { int message; Modified: trunk/gui/interface.c ============================================================================== --- trunk/gui/interface.c Fri Dec 9 14:14:23 2011 (r34420) +++ trunk/gui/interface.c Fri Dec 9 14:34:38 2011 (r34421) @@ -723,7 +723,7 @@ int gui(int what, void *data) break; case GUI_REDRAW: - uiEventHandling(evRedraw, 0); + uiEventHandling(ivRedraw, 0); break; case GUI_SETUP_VIDEO_WINDOW: @@ -756,7 +756,7 @@ int gui(int what, void *data) case GUI_END_FILE: - uiEventHandling(evRedraw, 1); + uiEventHandling(ivRedraw, 1); guiInfo.sh_video = NULL; Modified: trunk/gui/ui/gtk/menu.c ============================================================================== --- trunk/gui/ui/gtk/menu.c Fri Dec 9 14:14:23 2011 (r34420) +++ trunk/gui/ui/gtk/menu.c Fri Dec 9 14:34:38 2011 (r34421) @@ -461,8 +461,8 @@ GtkWidget * create_PopUpMenu( void ) for ( i=1;i < guiInfo.Tracks;i++ ) { snprintf( tmp,32,MSGTR_MENU_Title,i ); - //AddMenuItem( VCDTitleMenu,tmp,( i << 16 ) + evSetVCDTrack ); - AddMenuItem(window1, (const char*)empty_xpm, VCDTitleMenu,tmp,( ( i + 1 ) << 16 ) + evSetVCDTrack ); + //AddMenuItem( VCDTitleMenu,tmp,( i << 16 ) + ivSetVCDTrack ); + AddMenuItem(window1, (const char*)empty_xpm, VCDTitleMenu,tmp,( ( i + 1 ) << 16 ) + ivSetVCDTrack ); } } else @@ -485,7 +485,7 @@ GtkWidget * create_PopUpMenu( void ) snprintf( tmp,32,MSGTR_MENU_Title,i); AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDTitleMenu,tmp, guiInfo.Track == i, - (i << 16) + evSetDVDTitle ); + (i << 16) + ivSetDVDTitle ); } } else @@ -501,7 +501,7 @@ GtkWidget * create_PopUpMenu( void ) { snprintf( tmp,32,MSGTR_MENU_Chapter,i ); AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDChapterMenu,tmp,guiInfo.Chapter == i, - ( i << 16 ) + evSetDVDChapter ); + ( i << 16 ) + ivSetDVDChapter ); } } else @@ -521,7 +521,7 @@ GtkWidget * create_PopUpMenu( void ) // if ( id == -1 ) id=audio_id; //guiInfo.AudioStream[i].id; AddMenuCheckItem( window1, (const char*)dolby_xpm, DVDAudioLanguageMenu,tmp, id == guiInfo.AudioStream[i].id, - ( guiInfo.AudioStream[i].id << 16 ) + evSetDVDAudio ); + ( guiInfo.AudioStream[i].id << 16 ) + ivSetDVDAudio ); } } else @@ -533,13 +533,13 @@ GtkWidget * create_PopUpMenu( void ) if ( guiInfo.Subtitles ) { char tmp[64]; int i; - AddMenuItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,( (unsigned short)-1 << 16 ) + evSetDVDSubtitle ); + AddMenuItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,( (unsigned short)-1 << 16 ) + ivSetDVDSubtitle ); for ( i=0;i < guiInfo.Subtitles;i++ ) { av_strlcpy( tmp,GetLanguage( guiInfo.Subtitle[i].language ),sizeof(tmp) ); AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,tmp, dvdsub_id == guiInfo.Subtitle[i].id, - ( guiInfo.Subtitle[i].id << 16 ) + evSetDVDSubtitle ); + ( guiInfo.Subtitle[i].id << 16 ) + ivSetDVDSubtitle ); } } else @@ -574,7 +574,7 @@ GtkWidget * create_PopUpMenu( void ) int aid = ((sh_audio_t *)demuxer->a_streams[i])->aid; char tmp[32]; snprintf( tmp,32,MSGTR_MENU_Track,aid ); - AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( aid << 16 ) + evSetAudio ); + AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( aid << 16 ) + ivSetAudio ); } } @@ -590,7 +590,7 @@ GtkWidget * create_PopUpMenu( void ) int vid = ((sh_video_t *)demuxer->v_streams[i])->vid; char tmp[32]; snprintf( tmp,32,MSGTR_MENU_Track,vid ); - AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( vid << 16 ) + evSetVideo ); + AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( vid << 16 ) + ivSetVideo ); } } } @@ -600,12 +600,12 @@ GtkWidget * create_PopUpMenu( void ) { int i; SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu, MSGTR_MENU_Subtitles ); - AddMenuItem( window1, (const char*)empty_xpm, SubMenu, MSGTR_MENU_None, (-1 << 16) + evSetSubtitle ); + AddMenuItem( window1, (const char*)empty_xpm, SubMenu, MSGTR_MENU_None, (-1 << 16) + ivSetSubtitle ); for ( i=0;i < global_sub_size;i++ ) { char tmp[32]; snprintf( tmp, 32, MSGTR_MENU_Track, i ); - AddMenuItem( window1,(const char*)empty_xpm,SubMenu,tmp,( i << 16 ) + evSetSubtitle ); + AddMenuItem( window1,(const char*)empty_xpm,SubMenu,tmp,( i << 16 ) + ivSetSubtitle ); } } Modified: trunk/gui/ui/main.c ============================================================================== --- trunk/gui/ui/main.c Fri Dec 9 14:14:23 2011 (r34420) +++ trunk/gui/ui/main.c Fri Dec 9 14:34:38 2011 (r34421) @@ -148,22 +148,22 @@ void uiEventHandling( int msg,float para gtkShow( evLoadURL,NULL ); break; - case evSetAudio: + case ivSetAudio: if ( !mpctx_get_demuxer(guiInfo.mpcontext) || audio_id == iparam ) break; audio_id=iparam; goto play; - case evSetVideo: + case ivSetVideo: if ( !mpctx_get_demuxer(guiInfo.mpcontext) || video_id == iparam ) break; video_id=iparam; goto play; - case evSetSubtitle: + case ivSetSubtitle: mp_property_do("sub",M_PROPERTY_SET,&iparam,guiInfo.mpcontext); break; #ifdef CONFIG_VCD - case evSetVCDTrack: + case ivSetVCDTrack: guiInfo.Track=iparam; case evPlayVCD: guiInfoMediumClear ( CLEAR_ALL ); @@ -230,19 +230,19 @@ play: uiPlay(); break; #ifdef CONFIG_DVDREAD - case evSetDVDSubtitle: + case ivSetDVDSubtitle: dvdsub_id=iparam; goto play_dvd_2; break; - case evSetDVDAudio: + case ivSetDVDAudio: audio_id=iparam; goto play_dvd_2; break; - case evSetDVDChapter: + case ivSetDVDChapter: guiInfo.Chapter=iparam; goto play_dvd_2; break; - case evSetDVDTitle: + case ivSetDVDTitle: guiInfo.Track=iparam; guiInfo.Chapter=1; guiInfo.Angle=1; @@ -394,7 +394,7 @@ set_volume: break; // --- timer events - case evRedraw: + case ivRedraw: { unsigned now = GetTimerMS(); if ((now > last_redraw_time) && @@ -437,7 +437,7 @@ void uiMainMouseHandle( int Button,int X switch ( Button ) { case wsPMMouseButton: - gtkShow( evHidePopUpMenu,NULL ); + gtkShow( ivHidePopUpMenu,NULL ); uiShowMenu( RX,RY ); itemtype=itPRMButton; break; @@ -446,7 +446,7 @@ void uiMainMouseHandle( int Button,int X break; case wsPLMouseButton: - gtkShow( evHidePopUpMenu,NULL ); + gtkShow( ivHidePopUpMenu,NULL ); sx=X; sy=Y; boxMoved=1; itemtype=itPLMButton; SelectedItem=currentselected; if ( SelectedItem == -1 ) break; @@ -493,7 +493,7 @@ void uiMainMouseHandle( int Button,int X break; case wsRRMouseButton: - gtkShow( evShowPopUpMenu,NULL ); + gtkShow( ivShowPopUpMenu,NULL ); break; // --- rolled mouse ... de szar :))) Modified: trunk/gui/ui/playbar.c ============================================================================== --- trunk/gui/ui/playbar.c Fri Dec 9 14:14:23 2011 (r34420) +++ trunk/gui/ui/playbar.c Fri Dec 9 14:34:38 2011 (r34421) @@ -132,18 +132,18 @@ static void uiPlaybarMouseHandle( int Bu switch ( Button ) { case wsPMMouseButton: - gtkShow( evHidePopUpMenu,NULL ); + gtkShow( ivHidePopUpMenu,NULL ); uiShowMenu( RX,RY ); break; case wsRMMouseButton: uiHideMenu( RX,RY,0 ); break; case wsRRMouseButton: - gtkShow( evShowPopUpMenu,NULL ); + gtkShow( ivShowPopUpMenu,NULL ); break; // --- case wsPLMouseButton: - gtkShow( evHidePopUpMenu,NULL ); + gtkShow( ivHidePopUpMenu,NULL ); SelectedItem=currentselected; if ( SelectedItem == -1 ) break; // yeees, i'm move the fucking window item=&guiApp.playbarItems[SelectedItem]; Modified: trunk/gui/ui/sub.c ============================================================================== --- trunk/gui/ui/sub.c Fri Dec 9 14:14:23 2011 (r34420) +++ trunk/gui/ui/sub.c Fri Dec 9 14:34:38 2011 (r34421) @@ -62,10 +62,10 @@ void uiSubMouseHandle( int Button,int X, switch( Button ) { case wsRRMouseButton: - gtkShow( evShowPopUpMenu,NULL ); + gtkShow( ivShowPopUpMenu,NULL ); break; case wsPMMouseButton: - gtkShow( evHidePopUpMenu,NULL ); + gtkShow( ivHidePopUpMenu,NULL ); uiShowMenu( RX,RY ); msButton=wsPMMouseButton; break; @@ -75,7 +75,7 @@ void uiSubMouseHandle( int Button,int X, break; // --- case wsPLMouseButton: - gtkShow( evHidePopUpMenu,NULL ); + gtkShow( ivHidePopUpMenu,NULL ); sx=X; sy=Y; msButton=wsPLMouseButton; mplSubMoved=0; Modified: trunk/gui/ui/widgets.c ============================================================================== --- trunk/gui/ui/widgets.c Fri Dec 9 14:14:23 2011 (r34420) +++ trunk/gui/ui/widgets.c Fri Dec 9 14:34:38 2011 (r34421) @@ -280,7 +280,7 @@ void gtkShow(int type, char *param) gtkSetLayer(About); break; - case evShowPopUpMenu: + case ivShowPopUpMenu: gtkPopupMenu = evNone; gtkPopupMenuParam = 0; @@ -293,7 +293,7 @@ void gtkShow(int type, char *param) gtk_menu_popup(GTK_MENU(PopUpMenu), NULL, NULL, NULL, NULL, 0, 0); break; - case evHidePopUpMenu: + case ivHidePopUpMenu: if (PopUpMenu) { gtk_widget_hide(PopUpMenu); Modified: trunk/gui/win32/skinload.h ============================================================================== --- trunk/gui/win32/skinload.h Fri Dec 9 14:14:23 2011 (r34420) +++ trunk/gui/win32/skinload.h Fri Dec 9 14:34:38 2011 (r34421) @@ -181,20 +181,18 @@ skin_t *loadskin(char *skindir, int desk // --- Internal events --- -#define evSetAudio 45 -#define evSetVideo 46 -#define evSetSubtitle 47 - -// --- General events --- +#define ivSetAudio 45 +#define ivSetVideo 46 +#define ivSetSubtitle 47 -#define evShowPopUpMenu 5005 -#define evHidePopUpMenu 5006 -#define evSetDVDAudio 5007 -#define evSetDVDSubtitle 5008 -#define evSetDVDTitle 5009 -#define evSetDVDChapter 5010 -#define evSetVCDTrack 5012 +#define ivShowPopUpMenu 5005 +#define ivHidePopUpMenu 5006 +#define ivSetDVDAudio 5007 +#define ivSetDVDSubtitle 5008 +#define ivSetDVDTitle 5009 +#define ivSetDVDChapter 5010 +#define ivSetVCDTrack 5012 -#define evRedraw 7002 +#define ivRedraw 7002 #endif /* MPLAYER_GUI_SKINLOAD_H */ From subversion at mplayerhq.hu Fri Dec 9 16:17:11 2011 From: subversion at mplayerhq.hu (siretart) Date: Fri, 9 Dec 2011 16:17:11 +0100 (CET) Subject: [MPlayer-cvslog] r34422 - trunk/debian/control Message-ID: <20111209151711.7DE871255F3@avserver.banki.hu> Author: siretart Date: Fri Dec 9 16:17:11 2011 New Revision: 34422 Log: loosen the dependency on libjpeg-dev Debian/wheezy and Ubuntu/precise migrate from libjpeg62 to libjpeg8. Using this more lax build-dependency specification allows the package to build on system with both libjpeg62 and libjpeg8. Modified: trunk/debian/control Modified: trunk/debian/control ============================================================================== --- trunk/debian/control Fri Dec 9 14:34:38 2011 (r34421) +++ trunk/debian/control Fri Dec 9 16:17:11 2011 (r34422) @@ -27,7 +27,7 @@ Build-Depends: debhelper (>= 7), libgl1-mesa-dev, libgtk2.0-dev, libjack-dev, - libjpeg62-dev, + libjpeg-dev, liblircclient-dev, liblivemedia-dev, liblzo2-dev, From subversion at mplayerhq.hu Sat Dec 10 15:27:04 2011 From: subversion at mplayerhq.hu (reimar) Date: Sat, 10 Dec 2011 15:27:04 +0100 (CET) Subject: [MPlayer-cvslog] r34423 - trunk/osdep/keycodes.h Message-ID: <20111210142704.C9A671266EA@avserver.banki.hu> Author: reimar Date: Sat Dec 10 15:27:04 2011 New Revision: 34423 Log: Use an enum to define keycodes and fix CTRL and backspace key having the same keycode. This is because KEY_CTRL was supposed to be the name of the "key class", not the key, but that was later misunderstood. Obviously that was some major bad naming.... Modified: trunk/osdep/keycodes.h Modified: trunk/osdep/keycodes.h ============================================================================== --- trunk/osdep/keycodes.h Fri Dec 9 16:17:11 2011 (r34422) +++ trunk/osdep/keycodes.h Sat Dec 10 15:27:04 2011 (r34423) @@ -23,24 +23,61 @@ #ifndef MPLAYER_KEYCODES_H #define MPLAYER_KEYCODES_H -#define KEY_ENTER 13 -#define KEY_TAB 9 - #define KEY_BASE 0x100 -/* Function keys */ -#define KEY_F (KEY_BASE+64) - -/* Control keys */ -#define KEY_CTRL (KEY_BASE) -#define KEY_BACKSPACE (KEY_CTRL+0) -#define KEY_DELETE (KEY_CTRL+1) -#define KEY_INSERT (KEY_CTRL+2) -#define KEY_HOME (KEY_CTRL+3) -#define KEY_END (KEY_CTRL+4) -#define KEY_PAGE_UP (KEY_CTRL+5) -#define KEY_PAGE_DOWN (KEY_CTRL+6) -#define KEY_ESC (KEY_CTRL+7) +enum { + KEY_TAB = 9, + KEY_ENTER = 13, + /* Control keys */ + KEY_BACKSPACE = KEY_BASE, + KEY_DELETE, + KEY_INSERT, + KEY_HOME, + KEY_END, + KEY_PAGE_UP, + KEY_PAGE_DOWN, + KEY_ESC, + /* Cursor movement */ + KEY_RIGHT = KEY_BASE + 16, + KEY_LEFT, + KEY_DOWN, + KEY_UP, + /* Keypad keys */ + KEY_KP0 = KEY_BASE + 32, + KEY_KP1, + KEY_KP2, + KEY_KP3, + KEY_KP4, + KEY_KP5, + KEY_KP6, + KEY_KP7, + KEY_KP8, + KEY_KP9, + KEY_KPDEC, + KEY_KPINS, + KEY_KPDEL, + KEY_KPENTER, + /* Key combination keys */ + KEY_CTRL = KEY_BASE + 48, + /* Function keys */ + KEY_F = KEY_BASE + 64, + /* Multimedia keyboard/remote keys */ + KEY_POWER = KEY_BASE+384, + KEY_MENU, + KEY_PLAY, + KEY_PAUSE, + KEY_PLAYPAUSE, + KEY_STOP, + KEY_FORWARD, + KEY_REWIND, + KEY_NEXT, + KEY_PREV, + KEY_VOLUME_UP, + KEY_VOLUME_DOWN, + KEY_MUTE, + /* Special internal/virtual keys */ + KEY_CLOSE_WIN = 0x1000, +}; /* Control keys short name */ #define KEY_BS KEY_BACKSPACE @@ -50,48 +87,4 @@ #define KEY_PGDOWN KEY_PAGE_DOWN #define KEY_PGDWN KEY_PAGE_DOWN -/* Cursor movement */ -#define KEY_CRSR (KEY_BASE+16) -#define KEY_RIGHT (KEY_CRSR+0) -#define KEY_LEFT (KEY_CRSR+1) -#define KEY_DOWN (KEY_CRSR+2) -#define KEY_UP (KEY_CRSR+3) - -/* Multimedia keyboard/remote keys */ -#define KEY_MM_BASE (KEY_BASE+384) -#define KEY_POWER (KEY_MM_BASE+0) -#define KEY_MENU (KEY_MM_BASE+1) -#define KEY_PLAY (KEY_MM_BASE+2) -#define KEY_PAUSE (KEY_MM_BASE+3) -#define KEY_PLAYPAUSE (KEY_MM_BASE+4) -#define KEY_STOP (KEY_MM_BASE+5) -#define KEY_FORWARD (KEY_MM_BASE+6) -#define KEY_REWIND (KEY_MM_BASE+7) -#define KEY_NEXT (KEY_MM_BASE+8) -#define KEY_PREV (KEY_MM_BASE+9) -#define KEY_VOLUME_UP (KEY_MM_BASE+10) -#define KEY_VOLUME_DOWN (KEY_MM_BASE+11) -#define KEY_MUTE (KEY_MM_BASE+12) - -/* Keypad keys */ -#define KEY_KEYPAD (KEY_BASE+32) -#define KEY_KP0 (KEY_KEYPAD+0) -#define KEY_KP1 (KEY_KEYPAD+1) -#define KEY_KP2 (KEY_KEYPAD+2) -#define KEY_KP3 (KEY_KEYPAD+3) -#define KEY_KP4 (KEY_KEYPAD+4) -#define KEY_KP5 (KEY_KEYPAD+5) -#define KEY_KP6 (KEY_KEYPAD+6) -#define KEY_KP7 (KEY_KEYPAD+7) -#define KEY_KP8 (KEY_KEYPAD+8) -#define KEY_KP9 (KEY_KEYPAD+9) -#define KEY_KPDEC (KEY_KEYPAD+10) -#define KEY_KPINS (KEY_KEYPAD+11) -#define KEY_KPDEL (KEY_KEYPAD+12) -#define KEY_KPENTER (KEY_KEYPAD+13) - -/* Special keys */ -#define KEY_INTERN (0x1000) -#define KEY_CLOSE_WIN (KEY_INTERN+0) - #endif /* MPLAYER_KEYCODES_H */ From subversion at mplayerhq.hu Sat Dec 10 15:31:28 2011 From: subversion at mplayerhq.hu (reimar) Date: Sat, 10 Dec 2011 15:31:28 +0100 (CET) Subject: [MPlayer-cvslog] r34424 - trunk/input/input.c Message-ID: <20111210143128.98DF71266EA@avserver.banki.hu> Author: reimar Date: Sat Dec 10 15:31:28 2011 New Revision: 34424 Log: By default ignore CTRL key on its own. Modified: trunk/input/input.c Modified: trunk/input/input.c ============================================================================== --- trunk/input/input.c Sat Dec 10 15:27:04 2011 (r34423) +++ trunk/input/input.c Sat Dec 10 15:31:28 2011 (r34424) @@ -377,6 +377,9 @@ static const mp_key_name_t key_names[] = static const mp_cmd_bind_t def_cmd_binds[] = { + // Ignore modifiers by default + { { KEY_CTRL, 0 }, "ignore" }, + { { MOUSE_BTN3, 0 }, "seek 10" }, { { MOUSE_BTN4, 0 }, "seek -10" }, { { MOUSE_BTN5, 0 }, "volume 1" }, From subversion at mplayerhq.hu Sat Dec 10 21:21:51 2011 From: subversion at mplayerhq.hu (reimar) Date: Sat, 10 Dec 2011 21:21:51 +0100 (CET) Subject: [MPlayer-cvslog] r34425 - in trunk/libvo: gl_common.c gl_common.h matrixview.c vo_gl.c vo_gl2.c Message-ID: <20111210202151.4C82E126731@avserver.banki.hu> Author: reimar Date: Sat Dec 10 21:21:50 2011 New Revision: 34425 Log: Use glLoadMatrixf. This makes it easier to support OpenGL ES. Modified: trunk/libvo/gl_common.c trunk/libvo/gl_common.h trunk/libvo/matrixview.c trunk/libvo/vo_gl.c trunk/libvo/vo_gl2.c Modified: trunk/libvo/gl_common.c ============================================================================== --- trunk/libvo/gl_common.c Sat Dec 10 15:31:28 2011 (r34424) +++ trunk/libvo/gl_common.c Sat Dec 10 21:21:50 2011 (r34425) @@ -49,10 +49,7 @@ void (GLAPIENTRY *mpglEnd)(void); void (GLAPIENTRY *mpglViewport)(GLint, GLint, GLsizei, GLsizei); void (GLAPIENTRY *mpglMatrixMode)(GLenum); void (GLAPIENTRY *mpglLoadIdentity)(void); -void (GLAPIENTRY *mpglTranslated)(double, double, double); -void (GLAPIENTRY *mpglScaled)(double, double, double); -void (GLAPIENTRY *mpglOrtho)(double, double, double, double, double, double); -void (GLAPIENTRY *mpglFrustum)(double, double, double, double, double, double); +void (GLAPIENTRY *mpglLoadMatrixf)(float *); void (GLAPIENTRY *mpglPushMatrix)(void); void (GLAPIENTRY *mpglPopMatrix)(void); void (GLAPIENTRY *mpglClear)(GLbitfield); @@ -396,10 +393,7 @@ static const extfunc_desc_t extfuncs[] = DEF_FUNC_DESC(Viewport), DEF_FUNC_DESC(MatrixMode), DEF_FUNC_DESC(LoadIdentity), - DEF_FUNC_DESC(Translated), - DEF_FUNC_DESC(Scaled), - DEF_FUNC_DESC(Ortho), - DEF_FUNC_DESC(Frustum), + DEF_FUNC_DESC(LoadMatrixf), DEF_FUNC_DESC(PushMatrix), DEF_FUNC_DESC(PopMatrix), DEF_FUNC_DESC(Clear), Modified: trunk/libvo/gl_common.h ============================================================================== --- trunk/libvo/gl_common.h Sat Dec 10 15:31:28 2011 (r34424) +++ trunk/libvo/gl_common.h Sat Dec 10 21:21:50 2011 (r34425) @@ -441,10 +441,7 @@ extern void (GLAPIENTRY *mpglEnd)(void); extern void (GLAPIENTRY *mpglViewport)(GLint, GLint, GLsizei, GLsizei); extern void (GLAPIENTRY *mpglMatrixMode)(GLenum); extern void (GLAPIENTRY *mpglLoadIdentity)(void); -extern void (GLAPIENTRY *mpglTranslated)(double, double, double); -extern void (GLAPIENTRY *mpglScaled)(double, double, double); -extern void (GLAPIENTRY *mpglOrtho)(double, double, double, double, double, double); -extern void (GLAPIENTRY *mpglFrustum)(double, double, double, double, double, double); +extern void (GLAPIENTRY *mpglLoadMatrixf)(float *); extern void (GLAPIENTRY *mpglPushMatrix)(void); extern void (GLAPIENTRY *mpglPopMatrix)(void); extern void (GLAPIENTRY *mpglClear)(GLbitfield); Modified: trunk/libvo/matrixview.c ============================================================================== --- trunk/libvo/matrixview.c Sat Dec 10 15:31:28 2011 (r34424) +++ trunk/libvo/matrixview.c Sat Dec 10 21:21:50 2011 (r34425) @@ -310,15 +310,23 @@ void matrixview_init(int w, int h) void matrixview_reshape(int w, int h) { + double nearplane = -Z_Off - Z_Depth; + // perspective projection, also adjusting vertex position + // by Z_Off and with simplified Z equation since the absolute + // Z value does not matter, only relative to other pixels + float matrix[16] = { + nearplane / _text_x, 0, 0, 0, + 0, nearplane / _text_y, 0, 0, + 0, 0, 1, -1, + 0, 0, 0, -Z_Off + }; mpglViewport(0, 0, w, h); mpglMatrixMode(GL_PROJECTION); - mpglLoadIdentity(); - mpglFrustum(-_text_x, _text_x, -_text_y, _text_y, -Z_Off - Z_Depth, -Z_Off); + mpglLoadMatrixf(matrix); mpglMatrixMode(GL_MODELVIEW); mpglLoadIdentity(); - mpglTranslated(0.0f, 0.0f, Z_Off); } Modified: trunk/libvo/vo_gl.c ============================================================================== --- trunk/libvo/vo_gl.c Sat Dec 10 15:31:28 2011 (r34424) +++ trunk/libvo/vo_gl.c Sat Dec 10 21:21:50 2011 (r34425) @@ -172,6 +172,13 @@ static unsigned int slice_height = 1; static void redraw(void); static void resize(int x,int y){ + // simple orthogonal projection for 0-image_width;0-image_height + float matrix[16] = { + 2.0/image_width, 0, 0, 0, + 0, -2.0/image_height, 0, 0, + 0, 0, 0, 0, + -1, 1, 0, 1 + }; mp_msg(MSGT_VO, MSGL_V, "[gl] Resize: %dx%d\n",x,y); if (WinID >= 0) { int left = 0, top = 0, w = x, h = y; @@ -182,7 +189,6 @@ static void resize(int x,int y){ mpglViewport( 0, 0, x, y ); mpglMatrixMode(GL_PROJECTION); - mpglLoadIdentity(); ass_border_x = ass_border_y = 0; if (aspect_scaling() && use_aspect) { int new_w, new_h; @@ -193,11 +199,14 @@ static void resize(int x,int y){ new_h += vo_panscan_y; scale_x = (GLdouble)new_w / (GLdouble)x; scale_y = (GLdouble)new_h / (GLdouble)y; - mpglScaled(scale_x, scale_y, 1); + matrix[0] *= scale_x; + matrix[12] *= scale_x; + matrix[5] *= scale_y; + matrix[13] *= scale_y; ass_border_x = (vo_dwidth - new_w) / 2; ass_border_y = (vo_dheight - new_h) / 2; } - mpglOrtho(0, image_width, image_height, 0, -1,1); + mpglLoadMatrixf(matrix); mpglMatrixMode(GL_MODELVIEW); mpglLoadIdentity(); @@ -775,10 +784,16 @@ static void do_render_osd(int type) { return; // set special rendering parameters if (!scaled_osd) { + // simple orthogonal projection for 0-vo_dwidth;0-vo_dheight + float matrix[16] = { + 2.0/vo_dwidth, 0, 0, 0, + 0, -2.0/vo_dheight, 0, 0, + 0, 0, 0, 0, + -1, 1, 0, 1 + }; mpglMatrixMode(GL_PROJECTION); mpglPushMatrix(); - mpglLoadIdentity(); - mpglOrtho(0, vo_dwidth, vo_dheight, 0, -1, 1); + mpglLoadMatrixf(matrix); } mpglEnable(GL_BLEND); if (draw_eosd) { Modified: trunk/libvo/vo_gl2.c ============================================================================== --- trunk/libvo/vo_gl2.c Sat Dec 10 15:31:28 2011 (r34424) +++ trunk/libvo/vo_gl2.c Sat Dec 10 21:21:50 2011 (r34425) @@ -423,6 +423,13 @@ static void drawTextureDisplay (void) static void resize(int x,int y){ + // simple orthogonal projection for 0-1;0-1 + static const float matrix[16] = { + 2, 0, 0, 0, + 0, -2, 0, 0, + 0, 0, 0, 0, + -1, 1, 0, 1, + }; mp_msg(MSGT_VO,MSGL_V,"[gl2] Resize: %dx%d\n",x,y); if(aspect_scaling()) { glClear(GL_COLOR_BUFFER_BIT); @@ -443,8 +450,7 @@ static void resize(int x,int y){ } glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho (0, 1, 1, 0, -1.0, 1.0); + glLoadMatrixf(matrix); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); From subversion at mplayerhq.hu Sat Dec 10 21:55:31 2011 From: subversion at mplayerhq.hu (reimar) Date: Sat, 10 Dec 2011 21:55:31 +0100 (CET) Subject: [MPlayer-cvslog] r34426 - in trunk: configure libvo/gl_common.c libvo/gl_common.h libvo/vo_gl.c Message-ID: <20111210205532.0B32112572D@avserver.banki.hu> Author: reimar Date: Sat Dec 10 21:55:31 2011 New Revision: 34426 Log: Add highly experimental support for OpenGL ES. It only supports EGL/X11, uses/supports only ES v1, will crash if certain features are used, compiling without desktop GL installed is not tested and possibly more caveats. However it is close enough to be able to display a video on a BeagleBoard via OpenGL. Performance could not be tested properly since I do not have a display that is compatible with the BeagleBoard output... Modified: trunk/configure trunk/libvo/gl_common.c trunk/libvo/gl_common.h trunk/libvo/vo_gl.c Modified: trunk/configure ============================================================================== --- trunk/configure Sat Dec 10 21:21:50 2011 (r34425) +++ trunk/configure Sat Dec 10 21:55:31 2011 (r34426) @@ -5064,6 +5064,10 @@ if (test "$_x11" = yes || test "$_sdl" = // we allow SDL hacking our main() only on OSX #undef main #endif +#elif defined(GL_EGL_X11) +#include +#include +#include #else #include #include @@ -5075,10 +5079,15 @@ int main(int argc, char *argv[]) { wglCreateContext(dc); #elif defined(GL_SDL) SDL_GL_SwapBuffers(); +#elif defined(GL_EGL_X11) + EGLDisplay eglDisplay = EGL_NO_DISPLAY; + eglInitialize(eglDisplay, NULL, NULL); #else glXCreateContext(NULL, NULL, NULL, True); #endif +#ifndef GL_EGL_X11 glFinish(); +#endif return 0; } EOF @@ -5091,6 +5100,11 @@ EOF break fi done + if cc_check -DGL_EGL_X11 -lEGL ; then + _gl=yes + _gl_egl_x11=yes + libs_mplayer="$libs_mplayer -lEGL $ld_dl" + fi if cc_check -DGL_WIN32 -lopengl32 ; then _gl=yes _gl_win32=yes @@ -5123,6 +5137,10 @@ if test "$_gl" = yes ; then def_gl_x11='#define CONFIG_GL_X11 1' res_comment="$res_comment x11" fi + if test "$_gl_egl_x11" = yes ; then + def_gl_egl_x11='#define CONFIG_GL_EGL_X11 1' + res_comment="$res_comment egl_x11" + fi if test "$_gl_sdl" = yes ; then def_gl_sdl='#define CONFIG_GL_SDL 1' res_comment="$res_comment sdl" @@ -5132,6 +5150,7 @@ else def_gl='#undef CONFIG_GL' def_gl_win32='#undef CONFIG_GL_WIN32' def_gl_x11='#undef CONFIG_GL_X11' + def_gl_egl_x11='#undef CONFIG_GL_EGL_X11' def_gl_sdl='#undef CONFIG_GL_SDL' novomodules="opengl $novomodules" fi @@ -8030,6 +8049,7 @@ GGI = $_ggi GL = $_gl GL_WIN32 = $_gl_win32 GL_X11 = $_gl_x11 +GL_EGL_X11 = $_gl_egl_x11 GL_SDL = $_gl_sdl MATRIXVIEW = $matrixview GUI = $_gui @@ -8569,6 +8589,7 @@ $def_gif_tvt_hack $def_gl $def_gl_win32 $def_gl_x11 +$def_gl_egl_x11 $def_gl_sdl $def_matrixview $def_ivtv Modified: trunk/libvo/gl_common.c ============================================================================== --- trunk/libvo/gl_common.c Sat Dec 10 21:21:50 2011 (r34425) +++ trunk/libvo/gl_common.c Sat Dec 10 21:55:31 2011 (r34426) @@ -139,6 +139,14 @@ void* (GLAPIENTRY *mpglAllocateMemoryMES void (GLAPIENTRY *mpglFreeMemoryMESA)(void *, int, void *); /** \} */ // end of glextfunctions group + +void (GLAPIENTRY *mpglVertexPointer)(GLint, GLenum, GLsizei, const GLvoid *); +void (GLAPIENTRY *mpglTexCoordPointer)(GLint, GLenum, GLsizei, const GLvoid *); +void (GLAPIENTRY *mpglClientActiveTexture)(GLenum); +void (GLAPIENTRY *mpglEnableClientState)(GLenum); +void (GLAPIENTRY *mpglDisableClientState)(GLenum); +void (GLAPIENTRY *mpglDrawArrays)(GLenum, GLint, GLsizei); + //! \defgroup glgeneral OpenGL general helper functions //! \defgroup glcontext OpenGL context management helper functions @@ -384,7 +392,11 @@ typedef struct { void *fallback; } extfunc_desc_t; +#if !defined(CONFIG_GL_WIN32) && !defined(CONFIG_GL_X11) +#define DEF_FUNC_DESC(name) {&mpgl##name, NULL, {"gl"#name, NULL}, NULL} +#else #define DEF_FUNC_DESC(name) {&mpgl##name, NULL, {"gl"#name, NULL}, gl ##name} +#endif static const extfunc_desc_t extfuncs[] = { // these aren't extension functions but we query them anyway to allow // different "backends" with one binary @@ -466,6 +478,14 @@ static const extfunc_desc_t extfuncs[] = {&mpglTexImage3D, NULL, {"glTexImage3D", NULL}}, {&mpglAllocateMemoryMESA, "GLX_MESA_allocate_memory", {"glXAllocateMemoryMESA", NULL}}, {&mpglFreeMemoryMESA, "GLX_MESA_allocate_memory", {"glXFreeMemoryMESA", NULL}}, + + // Things needed to run on GLES + {&mpglVertexPointer, NULL, {"glVertexPointer", NULL}}, + {&mpglTexCoordPointer, NULL, {"glTexCoordPointer", NULL}}, + {&mpglClientActiveTexture, NULL, {"glClientActiveTexture", NULL}}, + {&mpglEnableClientState, NULL, {"glEnableClientState", NULL}}, + {&mpglDisableClientState, NULL, {"glDisableClientState", NULL}}, + {&mpglDrawArrays, NULL, {"glDrawArrays", NULL}}, {NULL} }; @@ -1685,6 +1705,36 @@ void glDrawTex(GLfloat x, GLfloat y, GLf y += h; h = -h; } + + if (!mpglBegin) { + GLfloat vertices [8] = { x, y, x, y + h, x + w, y, x + w, y + h}; + GLfloat texcoords [8] = {tx, ty, tx, ty + th, tx + tw, ty, tx + tw, ty + th}; + GLfloat texcoords2[8] = {tx2, ty2, tx2, ty2 + th2, tx2 + tw2, ty2, tx2 + tw2, ty2 + th2}; + mpglEnableClientState(GL_VERTEX_ARRAY); + mpglVertexPointer(2, GL_FLOAT, 0, vertices); + mpglEnableClientState(GL_TEXTURE_COORD_ARRAY); + mpglTexCoordPointer(2, GL_FLOAT, 0, texcoords); + if (is_yv12) { + mpglClientActiveTexture(GL_TEXTURE1); + mpglEnableClientState(GL_TEXTURE_COORD_ARRAY); + mpglTexCoordPointer(2, GL_FLOAT, 0, texcoords2); + mpglClientActiveTexture(GL_TEXTURE2); + mpglEnableClientState(GL_TEXTURE_COORD_ARRAY); + mpglTexCoordPointer(2, GL_FLOAT, 0, texcoords2); + mpglClientActiveTexture(GL_TEXTURE0); + } + mpglDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + if (is_yv12) { + mpglClientActiveTexture(GL_TEXTURE1); + mpglDisableClientState(GL_TEXTURE_COORD_ARRAY); + mpglClientActiveTexture(GL_TEXTURE2); + mpglDisableClientState(GL_TEXTURE_COORD_ARRAY); + mpglClientActiveTexture(GL_TEXTURE0); + } + mpglDisableClientState(GL_VERTEX_ARRAY); + return; + } + mpglBegin(GL_QUADS); mpglTexCoord2f(tx, ty); if (is_yv12) { @@ -1957,7 +2007,9 @@ static void releaseGlContext_x11(MPGLCon static void swapGlBuffers_x11(MPGLContext *ctx) { glXSwapBuffers(mDisplay, vo_window); } +#endif +#if defined(CONFIG_GL_X11) || defined(CONFIG_GL_EGL_X11) static int x11_check_events(void) { return vo_x11_check_events(mDisplay); } @@ -1997,6 +2049,99 @@ static int sdl_check_events(void) { #endif +#ifdef CONFIG_GL_EGL_X11 +static EGLDisplay eglDisplay = EGL_NO_DISPLAY; +static EGLSurface eglSurface = EGL_NO_SURFACE; + +/* + * Some genius thought it a good idea to make + * eglGetProcAddress not work for core functions. + * So we have to use a non-portable way that in addition + * might also return symbols from a different library + * that the one providing the current context, great job! + */ +static void *eglgpa(const GLubyte *name) { + void *res = eglGetProcAddress(name); + if (!res) { + void *h = dlopen("/usr/lib/libGLESv1_CM.so", RTLD_LAZY); + res = dlsym(h, name); + dlclose(h); + } + return res; +} + +static int setGlWindow_egl(MPGLContext *ctx) +{ + static const EGLint cfg_attribs[] = { EGL_NONE }; + static const EGLint ctx_attribs[] = { EGL_NONE }; + EGLContext *context = &ctx->context.egl; + Window win = vo_window; + EGLContext new_context = NULL; + EGLConfig eglConfig; + int num_configs; + if (eglDisplay == EGL_NO_DISPLAY) { + eglDisplay = eglGetDisplay(mDisplay); + if (eglDisplay == EGL_NO_DISPLAY) { + mp_msg(MSGT_VO, MSGL_FATAL, "eglGetDisplay failed: 0x%x\n", eglGetError()); + return SET_WINDOW_FAILED; + } + if (!eglInitialize(eglDisplay, NULL, NULL)) { + mp_msg(MSGT_VO, MSGL_FATAL, "eglInitialize failed: 0x%x\n", eglGetError()); + return SET_WINDOW_FAILED; + } + } + if (*context != EGL_NO_CONTEXT) { + eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglDestroyContext(eglDisplay, *context); + eglDestroySurface(eglDisplay, eglSurface); + } + if (!eglChooseConfig(eglDisplay, cfg_attribs, &eglConfig, 1, &num_configs) || + num_configs != 1) + return SET_WINDOW_FAILED; + eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, win, NULL); + if (eglSurface == EGL_NO_SURFACE) + return SET_WINDOW_FAILED; + + new_context = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, ctx_attribs); + if (new_context == EGL_NO_CONTEXT) + return SET_WINDOW_FAILED; + if (!eglMakeCurrent(eglDisplay, eglSurface, eglSurface, new_context)) + return SET_WINDOW_FAILED; + + // set new values + vo_window = win; + vo_x11_update_geometry(); + *context = new_context; + + getFunctions(eglgpa, eglQueryString(eglDisplay, EGL_EXTENSIONS)); + mpglBegin = NULL; + mpglDrawBuffer = NULL; + + // and inform that reinit is necessary + return SET_WINDOW_REINIT; +} + +/** + * \brief free the VisualInfo and GLXContext of an OpenGL context. + * \ingroup glcontext + */ +static void releaseGlContext_egl(MPGLContext *ctx) { + EGLContext *context = &ctx->context.egl; + if (*context != EGL_NO_CONTEXT) + { + mpglFinish(); + eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglDestroyContext(eglDisplay, *context); + } + *context = EGL_NO_CONTEXT; +} + +static void swapGlBuffers_egl(MPGLContext *ctx) { + eglSwapBuffers(eglDisplay, eglSurface); +} + +#endif + static int setGlWindow_dummy(MPGLContext *ctx) { getFunctions(NULL, NULL); return SET_WINDOW_OK; @@ -2026,6 +2171,8 @@ int init_mpglcontext(MPGLContext *ctx, e res = init_mpglcontext(ctx, GLTYPE_X11); if (res) return res; res = init_mpglcontext(ctx, GLTYPE_SDL); + if (res) return res; + res = init_mpglcontext(ctx, GLTYPE_EGL_X11); return res; } memset(ctx, 0, sizeof(*ctx)); @@ -2068,6 +2215,18 @@ int init_mpglcontext(MPGLContext *ctx, e ctx->fullscreen = vo_sdl_fullscreen; return vo_sdl_init(); #endif +#ifdef CONFIG_GL_EGL_X11 + case GLTYPE_EGL_X11: + ctx->setGlWindow = setGlWindow_egl; + ctx->releaseGlContext = releaseGlContext_egl; + ctx->swapGlBuffers = swapGlBuffers_egl; + ctx->update_xinerama_info = update_xinerama_info; + ctx->border = vo_x11_border; + ctx->check_events = x11_check_events; + ctx->fullscreen = vo_x11_fullscreen; + ctx->ontop = vo_x11_ontop; + return vo_init(); +#endif default: return 0; } Modified: trunk/libvo/gl_common.h ============================================================================== --- trunk/libvo/gl_common.h Sat Dec 10 21:21:50 2011 (r34425) +++ trunk/libvo/gl_common.h Sat Dec 10 21:55:31 2011 (r34426) @@ -40,6 +40,10 @@ #include #include "x11_common.h" #endif +#ifdef CONFIG_GL_EGL_X11 +#include +#include "x11_common.h" +#endif #include // workaround for some gl.h headers @@ -405,6 +409,7 @@ enum MPGLType { GLTYPE_W32, GLTYPE_X11, GLTYPE_SDL, + GLTYPE_EGL_X11, }; typedef struct MPGLContext { @@ -422,6 +427,9 @@ typedef struct MPGLContext { #ifdef CONFIG_GL_X11 GLXContext x11; #endif +#ifdef CONFIG_GL_EGL_X11 + EGLContext egl; +#endif } context; int (*setGlWindow)(struct MPGLContext *); void (*releaseGlContext)(struct MPGLContext *); Modified: trunk/libvo/vo_gl.c ============================================================================== --- trunk/libvo/vo_gl.c Sat Dec 10 21:21:50 2011 (r34425) +++ trunk/libvo/vo_gl.c Sat Dec 10 21:55:31 2011 (r34426) @@ -547,7 +547,8 @@ static int initGl(uint32_t d_width, uint mpglDepthMask(GL_FALSE); mpglDisable(GL_CULL_FACE); mpglEnable(gl_target); - mpglDrawBuffer(vo_doublebuffering?GL_BACK:GL_FRONT); + if (mpglDrawBuffer) + mpglDrawBuffer(vo_doublebuffering?GL_BACK:GL_FRONT); mpglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); mp_msg(MSGT_VO, MSGL_V, "[gl] Creating %dx%d texture...\n", @@ -618,6 +619,13 @@ static int create_window(uint32_t d_widt if (glctx.type == GLTYPE_W32 && !vo_w32_config(d_width, d_height, flags)) return -1; #endif +#ifdef CONFIG_GL_EGL_X11 + if (glctx.type == GLTYPE_EGL_X11) { + XVisualInfo vinfo = { .visual = CopyFromParent, .depth = CopyFromParent }; + vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, d_width, d_height, flags, + CopyFromParent, "gl", title); + } +#endif #ifdef CONFIG_GL_X11 if (glctx.type == GLTYPE_X11) { static int default_glx_attribs[] = { From subversion at mplayerhq.hu Sun Dec 11 15:43:17 2011 From: subversion at mplayerhq.hu (ib) Date: Sun, 11 Dec 2011 15:43:17 +0100 (CET) Subject: [MPlayer-cvslog] r34427 - in trunk: Changelog DOCS/tech/slave.txt command.c gui/app.c gui/app.h gui/interface.c gui/interface.h gui/win32/interface.c input/input.c input/input.h mplayer.c Message-ID: <20111211144317.A892A1269A0@avserver.banki.hu> Author: ib Date: Sun Dec 11 15:43:16 2011 New Revision: 34427 Log: Enable gui slave commands. Allow sending the GUI skin messages which enables operating the GUI with a remote control. Only messages defined in current skin window will be executed, i.e. only messages that could result from mouse clicks as well. Modified: trunk/Changelog trunk/DOCS/tech/slave.txt trunk/command.c trunk/gui/app.c trunk/gui/app.h trunk/gui/interface.c trunk/gui/interface.h trunk/gui/win32/interface.c trunk/input/input.c trunk/input/input.h trunk/mplayer.c Modified: trunk/Changelog ============================================================================== --- trunk/Changelog Sat Dec 10 21:55:31 2011 (r34426) +++ trunk/Changelog Sun Dec 11 15:43:16 2011 (r34427) @@ -20,6 +20,9 @@ MPlayer (1.0) * experimental af_cmdline slave command to change e.g. audio equalizer options at runtime. * vo x11: don't hide or show cursor any more if attached to an existing window (-wid) + GUI: + * all skin messages available as slave commands (gui ) + Ports: * Wine (see DOCS/tech/crosscompile.txt) Modified: trunk/DOCS/tech/slave.txt ============================================================================== --- trunk/DOCS/tech/slave.txt Sat Dec 10 21:55:31 2011 (r34426) +++ trunk/DOCS/tech/slave.txt Sun Dec 11 15:43:16 2011 (r34427) @@ -181,6 +181,10 @@ get_video_codec get_video_resolution Print out the video resolution of the current file. +gui + Send GUI skin message . (See the skin documentation on GUI + messages for details.) + screenshot Take a screenshot. Requires the screenshot filter to be loaded. 0 Take a single screenshot. Modified: trunk/command.c ============================================================================== --- trunk/command.c Sat Dec 10 21:55:31 2011 (r34426) +++ trunk/command.c Sun Dec 11 15:43:16 2011 (r34427) @@ -3511,6 +3511,11 @@ int run_command(MPContext *mpctx, mp_cmd break; default: +#ifdef CONFIG_GUI + if (use_gui && cmd->id == MP_CMD_GUI) + gui(GUI_RUN_MESSAGE, cmd->args[0].v.s); + else +#endif mp_msg(MSGT_CPLAYER, MSGL_V, "Received unknown cmd %s\n", cmd->name); } Modified: trunk/gui/app.c ============================================================================== --- trunk/gui/app.c Sat Dec 10 21:55:31 2011 (r34426) +++ trunk/gui/app.c Sun Dec 11 15:43:16 2011 (r34427) @@ -148,6 +148,33 @@ int appFindMessage(const char *name) } /** + * @brief Find the item belonging to an event. + * + * @param event event + * + * @return pointer to the item (ok) or NULL (not found) + */ +wItem *appFindItem(int event) +{ + wItem *item; + int i, n; + + if (guiApp.subWindow.isFullScreen && guiApp.playbarIsPresent) { + item = guiApp.playbarItems; + n = guiApp.IndexOfPlaybarItems; + } else { + item = guiApp.mainItems; + n = guiApp.IndexOfMainItems; + } + + for (i = 0; i <= n; i++) + if (item[i].message == event) + return item; + + return NULL; +} + +/** * @brief Modify the state (i.e. set a new value) to the item belonging to an event. * * @param event event Modified: trunk/gui/app.h ============================================================================== --- trunk/gui/app.h Sat Dec 10 21:55:31 2011 (r34426) +++ trunk/gui/app.h Sun Dec 11 15:43:16 2011 (r34427) @@ -175,6 +175,7 @@ typedef struct { extern guiItems guiApp; +wItem *appFindItem(int event); int appFindMessage(const char *name); void appFreeStruct(void); void btnModify(int event, float state); Modified: trunk/gui/interface.c ============================================================================== --- trunk/gui/interface.c Sat Dec 10 21:55:31 2011 (r34426) +++ trunk/gui/interface.c Sun Dec 11 15:43:16 2011 (r34427) @@ -323,7 +323,7 @@ int gui(int what, void *data) dvd_priv_t *dvd; #endif plItem *next; - int state; + int msg, state; if (guiInfo.mpcontext) mixer = mpctx_get_mixer(guiInfo.mpcontext); @@ -382,6 +382,13 @@ int gui(int what, void *data) break; + case GUI_RUN_MESSAGE: + mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] GUI_RUN_MESSAGE: %s\n", (const char *)data); + msg = appFindMessage((const char *)data); + if (appFindItem(msg)) + uiEventHandling(msg, 0); + break; + case GUI_PREPARE: wsVisibleMouse(&guiApp.subWindow, wsHideMouseCursor); Modified: trunk/gui/interface.h ============================================================================== --- trunk/gui/interface.h Sat Dec 10 21:55:31 2011 (r34426) +++ trunk/gui/interface.h Sun Dec 11 15:43:16 2011 (r34427) @@ -45,6 +45,7 @@ enum { GUI_PREPARE, GUI_REDRAW, GUI_RUN_COMMAND, + GUI_RUN_MESSAGE, GUI_SETUP_VIDEO_WINDOW, GUI_SET_AFILTER, GUI_SET_AUDIO, Modified: trunk/gui/win32/interface.c ============================================================================== --- trunk/gui/win32/interface.c Sat Dec 10 21:55:31 2011 (r34426) +++ trunk/gui/win32/interface.c Sun Dec 11 15:43:16 2011 (r34427) @@ -657,6 +657,8 @@ int gui(int what, void *data) } break; } + case GUI_RUN_MESSAGE: + break; case GUI_HANDLE_EVENTS: break; case GUI_SET_MIXER: Modified: trunk/input/input.c ============================================================================== --- trunk/input/input.c Sat Dec 10 21:55:31 2011 (r34426) +++ trunk/input/input.c Sun Dec 11 15:43:16 2011 (r34427) @@ -208,6 +208,8 @@ static const mp_cmd_t mp_cmds[] = { { MP_CMD_AF_CLR, "af_clr", 0, { {-1,{0}} } }, { MP_CMD_AF_CMDLINE, "af_cmdline", 2, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } }, + { MP_CMD_GUI, "gui", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } }, + { 0, NULL, 0, {} } }; Modified: trunk/input/input.h ============================================================================== --- trunk/input/input.h Sat Dec 10 21:55:31 2011 (r34426) +++ trunk/input/input.h Sun Dec 11 15:43:16 2011 (r34427) @@ -162,6 +162,9 @@ typedef enum { MP_CMD_AF_CLR, MP_CMD_AF_CMDLINE, + /// GUI command + MP_CMD_GUI, + } mp_command_type; // The arg types Modified: trunk/mplayer.c ============================================================================== --- trunk/mplayer.c Sat Dec 10 21:55:31 2011 (r34426) +++ trunk/mplayer.c Sun Dec 11 15:43:16 2011 (r34427) @@ -3058,6 +3058,9 @@ play_next_file: gui(GUI_HANDLE_EVENTS, 0); gui(GUI_REDRAW, 0); if ((cmd = mp_input_get_cmd(0, 0, 0)) != NULL) { + if (cmd->id == MP_CMD_GUI) + gui(GUI_RUN_MESSAGE, cmd->args[0].v.s); + else gui(GUI_RUN_COMMAND, (void *)cmd->id); mp_cmd_free(cmd); } From subversion at mplayerhq.hu Sun Dec 11 15:44:36 2011 From: subversion at mplayerhq.hu (ib) Date: Sun, 11 Dec 2011 15:44:36 +0100 (CET) Subject: [MPlayer-cvslog] r34428 - trunk/mplayer.c Message-ID: <20111211144436.EA82B122803@avserver.banki.hu> Author: ib Date: Sun Dec 11 15:44:36 2011 New Revision: 34428 Log: Cosmetic: Adjust indent. Modified: trunk/mplayer.c Modified: trunk/mplayer.c ============================================================================== --- trunk/mplayer.c Sun Dec 11 15:43:16 2011 (r34427) +++ trunk/mplayer.c Sun Dec 11 15:44:36 2011 (r34428) @@ -3061,7 +3061,7 @@ play_next_file: if (cmd->id == MP_CMD_GUI) gui(GUI_RUN_MESSAGE, cmd->args[0].v.s); else - gui(GUI_RUN_COMMAND, (void *)cmd->id); + gui(GUI_RUN_COMMAND, (void *)cmd->id); mp_cmd_free(cmd); } } From subversion at mplayerhq.hu Sun Dec 11 15:54:56 2011 From: subversion at mplayerhq.hu (ib) Date: Sun, 11 Dec 2011 15:54:56 +0100 (CET) Subject: [MPlayer-cvslog] r34429 - trunk/cfg-mplayer.h Message-ID: <20111211145456.61EF912652A@avserver.banki.hu> Author: ib Date: Sun Dec 11 15:54:56 2011 New Revision: 34429 Log: Don't allow option gui-include in config files. This option may only be evaluated after MPlayer has called cfg_read() or a segmentation fault occurs. Prevent this by restricting its usage. Modified: trunk/cfg-mplayer.h Modified: trunk/cfg-mplayer.h ============================================================================== --- trunk/cfg-mplayer.h Sun Dec 11 15:44:36 2011 (r34428) +++ trunk/cfg-mplayer.h Sun Dec 11 15:54:56 2011 (r34429) @@ -301,7 +301,7 @@ const m_option_t mplayer_opts[]={ {"noenqueue", &enqueue, CONF_TYPE_FLAG, 0, 1, 0, NULL}, {"guiwid", "-guiwid has been removed, use -gui-wid instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, {"gui-wid", &guiWinID, CONF_TYPE_INT, 0, 0, 0, NULL}, - {"gui-include", cfg_gui_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, NULL}, + {"gui-include", cfg_gui_include, CONF_TYPE_FUNC_PARAM, CONF_NOCFG|CONF_NOSAVE, 0, 0, NULL}, #endif {"noloop", &mpctx_s.loop_times, CONF_TYPE_FLAG, 0, 0, -1, NULL}, From subversion at mplayerhq.hu Sun Dec 11 16:13:39 2011 From: subversion at mplayerhq.hu (reimar) Date: Sun, 11 Dec 2011 16:13:39 +0100 (CET) Subject: [MPlayer-cvslog] r34430 - in trunk: configure libass/ass_shaper.c libass/ass_shaper.h Message-ID: <20111211151339.B75C51268EF@avserver.banki.hu> Author: reimar Date: Sun Dec 11 16:13:39 2011 New Revision: 34430 Log: Allow compiling libass without fribidi again. Modified: trunk/configure trunk/libass/ass_shaper.c trunk/libass/ass_shaper.h Modified: trunk/configure ============================================================================== --- trunk/configure Sun Dec 11 15:54:56 2011 (r34429) +++ trunk/configure Sun Dec 11 16:13:39 2011 (r34430) @@ -5963,8 +5963,8 @@ echores "$_fribidi" echocheck "SSA/ASS support" -# libass depends on FreeType and FriBiDi -if test "$_freetype" = no || test "$_fribidi" = no ; then +# libass depends on FreeType +if test "$_freetype" = no ; then _ass=no ass_internal=no res_comment="FreeType and FriBiDi support needed" Modified: trunk/libass/ass_shaper.c ============================================================================== --- trunk/libass/ass_shaper.c Sun Dec 11 15:54:56 2011 (r34429) +++ trunk/libass/ass_shaper.c Sun Dec 11 16:13:39 2011 (r34430) @@ -18,7 +18,9 @@ #include "config.h" +#ifdef CONFIG_FRIBIDI #include +#endif #include "ass_shaper.h" #include "ass_render.h" @@ -43,9 +45,11 @@ struct ass_shaper { // FriBidi log2vis int n_glyphs; +#ifdef CONFIG_FRIBIDI FriBidiChar *event_text; FriBidiCharType *ctypes; FriBidiLevel *emblevels; +#endif FriBidiStrIndex *cmap; FriBidiParType base_direction; @@ -79,8 +83,10 @@ struct ass_shaper_font_data { */ void ass_shaper_info(ASS_Library *lib) { - ass_msg(lib, MSGL_V, "Shaper: FriBidi " - FRIBIDI_VERSION " (SIMPLE)" + ass_msg(lib, MSGL_V, "Shaper:" +#ifdef CONFIG_FRIBIDI + " FriBidi " FRIBIDI_VERSION " (SIMPLE)" +#endif #ifdef CONFIG_HARFBUZZ " HarfBuzz-ng %s (COMPLEX)", hb_version_string() #endif @@ -94,9 +100,11 @@ void ass_shaper_info(ASS_Library *lib) static void check_allocations(ASS_Shaper *shaper, size_t new_size) { if (new_size > shaper->n_glyphs) { +#ifdef CONFIG_FRIBIDI shaper->event_text = realloc(shaper->event_text, sizeof(FriBidiChar) * new_size); shaper->ctypes = realloc(shaper->ctypes, sizeof(FriBidiCharType) * new_size); shaper->emblevels = realloc(shaper->emblevels, sizeof(FriBidiLevel) * new_size); +#endif shaper->cmap = realloc(shaper->cmap, sizeof(FriBidiStrIndex) * new_size); } } @@ -110,9 +118,11 @@ void ass_shaper_free(ASS_Shaper *shaper) ass_cache_done(shaper->metrics_cache); free(shaper->features); #endif +#ifdef CONFIG_FRIBIDI free(shaper->event_text); free(shaper->ctypes); free(shaper->emblevels); +#endif free(shaper->cmap); free(shaper); } @@ -493,6 +503,7 @@ static void shape_harfbuzz(ASS_Shaper *s } #endif +#ifdef CONFIG_FRIBIDI /** * \brief Shape event text with FriBidi. Does mirroring and simple * Arabic shaping. @@ -519,6 +530,7 @@ static void shape_fribidi(ASS_Shaper *sh free(joins); } +#endif /** * \brief Toggle kerning for HarfBuzz shaping. @@ -595,6 +607,9 @@ void ass_shaper_set_level(ASS_Shaper *sh */ void ass_shaper_shape(ASS_Shaper *shaper, TextInfo *text_info) { +#ifndef CONFIG_FRIBIDI + check_allocations(shaper, text_info->length); +#else int i, last_break; FriBidiParType dir; GlyphInfo *glyphs = text_info->glyphs; @@ -645,6 +660,7 @@ void ass_shaper_shape(ASS_Shaper *shaper glyphs[i].skip++; } } +#endif } /** @@ -655,7 +671,9 @@ ASS_Shaper *ass_shaper_new(size_t preall { ASS_Shaper *shaper = calloc(sizeof(*shaper), 1); +#ifdef CONFIG_FRIBIDI shaper->base_direction = FRIBIDI_PAR_ON; +#endif check_allocations(shaper, prealloc); #ifdef CONFIG_HARFBUZZ @@ -697,6 +715,7 @@ FriBidiStrIndex *ass_shaper_reorder(ASS_ for (i = 0; i < text_info->length; i++) shaper->cmap[i] = i; +#ifdef CONFIG_FRIBIDI // Create reorder map line-by-line for (i = 0; i < text_info->n_lines; i++) { LineInfo *line = text_info->lines + i; @@ -708,6 +727,7 @@ FriBidiStrIndex *ass_shaper_reorder(ASS_ shaper->emblevels + line->offset, NULL, shaper->cmap + line->offset); } +#endif return shaper->cmap; } @@ -721,6 +741,7 @@ FriBidiStrIndex *ass_shaper_reorder(ASS_ */ FriBidiParType resolve_base_direction(int enc) { +#ifdef CONFIG_FRIBIDI switch (enc) { case 1: return FRIBIDI_PAR_ON; @@ -730,4 +751,7 @@ FriBidiParType resolve_base_direction(in default: return FRIBIDI_PAR_LTR; } +#else + return 0; +#endif } Modified: trunk/libass/ass_shaper.h ============================================================================== --- trunk/libass/ass_shaper.h Sun Dec 11 15:54:56 2011 (r34429) +++ trunk/libass/ass_shaper.h Sun Dec 11 16:13:39 2011 (r34430) @@ -21,7 +21,12 @@ #include "config.h" +#ifdef CONFIG_FRIBIDI #include +#else +typedef int FriBidiParType; +typedef int FriBidiStrIndex; +#endif #include "ass_render.h" void ass_shaper_info(ASS_Library *lib); From Reimar.Doeffinger at gmx.de Sun Dec 11 16:18:20 2011 From: Reimar.Doeffinger at gmx.de (Reimar =?iso-8859-1?Q?D=F6ffinger?=) Date: Sun, 11 Dec 2011 16:18:20 +0100 Subject: [MPlayer-cvslog] r34257 - in trunk: cfg-common.h cfg-mplayer.h m_option.c m_option.h In-Reply-To: <4ede5d76.4218c28d.bm000@wupperonline.de> References: <20111027222433.GC18730@1und1.de> <4ede5d76.4218c28d.bm000@wupperonline.de> Message-ID: <20111211151820.GB11176@1und1.de> On Tue, Dec 06, 2011 at 06:52:14PM +0100, Ingo Br?ckl wrote: > This actually segfaults for the very same reason (MPlayer didn't have called > cfg_read() before). I suggest the attached patch. > > Ingo > Index: cfg-mplayer.h > =================================================================== > --- cfg-mplayer.h (revision 34368) > +++ cfg-mplayer.h (working copy) > @@ -301,7 +301,7 @@ > {"noenqueue", &enqueue, CONF_TYPE_FLAG, 0, 1, 0, NULL}, > {"guiwid", "-guiwid has been removed, use -gui-wid instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, > {"gui-wid", &guiWinID, CONF_TYPE_INT, 0, 0, 0, NULL}, > - {"gui-include", cfg_gui_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, NULL}, > + {"gui-include", cfg_gui_include, CONF_TYPE_FUNC_PARAM, CONF_NOCFG|CONF_NOSAVE, 0, 0, NULL}, > #endif > > {"noloop", &mpctx_s.loop_times, CONF_TYPE_FLAG, 0, 0, -1, NULL}, Sorry for not replying. Yes, applying this is obviously a good idea. Of course it wouldn't hurt to make it work nicely (also e.g. allowing to use it in the main config file to specify settings that should only be used when then gui is enabled), but that might be overkill... From ib at wupperonline.de Sun Dec 11 16:30:00 2011 From: ib at wupperonline.de (=?ISO-8859-1?Q?Ingo=20Br=FCckl?=) Date: Sun, 11 Dec 2011 16:30:00 +0100 Subject: [MPlayer-cvslog] r34257 - in trunk: cfg-common.h cfg-mplayer.h m_option.c m_option.h In-Reply-To: <20111211151820.GB11176@1und1.de> Message-ID: <4ee4cc7a.4d45f839.bm000@wupperonline.de> Reimar D?ffinger wrote on Sun, 11 Dec 2011 16:18:20 +0100: > On Tue, Dec 06, 2011 at 06:52:14PM +0100, Ingo Br?ckl wrote: >> This actually segfaults for the very same reason (MPlayer didn't have called >> cfg_read() before). I suggest the attached patch. >> >> Ingo >> Index: cfg-mplayer.h >> =================================================================== >> --- cfg-mplayer.h (revision 34368) >> +++ cfg-mplayer.h (working copy) >> @@ -301,7 +301,7 @@ >> {"noenqueue", &enqueue, CONF_TYPE_FLAG, 0, 1, 0, NULL}, >> {"guiwid", "-guiwid has been removed, use -gui-wid instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, >> {"gui-wid", &guiWinID, CONF_TYPE_INT, 0, 0, 0, NULL}, >> - {"gui-include", cfg_gui_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, NULL}, >> + {"gui-include", cfg_gui_include, CONF_TYPE_FUNC_PARAM, CONF_NOCFG|CONF_NOSAVE, 0, 0, NULL}, >> #endif >> >> {"noloop", &mpctx_s.loop_times, CONF_TYPE_FLAG, 0, 0, -1, NULL}, > Sorry for not replying. Yes, applying this is obviously a good idea. > Of course it wouldn't hurt to make it work nicely (also e.g. allowing > to use it in the main config file to specify settings that should only > be used when then gui is enabled), but that might be overkill... I'll keep that in mind. Forcing CONF_NOCFG doesn't have to be the final solution. Ingo From subversion at mplayerhq.hu Sun Dec 11 16:41:37 2011 From: subversion at mplayerhq.hu (reimar) Date: Sun, 11 Dec 2011 16:41:37 +0100 (CET) Subject: [MPlayer-cvslog] r34431 - trunk/stream/http.c Message-ID: <20111211154137.6758F126A2D@avserver.banki.hu> Author: reimar Date: Sun Dec 11 16:41:37 2011 New Revision: 34431 Log: Add a test file for ultravox in comment. Modified: trunk/stream/http.c Modified: trunk/stream/http.c ============================================================================== --- trunk/stream/http.c Sun Dec 11 16:13:39 2011 (r34430) +++ trunk/stream/http.c Sun Dec 11 16:41:37 2011 (r34431) @@ -80,6 +80,9 @@ static unsigned my_read(int fd, char *bu * \param fd file descriptor to read from * \param sc streaming_ctrl_t whose buffer is consumed before reading from fd * \return number of real data before next metadata block starts or 0 on error + * + * You can use unsv://samples.mplayerhq.hu/V-codecs/VP5/vp5_artefacts.nsv to + * test. */ static unsigned uvox_meta_read(int fd, streaming_ctrl_t *sc) { unsigned metaint; From subversion at mplayerhq.hu Sun Dec 11 16:52:32 2011 From: subversion at mplayerhq.hu (ib) Date: Sun, 11 Dec 2011 16:52:32 +0100 (CET) Subject: [MPlayer-cvslog] r34432 - trunk/gui/ui/gtk/fileselect.c Message-ID: <20111211155232.AF6B61269CF@avserver.banki.hu> Author: ib Date: Sun Dec 11 16:52:32 2011 New Revision: 34432 Log: Add Return key events to file selector buttons. This helps when operating the GUI with a remote control (and doesn't harm if not). Modified: trunk/gui/ui/gtk/fileselect.c Modified: trunk/gui/ui/gtk/fileselect.c ============================================================================== --- trunk/gui/ui/gtk/fileselect.c Sun Dec 11 16:41:37 2011 (r34431) +++ trunk/gui/ui/gtk/fileselect.c Sun Dec 11 16:52:32 2011 (r34432) @@ -543,6 +543,12 @@ static gboolean on_FileSelect_key_releas GdkEventKey * event, gpointer user_data ) { + if ( GTK_WIDGET_TYPE( widget ) == GTK_TYPE_BUTTON ) + { + if (event->keyval == GDK_Return) gtk_button_released( GTK_BUTTON( widget ) ); + } + else + { switch ( event->keyval ) { case GDK_Escape: @@ -555,6 +561,7 @@ static gboolean on_FileSelect_key_releas gtk_button_released( GTK_BUTTON( fsUp ) ); break; } + } return FALSE; } @@ -711,8 +718,11 @@ GtkWidget * create_FileSelect( void ) gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsPathCombo_changed ),fsPathCombo ); gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsPathCombo_activate ),fsPathCombo ); gtk_signal_connect( GTK_OBJECT( fsUp ),"released",GTK_SIGNAL_FUNC( fs_Up_released ),fsFNameList ); + gtk_signal_connect( GTK_OBJECT( fsUp ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL ); gtk_signal_connect( GTK_OBJECT( fsOk ),"released",GTK_SIGNAL_FUNC( fs_Ok_released ),fsCombo4 ); + gtk_signal_connect( GTK_OBJECT( fsOk ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL ); gtk_signal_connect( GTK_OBJECT( fsCancel ),"released",GTK_SIGNAL_FUNC( fs_Cancel_released ),NULL ); + gtk_signal_connect( GTK_OBJECT( fsCancel ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL ); gtk_signal_connect( GTK_OBJECT( fsFNameList ),"select_row",(GtkSignalFunc)fs_fsFNameList_select_row,NULL ); gtk_signal_connect( GTK_OBJECT( fsFNameList ),"event", (GtkSignalFunc)fs_fsFNameList_event,NULL ); From subversion at mplayerhq.hu Sun Dec 11 16:53:38 2011 From: subversion at mplayerhq.hu (ib) Date: Sun, 11 Dec 2011 16:53:38 +0100 (CET) Subject: [MPlayer-cvslog] r34433 - trunk/gui/ui/gtk/fileselect.c Message-ID: <20111211155338.31D82126780@avserver.banki.hu> Author: ib Date: Sun Dec 11 16:53:37 2011 New Revision: 34433 Log: Cosmetic: Adjust indent. Modified: trunk/gui/ui/gtk/fileselect.c Modified: trunk/gui/ui/gtk/fileselect.c ============================================================================== --- trunk/gui/ui/gtk/fileselect.c Sun Dec 11 16:52:32 2011 (r34432) +++ trunk/gui/ui/gtk/fileselect.c Sun Dec 11 16:53:37 2011 (r34433) @@ -549,18 +549,18 @@ static gboolean on_FileSelect_key_releas } else { - switch ( event->keyval ) - { - case GDK_Escape: - gtk_button_released( GTK_BUTTON( fsCancel ) ); - break; - case GDK_Return: - gtk_button_released( GTK_BUTTON( fsOk ) ); - break; - case GDK_BackSpace: - gtk_button_released( GTK_BUTTON( fsUp ) ); - break; - } + switch ( event->keyval ) + { + case GDK_Escape: + gtk_button_released( GTK_BUTTON( fsCancel ) ); + break; + case GDK_Return: + gtk_button_released( GTK_BUTTON( fsOk ) ); + break; + case GDK_BackSpace: + gtk_button_released( GTK_BUTTON( fsUp ) ); + break; + } } return FALSE; } From subversion at mplayerhq.hu Sun Dec 11 17:02:02 2011 From: subversion at mplayerhq.hu (ib) Date: Sun, 11 Dec 2011 17:02:02 +0100 (CET) Subject: [MPlayer-cvslog] r34434 - trunk/gui/ui/gtk/fileselect.c Message-ID: <20111211160202.C70E1126956@avserver.banki.hu> Author: ib Date: Sun Dec 11 17:02:02 2011 New Revision: 34434 Log: Fix bug with wrong focus in file selector. The focus can only be set to fsFNameList after it's realized and mapped. This also removes the irritating selection of the fsPathCombo. Modified: trunk/gui/ui/gtk/fileselect.c Modified: trunk/gui/ui/gtk/fileselect.c ============================================================================== --- trunk/gui/ui/gtk/fileselect.c Sun Dec 11 16:53:37 2011 (r34433) +++ trunk/gui/ui/gtk/fileselect.c Sun Dec 11 17:02:02 2011 (r34434) @@ -358,6 +358,8 @@ void ShowFileSelect( int type,int modal fsTopList_items=g_list_append( fsTopList_items,"/" ); gtk_combo_set_popdown_strings( GTK_COMBO( fsCombo4 ),fsTopList_items ); + gtk_widget_grab_focus( fsFNameList ); + gtk_window_set_modal( GTK_WINDOW( fsFileSelect ),modal ); gtk_widget_show( fsFileSelect ); @@ -726,7 +728,5 @@ GtkWidget * create_FileSelect( void ) gtk_signal_connect( GTK_OBJECT( fsFNameList ),"select_row",(GtkSignalFunc)fs_fsFNameList_select_row,NULL ); gtk_signal_connect( GTK_OBJECT( fsFNameList ),"event", (GtkSignalFunc)fs_fsFNameList_event,NULL ); - gtk_widget_grab_focus( fsFNameList ); - return fsFileSelect; } From diego at biurrun.de Sun Dec 11 17:33:11 2011 From: diego at biurrun.de (Diego Biurrun) Date: Sun, 11 Dec 2011 17:33:11 +0100 Subject: [MPlayer-cvslog] r34428 - trunk/mplayer.c In-Reply-To: <20111211144436.EA82B122803@avserver.banki.hu> References: <20111211144436.EA82B122803@avserver.banki.hu> Message-ID: <20111211163311.GA27678@pool.informatik.rwth-aachen.de> On Sun, Dec 11, 2011 at 03:44:36PM +0100, ib wrote: > > Log: > Cosmetic: Adjust indent. > > --- trunk/mplayer.c Sun Dec 11 15:43:16 2011 (r34427) > +++ trunk/mplayer.c Sun Dec 11 15:44:36 2011 (r34428) > @@ -3061,7 +3061,7 @@ play_next_file: > if (cmd->id == MP_CMD_GUI) > gui(GUI_RUN_MESSAGE, cmd->args[0].v.s); > else > - gui(GUI_RUN_COMMAND, (void *)cmd->id); > + gui(GUI_RUN_COMMAND, (void *)cmd->id); > mp_cmd_free(cmd); This is completely silly. Fold such things into the original commit. Diego From subversion at mplayerhq.hu Sun Dec 11 17:36:07 2011 From: subversion at mplayerhq.hu (ib) Date: Sun, 11 Dec 2011 17:36:07 +0100 (CET) Subject: [MPlayer-cvslog] r34435 - trunk/gui/ui/gtk/playlist.c Message-ID: <20111211163607.3A62412547B@avserver.banki.hu> Author: ib Date: Sun Dec 11 17:36:06 2011 New Revision: 34435 Log: Make column titles in playlist passive. This prevents them from being "selectable" and grabbing the focus which is irritating and pointless. Modified: trunk/gui/ui/gtk/playlist.c Modified: trunk/gui/ui/gtk/playlist.c ============================================================================== --- trunk/gui/ui/gtk/playlist.c Sun Dec 11 17:02:02 2011 (r34434) +++ trunk/gui/ui/gtk/playlist.c Sun Dec 11 17:36:06 2011 (r34435) @@ -494,6 +494,8 @@ GtkWidget * create_PlayList( void ) gtk_clist_set_column_widget( GTK_CLIST( CTDirTree ),0, AddLabel( MSGTR_PLAYLIST_DirectoryTree,NULL ) ); + gtk_clist_column_title_passive( GTK_CLIST( CTDirTree ),0 ); + vbox2=AddVBox( AddFrame( NULL,1,hbox1,1 ),0 ); @@ -513,6 +515,8 @@ GtkWidget * create_PlayList( void ) gtk_clist_set_column_widget( GTK_CLIST( CLFiles ),0, AddLabel( MSGTR_PLAYLIST_Files,NULL ) ); + gtk_clist_column_title_passive( GTK_CLIST( CLFiles ),0 ); + AddHSeparator( vbox2 ); scrolledwindow3=gtk_scrolled_window_new( NULL,NULL ); @@ -535,6 +539,8 @@ GtkWidget * create_PlayList( void ) gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),1, AddLabel( MSGTR_PLAYLIST_Path,NULL ) ); + gtk_clist_column_title_passive( GTK_CLIST( CLSelected ),0 ); + AddHSeparator( vbox1 ); hbuttonbox1=AddHButtonBox( vbox1 ); From subversion at mplayerhq.hu Sun Dec 11 18:12:55 2011 From: subversion at mplayerhq.hu (ib) Date: Sun, 11 Dec 2011 18:12:55 +0100 (CET) Subject: [MPlayer-cvslog] r34436 - trunk/gui/ui/gtk/playlist.c Message-ID: <20111211171255.A52B0125E27@avserver.banki.hu> Author: ib Date: Sun Dec 11 18:12:55 2011 New Revision: 34436 Log: Add Return key events to playlist buttons. This helps when operating the GUI with a remote control (and doesn't harm if not). Modified: trunk/gui/ui/gtk/playlist.c Modified: trunk/gui/ui/gtk/playlist.c ============================================================================== --- trunk/gui/ui/gtk/playlist.c Sun Dec 11 17:36:06 2011 (r34435) +++ trunk/gui/ui/gtk/playlist.c Sun Dec 11 18:12:55 2011 (r34436) @@ -275,6 +275,14 @@ static void plButtonReleased( GtkButton } } +static gboolean plKeyReleased( GtkWidget * widget, + GdkEventKey * event, + gpointer user_data ) +{ + if (event->keyval == GDK_Return) plButtonReleased( NULL, user_data ); + return FALSE; +} + static gboolean plEvent ( GtkWidget * widget, GdkEvent * event, gpointer user_data ) @@ -563,10 +571,14 @@ GtkWidget * create_PlayList( void ) sigUnsel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void*)1 ); sigEvent=gtk_signal_connect( GTK_OBJECT( CLSelected ),"event",GTK_SIGNAL_FUNC( plEvent ),(void *)1 ); - gtk_signal_connect( GTK_OBJECT( Add ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)3 ); - gtk_signal_connect( GTK_OBJECT( Remove ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)2 ); - gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)1 ); - gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)0 ); + gtk_signal_connect( GTK_OBJECT( Add ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)3 ); + gtk_signal_connect( GTK_OBJECT( Add ),"key_release_event",GTK_SIGNAL_FUNC( plKeyReleased ),(void*)3 ); + gtk_signal_connect( GTK_OBJECT( Remove ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)2 ); + gtk_signal_connect( GTK_OBJECT( Remove ),"key_release_event",GTK_SIGNAL_FUNC( plKeyReleased ),(void*)2 ); + gtk_signal_connect( GTK_OBJECT( Ok ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)1 ); + gtk_signal_connect( GTK_OBJECT( Ok ),"key_release_event",GTK_SIGNAL_FUNC( plKeyReleased ),(void*)1 ); + gtk_signal_connect( GTK_OBJECT( Cancel ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)0 ); + gtk_signal_connect( GTK_OBJECT( Cancel ),"key_release_event",GTK_SIGNAL_FUNC( plKeyReleased ),(void*)0 ); gtk_window_add_accel_group( GTK_WINDOW( PlayList ),accel_group ); From subversion at mplayerhq.hu Sun Dec 11 18:51:25 2011 From: subversion at mplayerhq.hu (ib) Date: Sun, 11 Dec 2011 18:51:25 +0100 (CET) Subject: [MPlayer-cvslog] r34437 - trunk/gui/ui/gtk/playlist.c Message-ID: <20111211175125.4865B126647@avserver.banki.hu> Author: ib Date: Sun Dec 11 18:51:24 2011 New Revision: 34437 Log: Add Return key events to playlist's file lists. This helps when operating the GUI with a remote control (and doesn't harm if not). Modified: trunk/gui/ui/gtk/playlist.c Modified: trunk/gui/ui/gtk/playlist.c ============================================================================== --- trunk/gui/ui/gtk/playlist.c Sun Dec 11 18:12:55 2011 (r34436) +++ trunk/gui/ui/gtk/playlist.c Sun Dec 11 18:51:24 2011 (r34437) @@ -279,7 +279,22 @@ static gboolean plKeyReleased( GtkWidget GdkEventKey * event, gpointer user_data ) { - if (event->keyval == GDK_Return) plButtonReleased( NULL, user_data ); + if (event->keyval == GDK_Return) + { + if ( GTK_WIDGET_TYPE( widget ) == GTK_TYPE_BUTTON ) plButtonReleased( NULL, user_data ); + else + { + switch ( (int) user_data ) + { + case 0: + plButtonReleased( NULL, (void *) 3 ); + break; + case 1: + plButtonReleased( NULL, (void *) 2 ); + break; + } + } + } return FALSE; } @@ -567,9 +582,11 @@ GtkWidget * create_PlayList( void ) gtk_signal_connect( GTK_OBJECT( CLFiles ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void *)0 ); gtk_signal_connect( GTK_OBJECT( CLFiles ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void *)0 ); gtk_signal_connect( GTK_OBJECT( CLFiles ),"event",GTK_SIGNAL_FUNC( plEvent ),(void *)0 ); + gtk_signal_connect( GTK_OBJECT( CLFiles ),"key_release_event",GTK_SIGNAL_FUNC( plKeyReleased ),(void *)0 ); sigSel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void*)1 ); sigUnsel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void*)1 ); sigEvent=gtk_signal_connect( GTK_OBJECT( CLSelected ),"event",GTK_SIGNAL_FUNC( plEvent ),(void *)1 ); + gtk_signal_connect( GTK_OBJECT( CLSelected ),"key_release_event",GTK_SIGNAL_FUNC( plKeyReleased ),(void *)1 ); gtk_signal_connect( GTK_OBJECT( Add ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)3 ); gtk_signal_connect( GTK_OBJECT( Add ),"key_release_event",GTK_SIGNAL_FUNC( plKeyReleased ),(void*)3 ); From subversion at mplayerhq.hu Sun Dec 11 18:52:20 2011 From: subversion at mplayerhq.hu (reimar) Date: Sun, 11 Dec 2011 18:52:20 +0100 (CET) Subject: [MPlayer-cvslog] r34438 - in trunk: DOCS/man/en/mplayer.1 libvo/gl_common.h libvo/vo_gl.c Message-ID: <20111211175220.BD0AE126A2D@avserver.banki.hu> Author: reimar Date: Sun Dec 11 18:52:20 2011 New Revision: 34438 Log: Add a suboption to allow forcing use of e.g. OpenGL ES to -vo gl. Modified: trunk/libvo/gl_common.h trunk/libvo/vo_gl.c Changes in other areas also in this revision: Modified: trunk/DOCS/man/en/mplayer.1 Modified: trunk/libvo/gl_common.h ============================================================================== --- trunk/libvo/gl_common.h Sun Dec 11 18:51:24 2011 (r34437) +++ trunk/libvo/gl_common.h Sun Dec 11 18:52:20 2011 (r34438) @@ -405,11 +405,12 @@ void glDisable3D(int type); /** \} */ enum MPGLType { - GLTYPE_AUTO, + GLTYPE_AUTO = -1, GLTYPE_W32, GLTYPE_X11, GLTYPE_SDL, GLTYPE_EGL_X11, + GLTYPE_COUNT }; typedef struct MPGLContext { Modified: trunk/libvo/vo_gl.c ============================================================================== --- trunk/libvo/vo_gl.c Sun Dec 11 18:51:24 2011 (r34437) +++ trunk/libvo/vo_gl.c Sun Dec 11 18:52:20 2011 (r34438) @@ -151,6 +151,7 @@ static int custom_tlin; static int custom_trect; static int mipmap_gen; static int stereo_mode; +static enum MPGLType backend; static int int_pause; static int eq_bri = 0; @@ -1137,6 +1138,12 @@ uninit(void) uninit_mpglcontext(&glctx); } +static int valid_backend(void *p) +{ + int *backend = p; + return *backend >= GLTYPE_AUTO && *backend < GLTYPE_COUNT; +} + static int valid_csp(void *p) { int *csp = p; @@ -1176,13 +1183,14 @@ static const opt_t subopts[] = { {"mipmapgen", OPT_ARG_BOOL, &mipmap_gen, NULL}, {"osdcolor", OPT_ARG_INT, &osd_color, NULL}, {"stereo", OPT_ARG_INT, &stereo_mode, NULL}, + {"backend", OPT_ARG_INT, &backend, valid_backend}, {NULL} }; static int preinit_internal(const char *arg, int allow_sw) { // set defaults - enum MPGLType gltype = GLTYPE_AUTO; + backend = GLTYPE_AUTO; many_fmts = 1; use_osd = -1; scaled_osd = 0; @@ -1289,10 +1297,16 @@ static int preinit_internal(const char * " 1: side-by-side to red-cyan stereo\n" " 2: side-by-side to green-magenta stereo\n" " 3: side-by-side to quadbuffer stereo\n" + " backend=\n" + " -1: auto-select\n" + " 0: Win32/WGL\n" + " 1: X11/GLX\n" + " 2: SDL\n" + " 3: X11/EGL (experimental)\n" "\n" ); return -1; } - if (!init_mpglcontext(&glctx, gltype)) + if (!init_mpglcontext(&glctx, backend)) goto err_out; if (use_yuv == -1 || !allow_sw) { if (create_window(320, 200, VOFLAG_HIDDEN, NULL) < 0) From subversion at mplayerhq.hu Sun Dec 11 19:47:41 2011 From: subversion at mplayerhq.hu (ib) Date: Sun, 11 Dec 2011 19:47:41 +0100 (CET) Subject: [MPlayer-cvslog] r34439 - trunk/gui/ui/gtk/fileselect.c Message-ID: <20111211184741.343AF1268DB@avserver.banki.hu> Author: ib Date: Sun Dec 11 19:47:40 2011 New Revision: 34439 Log: Leave the focus in fsFNameList after key event in file selector. Otherwise it would switch to fsPathCombo which is annoying for key control. This helps when operating the GUI with a remote control (and doesn't harm if not). Modified: trunk/gui/ui/gtk/fileselect.c Modified: trunk/gui/ui/gtk/fileselect.c ============================================================================== --- trunk/gui/ui/gtk/fileselect.c Sun Dec 11 18:52:20 2011 (r34438) +++ trunk/gui/ui/gtk/fileselect.c Sun Dec 11 19:47:40 2011 (r34439) @@ -558,9 +558,11 @@ static gboolean on_FileSelect_key_releas break; case GDK_Return: gtk_button_released( GTK_BUTTON( fsOk ) ); + gtk_widget_grab_focus( fsFNameList ); break; case GDK_BackSpace: gtk_button_released( GTK_BUTTON( fsUp ) ); + gtk_widget_grab_focus( fsFNameList ); break; } } From eclipse7 at gmx.net Sun Dec 11 21:08:36 2011 From: eclipse7 at gmx.net (Alexander Strasser) Date: Sun, 11 Dec 2011 21:08:36 +0100 Subject: [MPlayer-cvslog] r34428 - trunk/mplayer.c In-Reply-To: <20111211163311.GA27678@pool.informatik.rwth-aachen.de> References: <20111211144436.EA82B122803@avserver.banki.hu> <20111211163311.GA27678@pool.informatik.rwth-aachen.de> Message-ID: <20111211200836.GA2436@akuma> Diego Biurrun wrote: > On Sun, Dec 11, 2011 at 03:44:36PM +0100, ib wrote: > > > > Log: > > Cosmetic: Adjust indent. > > > > --- trunk/mplayer.c Sun Dec 11 15:43:16 2011 (r34427) > > +++ trunk/mplayer.c Sun Dec 11 15:44:36 2011 (r34428) > > @@ -3061,7 +3061,7 @@ play_next_file: > > if (cmd->id == MP_CMD_GUI) > > gui(GUI_RUN_MESSAGE, cmd->args[0].v.s); > > else > > - gui(GUI_RUN_COMMAND, (void *)cmd->id); > > + gui(GUI_RUN_COMMAND, (void *)cmd->id); > > mp_cmd_free(cmd); > > This is completely silly. Fold such things into the original commit. Calling it "completely silly" sounds exaggerated to me. I don't have a problem with this commit and I do not think many developers have. Of course it might be convenient to not split this for the committer if he likes it that way. As I understand it our coding policy says, to not include large indentations in a non-cosmetic commit. But it doesn't say you must include small cosmetics. Alexander From subversion at mplayerhq.hu Sun Dec 11 22:32:07 2011 From: subversion at mplayerhq.hu (reimar) Date: Sun, 11 Dec 2011 22:32:07 +0100 (CET) Subject: [MPlayer-cvslog] r34440 - in trunk: configure sub/subreader.c Message-ID: <20111211213207.CEE37124BBC@avserver.banki.hu> Author: reimar Date: Sun Dec 11 22:32:07 2011 New Revision: 34440 Log: Require a fribidi version that defines FriBidiParType. The workarounds to work with older versions would be getting too ugly. Modified: trunk/configure trunk/sub/subreader.c Modified: trunk/configure ============================================================================== --- trunk/configure Sun Dec 11 19:47:40 2011 (r34439) +++ trunk/configure Sun Dec 11 22:32:07 2011 (r34440) @@ -5934,9 +5934,8 @@ echocheck "fribidi with charsets" if test "$_fribidi" = auto ; then cat > $TMPC << EOF #include -/* workaround for fribidi 0.10.4 and below */ -#define FRIBIDI_CHARSET_UTF8 FRIBIDI_CHAR_SET_UTF8 #include +FriBidiParType test; int main(void) { if (fribidi_parse_charset("UTF-8") != FRIBIDI_CHAR_SET_UTF8) exit(1); Modified: trunk/sub/subreader.c ============================================================================== --- trunk/sub/subreader.c Sun Dec 11 19:47:40 2011 (r34439) +++ trunk/sub/subreader.c Sun Dec 11 22:32:07 2011 (r34440) @@ -1237,11 +1237,7 @@ subtitle* subcp_recode (subtitle *sub) */ int do_fribid_log2vis(int charset, const char *in, FriBidiChar *logical, FriBidiChar *visual, int flip_commas) { -#if defined(FRIBIDI_PAR_LTR) || FRIBIDI_INTERFACE_VERSION >= 3 FriBidiParType base = flip_commas ? FRIBIDI_PAR_ON : FRIBIDI_PAR_LTR; -#else - FriBidiCharType base = flip_commas ? FRIBIDI_TYPE_ON : FRIBIDI_TYPE_L; -#endif int len = strlen(in); len = fribidi_charset_to_unicode(charset, in, len, logical); if (!fribidi_log2vis(logical, len, &base, visual, NULL, NULL, NULL)) From diego at biurrun.de Mon Dec 12 00:39:45 2011 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 12 Dec 2011 00:39:45 +0100 Subject: [MPlayer-cvslog] r34428 - trunk/mplayer.c In-Reply-To: <20111211200836.GA2436@akuma> References: <20111211144436.EA82B122803@avserver.banki.hu> <20111211163311.GA27678@pool.informatik.rwth-aachen.de> <20111211200836.GA2436@akuma> Message-ID: <20111211233944.GA30461@pool.informatik.rwth-aachen.de> On Sun, Dec 11, 2011 at 09:08:36PM +0100, Alexander Strasser wrote: > Diego Biurrun wrote: > > On Sun, Dec 11, 2011 at 03:44:36PM +0100, ib wrote: > > > > > > Log: > > > Cosmetic: Adjust indent. > > > > > > --- trunk/mplayer.c Sun Dec 11 15:43:16 2011 (r34427) > > > +++ trunk/mplayer.c Sun Dec 11 15:44:36 2011 (r34428) > > > @@ -3061,7 +3061,7 @@ play_next_file: > > > if (cmd->id == MP_CMD_GUI) > > > gui(GUI_RUN_MESSAGE, cmd->args[0].v.s); > > > else > > > - gui(GUI_RUN_COMMAND, (void *)cmd->id); > > > + gui(GUI_RUN_COMMAND, (void *)cmd->id); > > > mp_cmd_free(cmd); > > > > This is completely silly. Fold such things into the original commit. > > Calling it "completely silly" sounds exaggerated to me. > > I don't have a problem with this commit and I do not think many developers > have. Of course it might be convenient to not split this for the committer > if he likes it that way. This commit creates unnecessary clutter for no gain at all. Now there is one extra entry in the history (to skip over) and one extra mail that has to be processed by everyone. That's a lot of time wasted compared to the gain, which is nil. Add to that the time it took to split the change into two commits in the first place. We simply should not keep perpetuating this bad habit into the future, but drop it instead. No readability is gained by splitting off one-line indentation changes into separate commits; it just wastes time. > As I understand it our coding policy says, to not include large indentations > in a non-cosmetic commit. But it doesn't say you must include small cosmetics. It also does not say "use your common sense" because that is kind of a given. Diego From tempn at twmi.rr.com Mon Dec 12 02:02:01 2011 From: tempn at twmi.rr.com (compn) Date: Sun, 11 Dec 2011 20:02:01 -0500 Subject: [MPlayer-cvslog] r34428 - trunk/mplayer.c In-Reply-To: <20111211233944.GA30461@pool.informatik.rwth-aachen.de> References: <20111211144436.EA82B122803@avserver.banki.hu> <20111211163311.GA27678@pool.informatik.rwth-aachen.de> <20111211200836.GA2436@akuma> <20111211233944.GA30461@pool.informatik.rwth-aachen.de> Message-ID: <20111211200201.31de7c54.tempn@twmi.rr.com> On Mon, 12 Dec 2011 00:39:45 +0100, Diego Biurrun wrote: >We simply should not keep perpetuating this bad habit into the future, >but drop it instead. No readability is gained by splitting off one-line >indentation changes into separate commits; it just wastes time. > >> As I understand it our coding policy says, to not include large indentations >> in a non-cosmetic commit. But it doesn't say you must include small cosmetics. > >It also does not say "use your common sense" because that is kind of a given. it says no mixing cosmetics and functional changes. submit a patch to svn-howto if you want... -compn From subversion at mplayerhq.hu Mon Dec 12 10:20:35 2011 From: subversion at mplayerhq.hu (ib) Date: Mon, 12 Dec 2011 10:20:35 +0100 (CET) Subject: [MPlayer-cvslog] r34441 - trunk/gui/app.c Message-ID: <20111212092035.0F98E126CF4@avserver.banki.hu> Author: ib Date: Mon Dec 12 10:20:34 2011 New Revision: 34441 Log: Return right pointer. Return pointer to found item, not to the start of the array. Modified: trunk/gui/app.c Modified: trunk/gui/app.c ============================================================================== --- trunk/gui/app.c Sun Dec 11 22:32:07 2011 (r34440) +++ trunk/gui/app.c Mon Dec 12 10:20:34 2011 (r34441) @@ -169,7 +169,7 @@ wItem *appFindItem(int event) for (i = 0; i <= n; i++) if (item[i].message == event) - return item; + return &item[i]; return NULL; } From diego at biurrun.de Mon Dec 12 10:23:16 2011 From: diego at biurrun.de (Diego Biurrun) Date: Mon, 12 Dec 2011 10:23:16 +0100 Subject: [MPlayer-cvslog] r34428 - trunk/mplayer.c In-Reply-To: <20111211200201.31de7c54.tempn@twmi.rr.com> References: <20111211144436.EA82B122803@avserver.banki.hu> <20111211163311.GA27678@pool.informatik.rwth-aachen.de> <20111211200836.GA2436@akuma> <20111211233944.GA30461@pool.informatik.rwth-aachen.de> <20111211200201.31de7c54.tempn@twmi.rr.com> Message-ID: <20111212092316.GA2031@pool.informatik.rwth-aachen.de> On Sun, Dec 11, 2011 at 08:02:01PM -0500, compn wrote: > On Mon, 12 Dec 2011 00:39:45 +0100, Diego Biurrun wrote: > >We simply should not keep perpetuating this bad habit into the future, > >but drop it instead. No readability is gained by splitting off one-line > >indentation changes into separate commits; it just wastes time. > > > >> As I understand it our coding policy says, to not include large indentations > >> in a non-cosmetic commit. But it doesn't say you must include small cosmetics. > > > >It also does not say "use your common sense" because that is kind of a given. > > it says no mixing cosmetics and functional changes. > > submit a patch to svn-howto if you want... I don't think this requires clarification, but I just sent a patch. Diego From subversion at mplayerhq.hu Wed Dec 14 01:17:50 2011 From: subversion at mplayerhq.hu (iive) Date: Wed, 14 Dec 2011 01:17:50 +0100 (CET) Subject: [MPlayer-cvslog] r34443 - trunk/sub/subreader.c Message-ID: <20111214001750.50CF1127747@avserver.banki.hu> Author: iive Date: Wed Dec 14 01:17:49 2011 New Revision: 34443 Log: Avoid double conversion from utf16/ucs2 to utf8 for text subtitles. There is code that auto-detects utf16 encoding of the subtitle stream and forces the reading functions to convert it to native utf8. The bug happens when using enca to (correctly) guess that the input file has ucs2 encoding and tries to convert the input stream to utf8, again. In my case iconv did not accept the input and discarded the subtitles completely. Modified: trunk/sub/subreader.c Modified: trunk/sub/subreader.c ============================================================================== --- trunk/sub/subreader.c Tue Dec 13 14:23:06 2011 (r34442) +++ trunk/sub/subreader.c Wed Dec 14 01:17:49 2011 (r34443) @@ -1514,7 +1514,7 @@ sub_data* sub_read_file (const char *fil sub=srp->read(fd,sub,utf16); if(!sub) break; // EOF #ifdef CONFIG_ICONV - if ((sub!=ERR) && sub_utf8 == 2) sub=subcp_recode(sub); + if ((sub!=ERR) && sub_utf8 == 2 && utf16 == 0) sub=subcp_recode(sub); #endif #ifdef CONFIG_FRIBIDI if (sub!=ERR) sub=sub_fribidi(sub,sub_utf8,0); From subversion at mplayerhq.hu Wed Dec 14 13:37:17 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Wed, 14 Dec 2011 13:37:17 +0100 (CET) Subject: [MPlayer-cvslog] r34444 - trunk/etc/codecs.conf Message-ID: <20111214123717.8DBE9127B51@avserver.banki.hu> Author: cehoyos Date: Wed Dec 14 13:37:16 2011 New Revision: 34444 Log: Support FFmpeg Dxtory decoder. Modified: trunk/etc/codecs.conf Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Wed Dec 14 01:17:49 2011 (r34443) +++ trunk/etc/codecs.conf Wed Dec 14 13:37:16 2011 (r34444) @@ -3390,6 +3390,14 @@ videocodec fffraps dll "fraps" out BGR24,YV12,I420 +videocodec ffxtor + info "FFmpeg Dxtory" + status working + fourcc xtor + driver ffmpeg + dll dxtory + out YV12 + videocodec ffjv info "FFmpeg Bitmap Brothers JV" status working From subversion at mplayerhq.hu Wed Dec 14 15:32:48 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Wed, 14 Dec 2011 15:32:48 +0100 (CET) Subject: [MPlayer-cvslog] r34445 - in trunk: etc/codecs.conf libmpdemux/mp_taglists.c Message-ID: <20111214143248.280BD1277DD@avserver.banki.hu> Author: cehoyos Date: Wed Dec 14 15:32:47 2011 New Revision: 34445 Log: Support FFmpeg mmvideo decoder. Patch by Paul B Mahol, onemda gmail Modified: trunk/etc/codecs.conf trunk/libmpdemux/mp_taglists.c Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Wed Dec 14 13:37:16 2011 (r34444) +++ trunk/etc/codecs.conf Wed Dec 14 15:32:47 2011 (r34445) @@ -78,6 +78,14 @@ videocodec ffmdec dll mdec out YV12 +videocodec ffmmvideo + info "FFmpeg American Laser Games MM Video" + status working + fourcc "MMV " ; internal MPlayer FourCC + driver ffmpeg + dll mmvideo + out BGR8 + videocodec ffsiff info "FFmpeg Beam Software SIFF" status working Modified: trunk/libmpdemux/mp_taglists.c ============================================================================== --- trunk/libmpdemux/mp_taglists.c Wed Dec 14 13:37:16 2011 (r34444) +++ trunk/libmpdemux/mp_taglists.c Wed Dec 14 15:32:47 2011 (r34445) @@ -129,6 +129,7 @@ static const struct AVCodecTag mp_bmp_ta { CODEC_ID_JV, MKTAG('F', 'F', 'J', 'V')}, { CODEC_ID_MAD, MKTAG('M', 'A', 'D', 'k')}, { CODEC_ID_MDEC, MKTAG('M', 'D', 'E', 'C')}, + { CODEC_ID_MMVIDEO, MKTAG('M', 'M', 'V', ' ')}, { CODEC_ID_MOTIONPIXELS, MKTAG('M', 'V', 'I', '1')}, { CODEC_ID_MXPEG, MKTAG('M', 'X', 'P', 'G')}, { CODEC_ID_NUV, MKTAG('N', 'U', 'V', '1')}, From Reimar.Doeffinger at gmx.de Wed Dec 14 19:56:47 2011 From: Reimar.Doeffinger at gmx.de (Reimar =?iso-8859-1?Q?D=F6ffinger?=) Date: Wed, 14 Dec 2011 19:56:47 +0100 Subject: [MPlayer-cvslog] r34443 - trunk/sub/subreader.c In-Reply-To: <20111214001750.50CF1127747@avserver.banki.hu> References: <20111214001750.50CF1127747@avserver.banki.hu> Message-ID: <20111214185647.GC2199@1und1.de> On Wed, Dec 14, 2011 at 01:17:50AM +0100, iive wrote: > Author: iive > Date: Wed Dec 14 01:17:49 2011 > New Revision: 34443 > > Log: > Avoid double conversion from utf16/ucs2 to utf8 for text subtitles. > > There is code that auto-detects utf16 encoding of the subtitle stream > and forces the reading functions to convert it to native utf8. > The bug happens when using enca to (correctly) guess that the input > file has ucs2 encoding and tries to convert the input stream to utf8, again. Hm, wouldn't it be better to change the enca code so it never sees any utf16 encoded data in the case we convert ourselves? Or what else is going wrong here? Or is there a reset of enca state missing at some point or such? From subversion at mplayerhq.hu Thu Dec 15 15:01:05 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Thu, 15 Dec 2011 15:01:05 +0100 (CET) Subject: [MPlayer-cvslog] r34446 - trunk/configure Message-ID: <20111215140105.D5B48127F23@avserver.banki.hu> Author: cehoyos Date: Thu Dec 15 15:01:05 2011 New Revision: 34446 Log: Fix compilation after CONFIG_H264CHROMA was added to FFmpeg. Modified: trunk/configure Modified: trunk/configure ============================================================================== --- trunk/configure Wed Dec 14 15:32:47 2011 (r34445) +++ trunk/configure Thu Dec 15 15:01:05 2011 (r34446) @@ -8211,6 +8211,7 @@ CONFIG_DCT = yes CONFIG_DWT = yes CONFIG_FFT = yes CONFIG_GOLOMB = yes +CONFIG_H264CHROMA = yes CONFIG_H264DSP = yes CONFIG_H264PRED= yes CONFIG_HUFFMAN = yes @@ -8730,6 +8731,7 @@ $def_yasm #define CONFIG_DWT 1 #define CONFIG_FFT 1 #define CONFIG_GOLOMB 1 +#define CONFIG_H264CHROMA 1 #define CONFIG_H264DSP 1 #define CONFIG_H264PRED 1 #define CONFIG_HUFFMAN 1 From subversion at mplayerhq.hu Thu Dec 15 23:32:22 2011 From: subversion at mplayerhq.hu (cigaes) Date: Thu, 15 Dec 2011 23:32:22 +0100 (CET) Subject: [MPlayer-cvslog] r34447 - in trunk: etc/codecs.conf libmpdemux/mp_taglists.c Message-ID: <20111215223222.BBC7B128101@avserver.banki.hu> Author: cigaes Date: Thu Dec 15 23:32:22 2011 New Revision: 34447 Log: Support SBG decoding using ffwavesynth. Modified: trunk/etc/codecs.conf trunk/libmpdemux/mp_taglists.c Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Thu Dec 15 15:01:05 2011 (r34446) +++ trunk/etc/codecs.conf Thu Dec 15 23:32:22 2011 (r34447) @@ -5463,3 +5463,11 @@ audiocodec spdifthd fourcc TRHD ; internal MPlayer FourCC dll thd driver spdif + +audiocodec ffwavesynth + info "FFmpeg wave synthesizer" + status working + fourcc "FFWS" ; internal MPlayer FourCC + driver ffmpeg + dll "wavesynth" + Modified: trunk/libmpdemux/mp_taglists.c ============================================================================== --- trunk/libmpdemux/mp_taglists.c Thu Dec 15 15:01:05 2011 (r34446) +++ trunk/libmpdemux/mp_taglists.c Thu Dec 15 23:32:22 2011 (r34447) @@ -43,6 +43,7 @@ static const struct AVCodecTag mp_wav_ta { CODEC_ID_COOK, MKTAG('c', 'o', 'o', 'k')}, { CODEC_ID_DSICINAUDIO, MKTAG('D', 'C', 'I', 'A')}, { CODEC_ID_EAC3, MKTAG('E', 'A', 'C', '3')}, + { CODEC_ID_FFWAVESYNTH, MKTAG('F', 'F', 'W', 'S')}, { CODEC_ID_G723_1, MKTAG('7', '2', '3', '1')}, { CODEC_ID_INTERPLAY_DPCM, MKTAG('I', 'N', 'P', 'A')}, { CODEC_ID_MLP, MKTAG('M', 'L', 'P', ' ')}, From ikalvachev at gmail.com Sat Dec 17 12:04:51 2011 From: ikalvachev at gmail.com (Ivan Kalvachev) Date: Sat, 17 Dec 2011 13:04:51 +0200 Subject: [MPlayer-cvslog] r34443 - trunk/sub/subreader.c In-Reply-To: <20111214185647.GC2199@1und1.de> References: <20111214001750.50CF1127747@avserver.banki.hu> <20111214185647.GC2199@1und1.de> Message-ID: On 12/14/11, Reimar D?ffinger wrote: > On Wed, Dec 14, 2011 at 01:17:50AM +0100, iive wrote: >> Author: iive >> Date: Wed Dec 14 01:17:49 2011 >> New Revision: 34443 >> >> Log: >> Avoid double conversion from utf16/ucs2 to utf8 for text subtitles. >> >> There is code that auto-detects utf16 encoding of the subtitle stream >> and forces the reading functions to convert it to native utf8. >> The bug happens when using enca to (correctly) guess that the input >> file has ucs2 encoding and tries to convert the input stream to utf8, >> again. > > Hm, wouldn't it be better to change the enca code so it never sees any > utf16 encoded data in the case we convert ourselves? > Or what else is going wrong here? > Or is there a reset of enca state missing at some point or such? It's not enca at fault here. The whole utf16 handling is wrong. To provide reliable detection enca needs as much data as possible, that's why it is provided with big buffer of the raw file content. The the utf16 autodetection however uses line-by-line reading functions while detecting the subtitle format. One line would not be enough to provide reliable detection of the encoding E.g. srt subtitles start with distinctive headers that are using ascii characters and almost all encodings have ascii as subset. On the other hand the utf16 detection relies on the fact that subtitles would be using the ascii subset to recognize the multi-byte encoding. The utf16 solution seems to spawn from the fact that you can't use stock library string functions, so the stream reading function needs to do the conversion on their own, otherwise we won't even find the line ending. As end result utf16 function parameter have propagated in almost all subtitling code. I think the proper solution would be if the stream line reading function reads a raw buffer of bytes, converts them using iconv then try to find the line-end. The rest of the code would work as before. This would allow other stuff like overriding of the detected encoding (e.g. for the case where ucs2 and utf16 differ). Unfortunately, I don't have the time or incentive to mess with the subtitle code at the moment. From subversion at mplayerhq.hu Sun Dec 18 01:33:47 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Sun, 18 Dec 2011 01:33:47 +0100 (CET) Subject: [MPlayer-cvslog] r34449 - trunk/etc/codecs.conf Message-ID: <20111218003347.843091289B7@avserver.banki.hu> Author: cehoyos Date: Sun Dec 18 01:33:46 2011 New Revision: 34449 Log: Support decoding yuv411p rawvideo. Patch by Paul B Mahol, onemda gmail Modified: trunk/etc/codecs.conf Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Fri Dec 16 13:23:29 2011 (r34448) +++ trunk/etc/codecs.conf Sun Dec 18 01:33:46 2011 (r34449) @@ -3942,6 +3942,14 @@ videocodec ffrawyvu9 dll rawvideo out YVU9 +videocodec ffrawy41b + info "RAW Y41B" + status working + fourcc Y41B + driver ffmpeg + dll rawvideo + out 411P + videocodec ffrawy800 info "RAW Y8/Y800" status working From subversion at mplayerhq.hu Tue Dec 20 01:11:26 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Tue, 20 Dec 2011 01:11:26 +0100 (CET) Subject: [MPlayer-cvslog] r34451 - in trunk: etc/codecs.conf libmpdemux/mp_taglists.c Message-ID: <20111220001126.AD9AF12914F@avserver.banki.hu> Author: cehoyos Date: Tue Dec 20 01:11:26 2011 New Revision: 34451 Log: Support FFmpeg 8088flex TMV decoder. Modified: trunk/etc/codecs.conf trunk/libmpdemux/mp_taglists.c Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Sun Dec 18 11:28:24 2011 (r34450) +++ trunk/etc/codecs.conf Tue Dec 20 01:11:26 2011 (r34451) @@ -3487,6 +3487,14 @@ videocodec fftxd dll txd out BGR32 +videocodec fftmv + info "FFmpeg 8088flex TMV" + status working + fourcc tmv8 ; internal MPlayer FourCC + driver ffmpeg + dll tmv + out BGR8 + videocodec xan info "XAN Video" status working Modified: trunk/libmpdemux/mp_taglists.c ============================================================================== --- trunk/libmpdemux/mp_taglists.c Sun Dec 18 11:28:24 2011 (r34450) +++ trunk/libmpdemux/mp_taglists.c Tue Dec 20 01:11:26 2011 (r34451) @@ -141,6 +141,7 @@ static const struct AVCodecTag mp_bmp_ta { CODEC_ID_RV30, MKTAG('R', 'V', '3', '0')}, { CODEC_ID_RV40, MKTAG('R', 'V', '4', '0')}, { CODEC_ID_SVQ3, MKTAG('S', 'V', 'Q', '3')}, + { CODEC_ID_TMV, MKTAG('t', 'm', 'v', '8')}, { CODEC_ID_TGV, MKTAG('f', 'V', 'G', 'T')}, { CODEC_ID_THP, MKTAG('T', 'H', 'P', 'V')}, { CODEC_ID_TIERTEXSEQVIDEO, MKTAG('T', 'S', 'E', 'Q')}, From subversion at mplayerhq.hu Tue Dec 20 17:34:39 2011 From: subversion at mplayerhq.hu (ib) Date: Tue, 20 Dec 2011 17:34:39 +0100 (CET) Subject: [MPlayer-cvslog] r34452 - trunk/gui/ui/gtk/fileselect.c Message-ID: <20111220163439.31D50128CDA@avserver.banki.hu> Author: ib Date: Tue Dec 20 17:34:38 2011 New Revision: 34452 Log: Remember the lastly selected file in file selector. Don't move the focus / selection from that file. Modified: trunk/gui/ui/gtk/fileselect.c Modified: trunk/gui/ui/gtk/fileselect.c ============================================================================== --- trunk/gui/ui/gtk/fileselect.c Tue Dec 20 01:11:26 2011 (r34451) +++ trunk/gui/ui/gtk/fileselect.c Tue Dec 20 17:34:38 2011 (r34452) @@ -59,6 +59,8 @@ const gchar * fsFilter = "*"; int fsType = 0; +static gint fsCurrFNameListSelected, fsLastFNameListSelected; + char * fsVideoFilterNames[][2] = { { "ASF files (*.asf)", "*.asf" }, @@ -243,7 +245,6 @@ static void CheckDir( GtkWidget * list ) globfree( &gg ); gtk_clist_set_column_width( GTK_CLIST( list ),0,17 ); - gtk_clist_select_row( GTK_CLIST( list ),0,1 ); gtk_widget_show( list ); } @@ -359,6 +360,9 @@ void ShowFileSelect( int type,int modal gtk_combo_set_popdown_strings( GTK_COMBO( fsCombo4 ),fsTopList_items ); gtk_widget_grab_focus( fsFNameList ); + ((GtkCList *)fsFNameList)->focus_row = fsLastFNameListSelected; + gtk_clist_select_row( GTK_CLIST( fsFNameList ),fsLastFNameListSelected,1 ); + fsLastFNameListSelected = 0; gtk_window_set_modal( GTK_WINDOW( fsFileSelect ),modal ); @@ -371,6 +375,7 @@ void HideFileSelect( void ) gtk_widget_hide( fsFileSelect ); gtk_widget_destroy( fsFileSelect ); fsFileSelect=NULL; + fsLastFNameListSelected = fsCurrFNameListSelected; } static void fs_PersistantHistory( char * subject ) @@ -484,6 +489,7 @@ static void fs_Ok_released( GtkButton * fsSelectedFile=fsThatDir; CheckDir( fsFNameList ); gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name_utf8() ); + gtk_widget_grab_focus( fsFNameList ); return; } @@ -534,6 +540,7 @@ static void fs_Cancel_released( GtkButto static void fs_fsFNameList_select_row( GtkWidget * widget, gint row, gint column, GdkEventButton *bevent, gpointer user_data) { + fsCurrFNameListSelected = row; gtk_clist_get_text( GTK_CLIST(widget ),row,1,&fsSelectedFile ); g_free( fsSelectedFileUtf8 ); fsSelectedFileUtf8 = g_filename_from_utf8( fsSelectedFile, -1, NULL, NULL, NULL ); @@ -558,7 +565,6 @@ static gboolean on_FileSelect_key_releas break; case GDK_Return: gtk_button_released( GTK_BUTTON( fsOk ) ); - gtk_widget_grab_focus( fsFNameList ); break; case GDK_BackSpace: gtk_button_released( GTK_BUTTON( fsUp ) ); From ib at wupperonline.de Tue Dec 20 17:10:31 2011 From: ib at wupperonline.de (=?ISO-8859-1?Q?Ingo=20Br=FCckl?=) Date: Tue, 20 Dec 2011 17:10:31 +0100 Subject: [MPlayer-cvslog] r33557 - trunk/stream/stream_cdda.c In-Reply-To: <20110604102751.E9B87D6A16@avserver.banki.hu> Message-ID: <4ef0c5f7.66a9f1f0.bm000@wupperonline.de> reimar wrote on Sat, 4 Jun 2011 12:27:51 +0200 (CEST): > Constrain libcdparanoia's caching which badly breaks playback with -nocache. > Modified: trunk/stream/stream_cdda.c > ========================================================================= > +++ trunk/stream/stream_cdda.c Sat Jun 4 12:27:45 2011 (r33557) > @@ -419,6 +419,9 @@ static int open_cdda(stream_t *st,int m, > if(p->no_skip) > mode |= PARANOIA_MODE_NEVERSKIP; > #ifndef CONFIG_LIBCDIO > + // HACK against libcdparanoia's stupid caching model that > + // queues up a huge number of requests leading to stuttering > + paranoia_cachemodel_size(priv->cdp, 24); > paranoia_modeset(cdd, mode); For information only: I still need -cache even with this hack. Stuttering only changes from seldom, long-time dropouts to frequent, very short ones. Ingo From subversion at mplayerhq.hu Thu Dec 22 18:42:51 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Thu, 22 Dec 2011 18:42:51 +0100 (CET) Subject: [MPlayer-cvslog] [propchange]: r34453 - svn:log Message-ID: <20111222174252.0C03E12A1D4@avserver.banki.hu> Author: cehoyos Revision: 34453 Property Name: svn:log Action: modified Property diff: --- old property value +++ new property value @@ -1,3 +1,3 @@ Fix build of swedish help after r33915. -Patch by Alexis Ballier, alexis.ballier gmail +Patch by larkang at gmail, provided by Alexis Ballier, alexis.ballier gmail From subversion at mplayerhq.hu Fri Dec 23 14:41:25 2011 From: subversion at mplayerhq.hu (ib) Date: Fri, 23 Dec 2011 14:41:25 +0100 (CET) Subject: [MPlayer-cvslog] r34454 - trunk/gui/ui/gtk/fileselect.c Message-ID: <20111223134125.BC37E12A784@avserver.banki.hu> Author: ib Date: Fri Dec 23 14:41:25 2011 New Revision: 34454 Log: Add /mnt only to the file selector path list if it exists. Additionally, check for /media and add it if it exists. Modified: trunk/gui/ui/gtk/fileselect.c Modified: trunk/gui/ui/gtk/fileselect.c ============================================================================== --- trunk/gui/ui/gtk/fileselect.c Thu Dec 22 18:39:38 2011 (r34453) +++ trunk/gui/ui/gtk/fileselect.c Fri Dec 23 14:41:25 2011 (r34454) @@ -252,6 +252,7 @@ void ShowFileSelect( int type,int modal { int i, k, fsMedium; char * tmp = NULL, * dir = NULL; + struct stat f; if ( fsFileSelect ) gtkActive( fsFileSelect ); else fsFileSelect=create_FileSelect(); @@ -321,7 +322,6 @@ void ShowFileSelect( int type,int modal if ( tmp && tmp[0] ) { - struct stat f; dir = strdup( tmp ); do @@ -355,7 +355,8 @@ void ShowFileSelect( int type,int modal free( dir ); if ( getenv( "HOME" ) ) fsTopList_items=g_list_append( fsTopList_items,getenv( "HOME" ) ); fsTopList_items=g_list_append( fsTopList_items,"/home" ); - fsTopList_items=g_list_append( fsTopList_items,"/mnt" ); + if (stat( "/mnt",&f ) == 0) fsTopList_items=g_list_append( fsTopList_items,"/mnt" ); + if (stat( "/media",&f ) == 0) fsTopList_items=g_list_append( fsTopList_items,"/media" ); fsTopList_items=g_list_append( fsTopList_items,"/" ); gtk_combo_set_popdown_strings( GTK_COMBO( fsCombo4 ),fsTopList_items ); From subversion at mplayerhq.hu Fri Dec 23 15:39:39 2011 From: subversion at mplayerhq.hu (ib) Date: Fri, 23 Dec 2011 15:39:39 +0100 (CET) Subject: [MPlayer-cvslog] r34455 - trunk/gui/ui/gtk/fileselect.c Message-ID: <20111223143940.06C7E12A7EE@avserver.banki.hu> Author: ib Date: Fri Dec 23 15:39:39 2011 New Revision: 34455 Log: Cosmetic: Swap /mnt and /media in the file selector path list. This looks nicer if someone has both. Modified: trunk/gui/ui/gtk/fileselect.c Modified: trunk/gui/ui/gtk/fileselect.c ============================================================================== --- trunk/gui/ui/gtk/fileselect.c Fri Dec 23 14:41:25 2011 (r34454) +++ trunk/gui/ui/gtk/fileselect.c Fri Dec 23 15:39:39 2011 (r34455) @@ -355,8 +355,8 @@ void ShowFileSelect( int type,int modal free( dir ); if ( getenv( "HOME" ) ) fsTopList_items=g_list_append( fsTopList_items,getenv( "HOME" ) ); fsTopList_items=g_list_append( fsTopList_items,"/home" ); - if (stat( "/mnt",&f ) == 0) fsTopList_items=g_list_append( fsTopList_items,"/mnt" ); if (stat( "/media",&f ) == 0) fsTopList_items=g_list_append( fsTopList_items,"/media" ); + if (stat( "/mnt",&f ) == 0) fsTopList_items=g_list_append( fsTopList_items,"/mnt" ); fsTopList_items=g_list_append( fsTopList_items,"/" ); gtk_combo_set_popdown_strings( GTK_COMBO( fsCombo4 ),fsTopList_items ); From subversion at mplayerhq.hu Fri Dec 23 15:42:17 2011 From: subversion at mplayerhq.hu (ib) Date: Fri, 23 Dec 2011 15:42:17 +0100 (CET) Subject: [MPlayer-cvslog] r34456 - trunk/gui/ui/gtk/fileselect.c Message-ID: <20111223144217.8FA4912A7FD@avserver.banki.hu> Author: ib Date: Fri Dec 23 15:42:17 2011 New Revision: 34456 Log: Add /home only to the file selector path list if HOME isn't set. Modified: trunk/gui/ui/gtk/fileselect.c Modified: trunk/gui/ui/gtk/fileselect.c ============================================================================== --- trunk/gui/ui/gtk/fileselect.c Fri Dec 23 15:39:39 2011 (r34455) +++ trunk/gui/ui/gtk/fileselect.c Fri Dec 23 15:42:17 2011 (r34456) @@ -354,7 +354,7 @@ void ShowFileSelect( int type,int modal } free( dir ); if ( getenv( "HOME" ) ) fsTopList_items=g_list_append( fsTopList_items,getenv( "HOME" ) ); - fsTopList_items=g_list_append( fsTopList_items,"/home" ); + else fsTopList_items=g_list_append( fsTopList_items,"/home" ); if (stat( "/media",&f ) == 0) fsTopList_items=g_list_append( fsTopList_items,"/media" ); if (stat( "/mnt",&f ) == 0) fsTopList_items=g_list_append( fsTopList_items,"/mnt" ); fsTopList_items=g_list_append( fsTopList_items,"/" ); From subversion at mplayerhq.hu Fri Dec 23 15:45:35 2011 From: subversion at mplayerhq.hu (reimar) Date: Fri, 23 Dec 2011 15:45:35 +0100 (CET) Subject: [MPlayer-cvslog] r34457 - trunk/configure Message-ID: <20111223144535.C49FE12A808@avserver.banki.hu> Author: reimar Date: Fri Dec 23 15:45:35 2011 New Revision: 34457 Log: Add CONFIG_AVCODEC and CONFIG_SAFE_BITSTREAM_READER. Modified: trunk/configure Modified: trunk/configure ============================================================================== --- trunk/configure Fri Dec 23 15:42:17 2011 (r34456) +++ trunk/configure Fri Dec 23 15:45:35 2011 (r34457) @@ -8693,6 +8693,7 @@ $def_xmm_clobbers $def_yasm #define CONFIG_AUDIO_FLOAT 0 +#define CONFIG_AVCODEC 1 #define CONFIG_AVSERVER 0 #define CONFIG_FASTDIV 0 #define CONFIG_FFSERVER 0 @@ -8703,6 +8704,8 @@ $def_yasm #define CONFIG_LIBVORBIS 0 #define CONFIG_OPENSSL 0 #define CONFIG_POWERPC_PERF 0 +/* For now prefer speed over avoiding potential invalid reads */ +#define CONFIG_SAFE_BITSTREAM_READER 0 #define CONFIG_SHARED 0 #define CONFIG_SMALL 0 #define CONFIG_SWSCALE_ALPHA 1 From subversion at mplayerhq.hu Fri Dec 23 17:27:15 2011 From: subversion at mplayerhq.hu (reimar) Date: Fri, 23 Dec 2011 17:27:15 +0100 (CET) Subject: [MPlayer-cvslog] r34458 - trunk/stream/stream_cdda.c Message-ID: <20111223162715.A066712A916@avserver.banki.hu> Author: reimar Date: Fri Dec 23 17:27:15 2011 New Revision: 34458 Log: Fix cdda speed default value, range and use more robust condition. Based on patch by Ingo Br?ckl [ib wupperonline de]. Modified: trunk/stream/stream_cdda.c Modified: trunk/stream/stream_cdda.c ============================================================================== --- trunk/stream/stream_cdda.c Fri Dec 23 15:45:35 2011 (r34457) +++ trunk/stream/stream_cdda.c Fri Dec 23 17:27:15 2011 (r34458) @@ -70,7 +70,7 @@ static struct cdda_params { char* device; m_span_t span; } cdda_dflts = { - -1, + 0, 0, NULL, 0, @@ -84,7 +84,7 @@ static struct cdda_params { #define ST_OFF(f) M_ST_OFF(struct cdda_params,f) static const m_option_t cdda_params_fields[] = { - { "speed", ST_OFF(speed), CONF_TYPE_INT, M_OPT_RANGE,1,100, NULL }, + { "speed", ST_OFF(speed), CONF_TYPE_INT, M_OPT_RANGE,0,100, NULL }, { "paranoia", ST_OFF(paranoia_mode), CONF_TYPE_INT,M_OPT_RANGE, 0, 2, NULL }, { "generic-dev", ST_OFF(generic_dev), CONF_TYPE_STRING, 0, 0, 0, NULL }, { "sector-size", ST_OFF(sector_size), CONF_TYPE_INT, M_OPT_RANGE,1,100, NULL }, @@ -382,7 +382,7 @@ static int open_cdda(stream_t *st,int m, cdd->disc_toc[i].dwStartSector += offset; } - if(p->speed) + if(p->speed > 0) cdda_speed_set(cdd,p->speed); last_track = cdda_tracks(cdd); From subversion at mplayerhq.hu Fri Dec 23 17:44:24 2011 From: subversion at mplayerhq.hu (reimar) Date: Fri, 23 Dec 2011 17:44:24 +0100 (CET) Subject: [MPlayer-cvslog] r34459 - trunk/stream/stream_cdda.c Message-ID: <20111223164424.106AF12A95B@avserver.banki.hu> Author: reimar Date: Fri Dec 23 17:44:23 2011 New Revision: 34459 Log: Do not call paranoia_overlapset with 0, it actually causes cdparanoia to just hang. Instead use it to set/unset PARANOIA_MODE_OVERLAP. Modified: trunk/stream/stream_cdda.c Modified: trunk/stream/stream_cdda.c ============================================================================== --- trunk/stream/stream_cdda.c Fri Dec 23 17:27:15 2011 (r34458) +++ trunk/stream/stream_cdda.c Fri Dec 23 17:44:23 2011 (r34459) @@ -88,7 +88,7 @@ static const m_option_t cdda_params_fiel { "paranoia", ST_OFF(paranoia_mode), CONF_TYPE_INT,M_OPT_RANGE, 0, 2, NULL }, { "generic-dev", ST_OFF(generic_dev), CONF_TYPE_STRING, 0, 0, 0, NULL }, { "sector-size", ST_OFF(sector_size), CONF_TYPE_INT, M_OPT_RANGE,1,100, NULL }, - { "overlap", ST_OFF(search_overlap), CONF_TYPE_INT, M_OPT_RANGE,0,75, NULL }, + { "overlap", ST_OFF(search_overlap), CONF_TYPE_INT, M_OPT_RANGE,-1,75, NULL }, { "toc-bias", ST_OFF(toc_bias), CONF_TYPE_INT, 0, 0, 0, NULL }, { "toc-offset", ST_OFF(toc_offset), CONF_TYPE_INT, 0, 0, 0, NULL }, { "noskip", ST_OFF(no_skip), CONF_TYPE_FLAG, 0 , 0, 1, NULL }, @@ -418,18 +418,22 @@ static int open_cdda(stream_t *st,int m, if(p->no_skip) mode |= PARANOIA_MODE_NEVERSKIP; + if(p->search_overlap > 0) + mode |= PARANOIA_MODE_OVERLAP; + else if(p->search_overlap == 0) + mode &= ~PARANOIA_MODE_OVERLAP; #ifndef CONFIG_LIBCDIO // HACK against libcdparanoia's stupid caching model that // queues up a huge number of requests leading to stuttering paranoia_cachemodel_size(priv->cdp, 24); paranoia_modeset(cdd, mode); - if(p->search_overlap >= 0) + if(p->search_overlap > 0) paranoia_overlapset(cdd,p->search_overlap); #else paranoia_modeset(priv->cdp, mode); - if(p->search_overlap >= 0) + if(p->search_overlap > 0) paranoia_overlapset(priv->cdp,p->search_overlap); #endif From Reimar.Doeffinger at gmx.de Fri Dec 23 17:50:46 2011 From: Reimar.Doeffinger at gmx.de (Reimar =?iso-8859-1?Q?D=F6ffinger?=) Date: Fri, 23 Dec 2011 17:50:46 +0100 Subject: [MPlayer-cvslog] r33557 - trunk/stream/stream_cdda.c In-Reply-To: <4ef0c5f7.66a9f1f0.bm000@wupperonline.de> References: <20110604102751.E9B87D6A16@avserver.banki.hu> <4ef0c5f7.66a9f1f0.bm000@wupperonline.de> Message-ID: <20111223165046.GB757@1und1.de> On Tue, Dec 20, 2011 at 05:10:31PM +0100, Ingo Br?ckl wrote: > reimar wrote on Sat, 4 Jun 2011 12:27:51 +0200 (CEST): > > > Constrain libcdparanoia's caching which badly breaks playback with -nocache. > > > Modified: trunk/stream/stream_cdda.c > > ========================================================================= > > +++ trunk/stream/stream_cdda.c Sat Jun 4 12:27:45 2011 (r33557) > > @@ -419,6 +419,9 @@ static int open_cdda(stream_t *st,int m, > > if(p->no_skip) > > mode |= PARANOIA_MODE_NEVERSKIP; > > #ifndef CONFIG_LIBCDIO > > + // HACK against libcdparanoia's stupid caching model that > > + // queues up a huge number of requests leading to stuttering > > + paranoia_cachemodel_size(priv->cdp, 24); > > paranoia_modeset(cdd, mode); > > For information only: I still need -cache even with this hack. Stuttering > only changes from seldom, long-time dropouts to frequent, very short ones. It worked with my old drive. It doesn't seem to work with my current drive, but that is because extracting is slower than real-time speeds so it simply can't work (and there I thought reading audio CDs would be a standard feature working with all CD drives nowadays - obviously not)... From subversion at mplayerhq.hu Fri Dec 23 20:00:31 2011 From: subversion at mplayerhq.hu (reimar) Date: Fri, 23 Dec 2011 20:00:31 +0100 (CET) Subject: [MPlayer-cvslog] r34460 - trunk/stream/stream_cdda.c Message-ID: <20111223190031.93B0612AA37@avserver.banki.hu> Author: reimar Date: Fri Dec 23 20:00:31 2011 New Revision: 34460 Log: Fail if trying to seek beyond the last chapter, not just if it is beyond the end of the disc. Modified: trunk/stream/stream_cdda.c Modified: trunk/stream/stream_cdda.c ============================================================================== --- trunk/stream/stream_cdda.c Fri Dec 23 17:44:23 2011 (r34459) +++ trunk/stream/stream_cdda.c Fri Dec 23 20:00:31 2011 (r34460) @@ -254,9 +254,10 @@ static int control(stream_t *stream, int int r; unsigned int track = *(unsigned int *)arg; int start_track = get_track_by_sector(p, p->start_sector); + int end_track = get_track_by_sector(p, p->end_sector); int seek_sector; track += start_track; - if (track >= p->cd->tracks) { + if (track > end_track) { stream->eof = 1; return STREAM_ERROR; } From subversion at mplayerhq.hu Fri Dec 23 22:50:33 2011 From: subversion at mplayerhq.hu (reimar) Date: Fri, 23 Dec 2011 22:50:33 +0100 (CET) Subject: [MPlayer-cvslog] r34461 - trunk/stream/cache2.c Message-ID: <20111223215033.3679612A873@avserver.banki.hu> Author: reimar Date: Fri Dec 23 22:50:32 2011 New Revision: 34461 Log: Flush cache and sync stream position/eof after seeking STREAM_CTRLs. This avoid some strange differences in behaviour between -cache and -nocache. Modified: trunk/stream/cache2.c Modified: trunk/stream/cache2.c ============================================================================== --- trunk/stream/cache2.c Fri Dec 23 20:00:31 2011 (r34460) +++ trunk/stream/cache2.c Fri Dec 23 22:50:32 2011 (r34461) @@ -94,7 +94,6 @@ typedef struct { volatile unsigned control_uint_arg; volatile double control_double_arg; volatile int control_res; - volatile off_t control_new_pos; volatile double stream_time_length; volatile double stream_time_pos; } cache_vars_t; @@ -109,6 +108,12 @@ static void cache_wakeup(stream_t *s) #endif } +static void cache_flush(cache_vars_t *s) +{ + s->offset= // FIXME!? + s->min_filepos=s->max_filepos=s->read_filepos; // drop cache content :( +} + static int cache_read(cache_vars_t *s, unsigned char *buf, int size) { int total=0; @@ -184,8 +189,7 @@ static int cache_fill(cache_vars_t *s) // issues with e.g. mov or badly interleaved files if(readmin_filepos || read>=s->max_filepos+s->seek_limit) { - s->offset= // FIXME!? - s->min_filepos=s->max_filepos=read; // drop cache content :( + cache_flush(s); if(s->stream->eof) stream_reset(s->stream); stream_seek_internal(s->stream,read); mp_msg(MSGT_CACHE,MSGL_DBG2,"Seek done. new pos: 0x%"PRIX64" \n",(int64_t)stream_tell(s->stream)); @@ -262,12 +266,12 @@ static int cache_fill(cache_vars_t *s) static int cache_execute_control(cache_vars_t *s) { double double_res; unsigned uint_res; + int needs_flush = 0; static unsigned last; int quit = s->control == -2; if (quit || !s->stream->control) { s->stream_time_length = 0; s->stream_time_pos = MP_NOPTS_VALUE; - s->control_new_pos = 0; s->control_res = STREAM_UNSUPPORTED; s->control = -1; return !quit; @@ -294,6 +298,7 @@ static int cache_execute_control(cache_v if (s->control == -1) return 1; switch (s->control) { case STREAM_CTRL_SEEK_TO_TIME: + needs_flush = 1; double_res = s->control_double_arg; case STREAM_CTRL_GET_CURRENT_TIME: case STREAM_CTRL_GET_ASPECT_RATIO: @@ -302,6 +307,7 @@ static int cache_execute_control(cache_v break; case STREAM_CTRL_SEEK_TO_CHAPTER: case STREAM_CTRL_SET_ANGLE: + needs_flush = 1; uint_res = s->control_uint_arg; case STREAM_CTRL_GET_NUM_CHAPTERS: case STREAM_CTRL_GET_CURRENT_CHAPTER: @@ -314,7 +320,11 @@ static int cache_execute_control(cache_v s->control_res = STREAM_UNSUPPORTED; break; } - s->control_new_pos = s->stream->pos; + if (needs_flush) { + s->read_filepos = s->stream->pos; + s->eof = s->stream->eof; + cache_flush(s); + } s->control = -1; return 1; } @@ -593,16 +603,19 @@ int cache_stream_seek_long(stream_t *str int cache_do_control(stream_t *stream, int cmd, void *arg) { int sleep_count = 0; + int pos_change = 0; cache_vars_t* s = stream->cache_data; switch (cmd) { case STREAM_CTRL_SEEK_TO_TIME: s->control_double_arg = *(double *)arg; s->control = cmd; + pos_change = 1; break; case STREAM_CTRL_SEEK_TO_CHAPTER: case STREAM_CTRL_SET_ANGLE: s->control_uint_arg = *(unsigned *)arg; s->control = cmd; + pos_change = 1; break; // the core might call these every frame, so cache them... case STREAM_CTRL_GET_TIME_LENGTH: @@ -631,6 +644,12 @@ int cache_do_control(stream_t *stream, i return STREAM_UNSUPPORTED; } } + // to avoid unnecessary differences with non-cache behaviour, + // do this also on failure. + if (pos_change) { + stream->pos = s->read_filepos; + stream->eof = s->eof; + } if (s->control_res != STREAM_OK) return s->control_res; switch (cmd) { @@ -645,11 +664,6 @@ int cache_do_control(stream_t *stream, i case STREAM_CTRL_GET_ANGLE: *(unsigned *)arg = s->control_uint_arg; break; - case STREAM_CTRL_SEEK_TO_CHAPTER: - case STREAM_CTRL_SEEK_TO_TIME: - case STREAM_CTRL_SET_ANGLE: - stream->pos = s->read_filepos = s->control_new_pos; - break; } return s->control_res; } From subversion at mplayerhq.hu Fri Dec 23 22:52:04 2011 From: subversion at mplayerhq.hu (reimar) Date: Fri, 23 Dec 2011 22:52:04 +0100 (CET) Subject: [MPlayer-cvslog] r34462 - trunk/stream/stream_cdda.c Message-ID: <20111223215204.A430712A6DB@avserver.banki.hu> Author: reimar Date: Fri Dec 23 22:52:04 2011 New Revision: 34462 Log: cdda: set position to an actual EOF position when we set EOF. This avoids some inconsistency like the stream indicating EOF but a read still returning more data. Modified: trunk/stream/stream_cdda.c Modified: trunk/stream/stream_cdda.c ============================================================================== --- trunk/stream/stream_cdda.c Fri Dec 23 22:50:32 2011 (r34461) +++ trunk/stream/stream_cdda.c Fri Dec 23 22:52:04 2011 (r34462) @@ -182,6 +182,7 @@ static int seek(stream_t* s,off_t newpos sec = s->pos/CD_FRAMESIZE_RAW; if (s->pos < 0 || sec > p->end_sector) { s->eof = 1; + p->sector = p->end_sector + 1; return 0; } @@ -258,7 +259,7 @@ static int control(stream_t *stream, int int seek_sector; track += start_track; if (track > end_track) { - stream->eof = 1; + seek(stream, (p->end_sector + 1) * CD_FRAMESIZE_RAW); return STREAM_ERROR; } seek_sector = track <= 0 ? p->start_sector From subversion at mplayerhq.hu Fri Dec 23 23:34:42 2011 From: subversion at mplayerhq.hu (reimar) Date: Fri, 23 Dec 2011 23:34:42 +0100 (CET) Subject: [MPlayer-cvslog] r34463 - in trunk: DOCS/man/en/mplayer.1 libvo/gl_common.c libvo/gl_common.h libvo/vo_gl.c Message-ID: <20111223223442.F0C7412AAA1@avserver.banki.hu> Author: reimar Date: Fri Dec 23 23:34:42 2011 New Revision: 34463 Log: vo_gl stereo: allow swapping left and right view. Modified: trunk/libvo/gl_common.c trunk/libvo/gl_common.h trunk/libvo/vo_gl.c Changes in other areas also in this revision: Modified: trunk/DOCS/man/en/mplayer.1 Modified: trunk/libvo/gl_common.c ============================================================================== --- trunk/libvo/gl_common.c Fri Dec 23 22:52:04 2011 (r34462) +++ trunk/libvo/gl_common.c Fri Dec 23 23:34:42 2011 (r34463) @@ -1590,6 +1590,8 @@ void glDisableYUVConversion(GLenum targe void glEnable3DLeft(int type) { GLint buffer; + if (type & GL_3D_SWAP) + return glEnable3DRight(type & ~GL_3D_SWAP); switch (type) { case GL_3D_RED_CYAN: mpglColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); @@ -1618,6 +1620,8 @@ void glEnable3DLeft(int type) { void glEnable3DRight(int type) { GLint buffer; + if (type & GL_3D_SWAP) + return glEnable3DLeft(type & ~GL_3D_SWAP); switch (type) { case GL_3D_RED_CYAN: mpglColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE); Modified: trunk/libvo/gl_common.h ============================================================================== --- trunk/libvo/gl_common.h Fri Dec 23 22:52:04 2011 (r34462) +++ trunk/libvo/gl_common.h Fri Dec 23 23:34:42 2011 (r34463) @@ -386,6 +386,7 @@ void glSetupYUVConversion(gl_conversion_ void glEnableYUVConversion(GLenum target, int type); void glDisableYUVConversion(GLenum target, int type); +#define GL_3D_SWAP 32 #define GL_3D_RED_CYAN 1 #define GL_3D_GREEN_MAGENTA 2 #define GL_3D_QUADBUFFER 3 Modified: trunk/libvo/vo_gl.c ============================================================================== --- trunk/libvo/vo_gl.c Fri Dec 23 22:52:04 2011 (r34462) +++ trunk/libvo/vo_gl.c Fri Dec 23 23:34:42 2011 (r34463) @@ -1292,7 +1292,7 @@ static int preinit_internal(const char * " generate mipmaps for the video image (use with TXB in customprog)\n" " osdcolor=<0xAARRGGBB>\n" " use the given color for the OSD\n" - " stereo=\n" + " stereo= (add 32 to swap left and right)\n" " 0: normal display\n" " 1: side-by-side to red-cyan stereo\n" " 2: side-by-side to green-magenta stereo\n" From subversion at mplayerhq.hu Sat Dec 24 11:55:47 2011 From: subversion at mplayerhq.hu (cigaes) Date: Sat, 24 Dec 2011 11:55:47 +0100 (CET) Subject: [MPlayer-cvslog] r34464 - trunk/av_helpers.c Message-ID: <20111224105547.C936312AC89@avserver.banki.hu> Author: cigaes Date: Sat Dec 24 11:55:47 2011 New Revision: 34464 Log: av_helpers: remove obsolete avcodec_init. Modified: trunk/av_helpers.c Modified: trunk/av_helpers.c ============================================================================== --- trunk/av_helpers.c Fri Dec 23 23:34:42 2011 (r34463) +++ trunk/av_helpers.c Sat Dec 24 11:55:47 2011 (r34464) @@ -79,7 +79,6 @@ static void mp_msp_av_log_callback(void void init_avcodec(void) { if (!avcodec_initialized) { - avcodec_init(); avcodec_register_all(); avcodec_initialized = 1; av_log_set_callback(mp_msp_av_log_callback); From subversion at mplayerhq.hu Sat Dec 24 11:55:49 2011 From: subversion at mplayerhq.hu (cigaes) Date: Sat, 24 Dec 2011 11:55:49 +0100 (CET) Subject: [MPlayer-cvslog] r34465 - trunk/av_helpers.c Message-ID: <20111224105549.7023612ACA4@avserver.banki.hu> Author: cigaes Date: Sat Dec 24 11:55:49 2011 New Revision: 34465 Log: av_helpers: show libav* version and configuration. Modified: trunk/av_helpers.c Modified: trunk/av_helpers.c ============================================================================== --- trunk/av_helpers.c Sat Dec 24 11:55:47 2011 (r34464) +++ trunk/av_helpers.c Sat Dec 24 11:55:49 2011 (r34465) @@ -76,9 +76,27 @@ static void mp_msp_av_log_callback(void mp_msg_va(type, mp_level, fmt, vl); } +static void show_av_version(int type, const char *name, + int header_ver, int ver, const char *conf) +{ +#ifdef CONFIG_FFMPEG_SO +#define FFMPEG_TYPE "external" +#else +#define FFMPEG_TYPE "internal" +#endif + mp_msg(type, MSGL_INFO, "%s version %d.%d.%d (" FFMPEG_TYPE ")\n", + name, ver >> 16, (ver >> 8) & 0xFF, ver & 0xFF); + if (header_ver != ver) + mp_msg(type, MSGL_INFO, "Mismatching header version %d.%d.%d\n", + header_ver >> 16, (header_ver >> 8) & 0xFF, header_ver & 0xFF); + mp_msg(type, MSGL_V, "Configuration: %s\n", conf); +} + void init_avcodec(void) { if (!avcodec_initialized) { + show_av_version(MSGT_DECVIDEO, "libavcodec", LIBAVCODEC_VERSION_INT, + avcodec_version(), avcodec_configuration()); avcodec_register_all(); avcodec_initialized = 1; av_log_set_callback(mp_msp_av_log_callback); @@ -88,6 +106,8 @@ void init_avcodec(void) void init_avformat(void) { if (!avformat_initialized) { + show_av_version(MSGT_DEMUX, "libavformat", LIBAVFORMAT_VERSION_INT, + avformat_version(), avformat_configuration()); av_register_all(); avformat_initialized = 1; av_log_set_callback(mp_msp_av_log_callback); From cehoyos at ag.or.at Sat Dec 24 12:35:19 2011 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sat, 24 Dec 2011 11:35:19 +0000 (UTC) Subject: [MPlayer-cvslog] =?utf-8?q?r34465_-_trunk/av=5Fhelpers=2Ec?= References: <20111224105549.7023612ACA4@avserver.banki.hu> Message-ID: cigaes mplayerhq.hu> writes: > Author: cigaes > Date: Sat Dec 24 11:55:49 2011 > New Revision: 34465 > > Log: > av_helpers: show libav* version and configuration. Thank you for this very useful patch, sorry for not commenting earlier! Merry Christmas, Carl Eugen From subversion at mplayerhq.hu Wed Dec 28 15:04:27 2011 From: subversion at mplayerhq.hu (ib) Date: Wed, 28 Dec 2011 15:04:27 +0100 (CET) Subject: [MPlayer-cvslog] r34467 - trunk/stream/stream_cdda.c Message-ID: <20111228140427.BC3E812C131@avserver.banki.hu> Author: ib Date: Wed Dec 28 15:04:27 2011 New Revision: 34467 Log: Allow PARANOIA_MODE_FULL with skipping. Modified: trunk/stream/stream_cdda.c Modified: trunk/stream/stream_cdda.c ============================================================================== --- trunk/stream/stream_cdda.c Sat Dec 24 14:31:49 2011 (r34466) +++ trunk/stream/stream_cdda.c Wed Dec 28 15:04:27 2011 (r34467) @@ -420,6 +420,9 @@ static int open_cdda(stream_t *st,int m, if(p->no_skip) mode |= PARANOIA_MODE_NEVERSKIP; + else + mode &= ~PARANOIA_MODE_NEVERSKIP; + if(p->search_overlap > 0) mode |= PARANOIA_MODE_OVERLAP; else if(p->search_overlap == 0) From subversion at mplayerhq.hu Wed Dec 28 15:14:12 2011 From: subversion at mplayerhq.hu (ib) Date: Wed, 28 Dec 2011 15:14:12 +0100 (CET) Subject: [MPlayer-cvslog] r34468 - trunk/stream/stream_cdda.c Message-ID: <20111228141412.B8AEF12C135@avserver.banki.hu> Author: ib Date: Wed Dec 28 15:14:12 2011 New Revision: 34468 Log: Don't call paranoia_modeset() for PARANOIA_MODE_DISABLE. cdparanoia destroys start sector information after such a call. Since it is pointless without setting a mode anyway, don't do it. Modified: trunk/stream/stream_cdda.c Modified: trunk/stream/stream_cdda.c ============================================================================== --- trunk/stream/stream_cdda.c Wed Dec 28 15:04:27 2011 (r34467) +++ trunk/stream/stream_cdda.c Wed Dec 28 15:14:12 2011 (r34468) @@ -431,7 +431,7 @@ static int open_cdda(stream_t *st,int m, // HACK against libcdparanoia's stupid caching model that // queues up a huge number of requests leading to stuttering paranoia_cachemodel_size(priv->cdp, 24); - paranoia_modeset(cdd, mode); + if (mode != PARANOIA_MODE_DISABLE) paranoia_modeset(cdd, mode); if(p->search_overlap > 0) paranoia_overlapset(cdd,p->search_overlap); From subversion at mplayerhq.hu Thu Dec 29 02:14:48 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Thu, 29 Dec 2011 02:14:48 +0100 (CET) Subject: [MPlayer-cvslog] r34469 - trunk/etc/codecs.conf Message-ID: <20111229011448.8400712BD39@avserver.banki.hu> Author: cehoyos Date: Thu Dec 29 02:14:48 2011 New Revision: 34469 Log: Support the FFmpeg Indeo 4 decoder. Modified: trunk/etc/codecs.conf Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Wed Dec 28 15:14:12 2011 (r34468) +++ trunk/etc/codecs.conf Thu Dec 29 02:14:48 2011 (r34469) @@ -2017,6 +2017,14 @@ videocodec indeo3xa dll "vid_iv32.xa" out YVU9 +videocodec ffindeo4 + info "FFmpeg Indeo 4" + status working + fourcc IV41 + driver ffmpeg + dll indeo4 + out YVU9 + videocodec ffindeo5 info "FFmpeg Indeo 5" status working From subversion at mplayerhq.hu Thu Dec 29 14:59:05 2011 From: subversion at mplayerhq.hu (ib) Date: Thu, 29 Dec 2011 14:59:05 +0100 (CET) Subject: [MPlayer-cvslog] r34470 - in trunk: gui/win32/dialogs.c gui/win32/gui.c help/help_mp-de.h help/help_mp-en.h help/help_mp-zh_CN.h Message-ID: <20111229135905.A735812C610@avserver.banki.hu> Author: ib Date: Thu Dec 29 14:59:05 2011 New Revision: 34470 Log: Rename MSGTR_SelectChapter MSGTR_SelectTitleChapter. This menu allows selecting titles and chapters. Change its definition accordingly. Modified: trunk/gui/win32/dialogs.c trunk/gui/win32/gui.c Changes in other areas also in this revision: Modified: trunk/help/help_mp-de.h trunk/help/help_mp-en.h trunk/help/help_mp-zh_CN.h Modified: trunk/gui/win32/dialogs.c ============================================================================== --- trunk/gui/win32/dialogs.c Thu Dec 29 02:14:48 2011 (r34469) +++ trunk/gui/win32/dialogs.c Thu Dec 29 14:59:05 2011 (r34470) @@ -872,7 +872,7 @@ void display_chapterselwindow(gui_t *gui int x, y; if (guiInfo.StreamType != STREAMTYPE_DVD) return; - if (FindWindow(NULL, acp(MSGTR_SelectChapter))) return; + if (FindWindow(NULL, acp(MSGTR_SelectTitleChapter))) return; wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = TitleChapterWndProc; @@ -882,13 +882,13 @@ void display_chapterselwindow(gui_t *gui wc.hCursor = LoadCursor(NULL,IDC_ARROW); wc.hIcon = gui->icon; wc.hbrBackground = SOLID_GREY2; - wc.lpszClassName = acp(MSGTR_SelectChapter); + wc.lpszClassName = acp(MSGTR_SelectTitleChapter); wc.lpszMenuName = NULL; RegisterClass(&wc); x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (180 / 2); y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (100 / 2); - hWnd = CreateWindow(acp(MSGTR_SelectChapter), - acp(MSGTR_SelectChapter), + hWnd = CreateWindow(acp(MSGTR_SelectTitleChapter), + acp(MSGTR_SelectTitleChapter), WS_POPUPWINDOW | WS_CAPTION, x, y, Modified: trunk/gui/win32/gui.c ============================================================================== --- trunk/gui/win32/gui.c Thu Dec 29 02:14:48 2011 (r34469) +++ trunk/gui/win32/gui.c Thu Dec 29 14:59:05 2011 (r34470) @@ -1260,7 +1260,7 @@ static void create_submenu(gui_t *gui) AppendMenu(gui->submenu, MF_STRING | MF_POPUP, (UINT_PTR) gui->subtitlemenu, acp(MSGTR_MENU_Subtitles)); AppendMenu(gui->submenu, MF_STRING | MF_POPUP, (UINT_PTR) gui->dvdmenu, acp(MSGTR_MENU_DVD)); #ifdef CONFIG_DVDREAD - AppendMenu(gui->dvdmenu, MF_STRING | MF_GRAYED, ID_CHAPTERSEL, acp(MSGTR_SelectChapter)); + AppendMenu(gui->dvdmenu, MF_STRING | MF_GRAYED, ID_CHAPTERSEL, acp(MSGTR_SelectTitleChapter)); #endif AppendMenu(gui->subtitlemenu, MF_STRING, IDSUB_TOGGLE, acp(MSGTR_MENU_SubtitlesOnOff)); AppendMenu(gui->subtitlemenu, MF_STRING, IDSUB_CYCLE, acp(MSGTR_MENU_SubtitleLanguages)); From subversion at mplayerhq.hu Thu Dec 29 17:10:12 2011 From: subversion at mplayerhq.hu (reimar) Date: Thu, 29 Dec 2011 17:10:12 +0100 (CET) Subject: [MPlayer-cvslog] r34471 - trunk/configure Message-ID: <20111229161013.0766F12C526@avserver.banki.hu> Author: reimar Date: Thu Dec 29 17:10:12 2011 New Revision: 34471 Log: Prefer libcdio over cdparanoia by default. cdparanoia is (or at least used to be) less portable and seems to have more major issues (like not being able to work with -nocache, setting mode to 0 explicitly completely breaking track->sector lookup). Modified: trunk/configure Modified: trunk/configure ============================================================================== --- trunk/configure Thu Dec 29 14:59:05 2011 (r34470) +++ trunk/configure Thu Dec 29 17:10:12 2011 (r34471) @@ -5767,24 +5767,8 @@ fi echores "$_libdvdcss_internal" -echocheck "cdparanoia" -if test "$_cdparanoia" = auto ; then - _cdparanoia=no - for inc_tmp in "" "-I/usr/include/cdda" "-I/usr/local/include/cdda" ; do - statement_check_broken cdda_interface.h cdda_paranoia.h 'paranoia_cachemodel_size(NULL, 0)' $inc_tmp -lcdda_interface -lcdda_paranoia && - _cdparanoia=yes && extra_cflags="$extra_cflags $inc_tmp" && break - done -fi -if test "$_cdparanoia" = yes ; then - _cdda='yes' - extra_ldflags="$extra_ldflags -lcdda_interface -lcdda_paranoia" - openbsd && extra_ldflags="$extra_ldflags -lutil" -fi -echores "$_cdparanoia" - - echocheck "libcdio" -if test "$_libcdio" = auto && test "$_cdparanoia" = no ; then +if test "$_libcdio" = auto ; then cat > $TMPC << EOF #include #include @@ -5809,20 +5793,36 @@ EOF extra_ldflags="$extra_ldflags $ld_tmp" && extra_cflags="$extra_cflags $inc_tmp" fi fi -if test "$_libcdio" = yes && test "$_cdparanoia" = no ; then +if test "$_libcdio" = yes ; then _cdda='yes' + _cdparanoia=no def_libcdio='#define CONFIG_LIBCDIO 1' def_havelibcdio='yes' else _libcdio=no - if test "$_cdparanoia" = yes ; then - res_comment="using cdparanoia" - fi def_libcdio='#undef CONFIG_LIBCDIO' def_havelibcdio='no' fi echores "$_libcdio" +echocheck "cdparanoia" +if test "$_cdparanoia" = auto ; then + _cdparanoia=no + for inc_tmp in "" "-I/usr/include/cdda" "-I/usr/local/include/cdda" ; do + statement_check_broken cdda_interface.h cdda_paranoia.h 'paranoia_cachemodel_size(NULL, 0)' $inc_tmp -lcdda_interface -lcdda_paranoia && + _cdparanoia=yes && extra_cflags="$extra_cflags $inc_tmp" && break + done +fi +if test "$_cdparanoia" = yes ; then + _cdda='yes' + extra_ldflags="$extra_ldflags -lcdda_interface -lcdda_paranoia" + openbsd && extra_ldflags="$extra_ldflags -lutil" +elif test "$_libcdio" = yes ; then + res_comment='using libcdio' +fi +echores "$_cdparanoia" + + if test "$_cdda" = yes ; then test $_cddb = auto && test $networking = yes && _cddb=yes def_cdparanoia='#define CONFIG_CDDA 1' From subversion at mplayerhq.hu Thu Dec 29 17:11:58 2011 From: subversion at mplayerhq.hu (reimar) Date: Thu, 29 Dec 2011 17:11:58 +0100 (CET) Subject: [MPlayer-cvslog] r34472 - trunk/stream/stream_cdda.c Message-ID: <20111229161158.A118F12C4FA@avserver.banki.hu> Author: reimar Date: Thu Dec 29 17:11:58 2011 New Revision: 34472 Log: Add comment to a condition that is just a hack around a cdparanoia bug. Modified: trunk/stream/stream_cdda.c Modified: trunk/stream/stream_cdda.c ============================================================================== --- trunk/stream/stream_cdda.c Thu Dec 29 17:10:12 2011 (r34471) +++ trunk/stream/stream_cdda.c Thu Dec 29 17:11:58 2011 (r34472) @@ -431,6 +431,9 @@ static int open_cdda(stream_t *st,int m, // HACK against libcdparanoia's stupid caching model that // queues up a huge number of requests leading to stuttering paranoia_cachemodel_size(priv->cdp, 24); + // For some incomprehensible reason cdparanoia breaks the + // track->sector lookup of calling paranoia_modeset with + // PARANOIA_MODE_DISABLE if (mode != PARANOIA_MODE_DISABLE) paranoia_modeset(cdd, mode); if(p->search_overlap > 0) From subversion at mplayerhq.hu Thu Dec 29 20:42:59 2011 From: subversion at mplayerhq.hu (cehoyos) Date: Thu, 29 Dec 2011 20:42:59 +0100 (CET) Subject: [MPlayer-cvslog] r34473 - trunk/etc/codecs.conf Message-ID: <20111229194259.0D93112C617@avserver.banki.hu> Author: cehoyos Date: Thu Dec 29 20:42:58 2011 New Revision: 34473 Log: Support FFmpeg SMJPEG IMA ADPCM decoding. Patch by Paul B Mahol, onemda gmail Modified: trunk/etc/codecs.conf Modified: trunk/etc/codecs.conf ============================================================================== --- trunk/etc/codecs.conf Thu Dec 29 17:11:58 2011 (r34472) +++ trunk/etc/codecs.conf Thu Dec 29 20:42:58 2011 (r34473) @@ -4283,6 +4283,13 @@ audiocodec ffadpcmimaamv driver ffmpeg dll adpcm_ima_amv +audiocodec ffadpcmimasmjpeg + info "FFmpeg SMJPEG IMA ADPCM audio" + status working + fourcc APCM + driver ffmpeg + dll adpcm_ima_smjpeg + audiocodec ffadpcmimaqt info "FFmpeg QT IMA ADPCM audio" status working From subversion at mplayerhq.hu Sat Dec 31 13:20:09 2011 From: subversion at mplayerhq.hu (ib) Date: Sat, 31 Dec 2011 13:20:09 +0100 (CET) Subject: [MPlayer-cvslog] r34474 - in trunk: DOCS/tech/slave.txt command.c libmpdemux/demuxer.h stream/stream.h stream/stream_cdda.c stream/stream_dvd.c stream/stream_vcd.c Message-ID: <20111231122009.1E42D12CE0F@avserver.banki.hu> Author: ib Date: Sat Dec 31 13:20:08 2011 New Revision: 34474 Log: Add new stream control command STREAM_CTRL_GET_NUM_TITLES. This provides the total number of titles (aka tracks) of CDs / VCDs / DVDs. Additionally, add a titles property to the get_property slave command. Modified: trunk/DOCS/tech/slave.txt trunk/command.c trunk/libmpdemux/demuxer.h trunk/stream/stream.h trunk/stream/stream_cdda.c trunk/stream/stream_dvd.c trunk/stream/stream_vcd.c Modified: trunk/DOCS/tech/slave.txt ============================================================================== --- trunk/DOCS/tech/slave.txt Thu Dec 29 20:42:58 2011 (r34473) +++ trunk/DOCS/tech/slave.txt Sat Dec 31 13:20:08 2011 (r34474) @@ -530,6 +530,7 @@ stream_start pos 0 stream_end pos 0 X end pos in stream stream_length pos 0 X (end - start) stream_time_pos time 0 X present position in stream (in seconds) +titles int X number of titles chapter int 0 X X X select chapter chapters int X number of chapters angle int 0 X X X select angle Modified: trunk/command.c ============================================================================== --- trunk/command.c Thu Dec 29 20:42:58 2011 (r34473) +++ trunk/command.c Sat Dec 31 13:20:08 2011 (r34474) @@ -515,6 +515,17 @@ static int mp_property_chapter(m_option_ return M_PROPERTY_OK; } +/// Number of titles in file +static int mp_property_titles(m_option_t *prop, int action, void *arg, + MPContext *mpctx) +{ + if (!mpctx->demuxer) + return M_PROPERTY_UNAVAILABLE; + if (mpctx->demuxer->num_titles == 0) + stream_control(mpctx->demuxer->stream, STREAM_CTRL_GET_NUM_TITLES, &mpctx->demuxer->num_titles); + return m_property_int_ro(prop, action, arg, mpctx->demuxer->num_titles); +} + /// Number of chapters in file static int mp_property_chapters(m_option_t *prop, int action, void *arg, MPContext *mpctx) @@ -2142,6 +2153,8 @@ static const m_option_t mp_properties[] M_OPT_MIN, 0, 0, NULL }, { "chapter", mp_property_chapter, CONF_TYPE_INT, M_OPT_MIN, 0, 0, NULL }, + { "titles", mp_property_titles, CONF_TYPE_INT, + 0, 0, 0, NULL }, { "chapters", mp_property_chapters, CONF_TYPE_INT, 0, 0, 0, NULL }, { "angle", mp_property_angle, CONF_TYPE_INT, Modified: trunk/libmpdemux/demuxer.h ============================================================================== --- trunk/libmpdemux/demuxer.h Thu Dec 29 20:42:58 2011 (r34473) +++ trunk/libmpdemux/demuxer.h Sat Dec 31 13:20:08 2011 (r34474) @@ -263,6 +263,8 @@ typedef struct demuxer { // pointer to teletext decoder private data, if demuxer stream contains teletext void *teletext; + int num_titles; + demux_chapter_t* chapters; int num_chapters; Modified: trunk/stream/stream.h ============================================================================== --- trunk/stream/stream.h Thu Dec 29 20:42:58 2011 (r34473) +++ trunk/stream/stream.h Sat Dec 31 13:20:08 2011 (r34474) @@ -98,6 +98,7 @@ #define STREAM_CTRL_GET_NUM_ANGLES 9 #define STREAM_CTRL_GET_ANGLE 10 #define STREAM_CTRL_SET_ANGLE 11 +#define STREAM_CTRL_GET_NUM_TITLES 12 typedef enum { Modified: trunk/stream/stream_cdda.c ============================================================================== --- trunk/stream/stream_cdda.c Thu Dec 29 20:42:58 2011 (r34473) +++ trunk/stream/stream_cdda.c Sat Dec 31 13:20:08 2011 (r34474) @@ -243,6 +243,11 @@ static int get_track_by_sector(cdda_priv static int control(stream_t *stream, int cmd, void *arg) { cdda_priv* p = stream->priv; switch(cmd) { + case STREAM_CTRL_GET_NUM_TITLES: + { + *(unsigned int *)arg = p->cd->tracks; + return STREAM_OK; + } case STREAM_CTRL_GET_NUM_CHAPTERS: { int start_track = get_track_by_sector(p, p->start_sector); Modified: trunk/stream/stream_dvd.c ============================================================================== --- trunk/stream/stream_dvd.c Thu Dec 29 20:42:58 2011 (r34473) +++ trunk/stream/stream_dvd.c Sat Dec 31 13:20:08 2011 (r34474) @@ -665,6 +665,11 @@ static int control(stream_t *stream,int *((double *)arg) = (double) mp_get_titleset_length(d->vts_file, d->tt_srpt, d->cur_title-1)/1000.0; return 1; } + case STREAM_CTRL_GET_NUM_TITLES: + { + *((unsigned int *)arg) = d->vmg_file->tt_srpt->nr_of_srpts; + return 1; + } case STREAM_CTRL_GET_NUM_CHAPTERS: { int r; Modified: trunk/stream/stream_vcd.c ============================================================================== --- trunk/stream/stream_vcd.c Thu Dec 29 20:42:58 2011 (r34473) +++ trunk/stream/stream_vcd.c Sat Dec 31 13:20:08 2011 (r34474) @@ -92,6 +92,7 @@ static int seek(stream_t *s,off_t newpos static int control(stream_t *stream, int cmd, void *arg) { struct stream_priv_s *p = stream->priv; switch(cmd) { + case STREAM_CTRL_GET_NUM_TITLES: case STREAM_CTRL_GET_NUM_CHAPTERS: { mp_vcd_priv_t *vcd = vcd_read_toc(stream->fd); From subversion at mplayerhq.hu Sat Dec 31 13:38:53 2011 From: subversion at mplayerhq.hu (ib) Date: Sat, 31 Dec 2011 13:38:53 +0100 (CET) Subject: [MPlayer-cvslog] r34475 - in trunk: DOCS/xml/de/skin.xml DOCS/xml/en/skin.xml gui/app.c gui/app.h gui/interface.c gui/ui/actions.c gui/ui/gtk/menu.c gui/ui/main.c gui/ui/pixmaps/cd.xpm gui/ui/pixmaps/dvd.xpm gui/ui... Message-ID: <20111231123853.479EF12CE90@avserver.banki.hu> Author: ib Date: Sat Dec 31 13:38:52 2011 New Revision: 34475 Log: Add audio CD playback support to the X11/GTK GUI. (The Win32 GUI already had this support. Add missing - although already used - user event evPlayCD here as well as internal event ivSetCDTrack - although it's unused - for consistency.) Added: trunk/gui/ui/pixmaps/cd.xpm trunk/gui/ui/pixmaps/playcd.xpm Modified: trunk/gui/app.c trunk/gui/app.h trunk/gui/interface.c trunk/gui/ui/actions.c trunk/gui/ui/gtk/menu.c trunk/gui/ui/main.c trunk/gui/ui/pixmaps/dvd.xpm trunk/gui/ui/pixmaps/playdvd.xpm trunk/gui/ui/render.c trunk/gui/util/string.c trunk/gui/win32/skinload.c trunk/gui/win32/skinload.h Changes in other areas also in this revision: Modified: trunk/DOCS/xml/de/skin.xml trunk/DOCS/xml/en/skin.xml trunk/help/help_mp-de.h trunk/help/help_mp-en.h Modified: trunk/gui/app.c ============================================================================== --- trunk/gui/app.c Sat Dec 31 13:20:08 2011 (r34474) +++ trunk/gui/app.c Sat Dec 31 13:38:52 2011 (r34475) @@ -51,6 +51,7 @@ static const evName evNames[] = { { evLoadSubtitle, "evLoadSubtitle" }, { evDropSubtitle, "evDropSubtitle" }, { evPlaylist, "evPlaylist" }, + { evPlayCD, "evPlayCD" }, { evPlayVCD, "evPlayVCD" }, { evPlayDVD, "evPlayDVD" }, { evLoadURL, "evSetURL" }, // legacy Modified: trunk/gui/app.h ============================================================================== --- trunk/gui/app.h Sat Dec 31 13:20:08 2011 (r34474) +++ trunk/gui/app.h Sat Dec 31 13:38:52 2011 (r34475) @@ -37,6 +37,7 @@ #define evLoadSubtitle 38 #define evDropSubtitle 43 #define evPlaylist 10 +#define evPlayCD 48 #define evPlayVCD 40 #define evPlayDVD 39 #define evLoadURL 5013 @@ -84,6 +85,7 @@ #define ivSetDVDTitle 5009 #define ivSetDVDChapter 5010 #define ivSetVCDTrack 5012 +#define ivSetCDTrack 5014 #define ivRedraw 7002 Modified: trunk/gui/interface.c ============================================================================== --- trunk/gui/interface.c Sat Dec 31 13:20:08 2011 (r34474) +++ trunk/gui/interface.c Sat Dec 31 13:38:52 2011 (r34475) @@ -410,6 +410,17 @@ int gui(int what, void *data) case STREAMTYPE_STREAM: break; +#ifdef CONFIG_CDDA + case STREAMTYPE_CDDA: + { + char tmp[512]; + + sprintf(tmp, "cdda://%d", guiInfo.Track); + uiSetFileName(NULL, tmp, STREAMTYPE_CDDA); + } + break; +#endif + #ifdef CONFIG_VCD case STREAMTYPE_VCD: { @@ -611,6 +622,13 @@ int gui(int what, void *data) guiInfo.StreamType = stream->type; switch (guiInfo.StreamType) { +#ifdef CONFIG_CDDA + case STREAMTYPE_CDDA: + guiInfo.Tracks = 0; + stream_control(stream, STREAM_CTRL_GET_NUM_TITLES, &guiInfo.Tracks); + break; +#endif + #ifdef CONFIG_VCD case STREAMTYPE_VCD: guiInfo.Tracks = 0; @@ -772,6 +790,15 @@ int gui(int what, void *data) break; } +#ifdef CONFIG_CDDA + if (guiInfo.StreamType == STREAMTYPE_CDDA) { + uiNext(); + + if (guiInfo.Playing) + break; + } +#endif + if (guiInfo.Playing && (next = listSet(gtkGetNextPlItem, NULL)) && (plLastPlayed != next)) { plLastPlayed = next; uiSetFileName(next->path, next->name, STREAMTYPE_FILE); Modified: trunk/gui/ui/actions.c ============================================================================== --- trunk/gui/ui/actions.c Sat Dec 31 13:20:08 2011 (r34474) +++ trunk/gui/ui/actions.c Sat Dec 31 13:38:52 2011 (r34475) @@ -242,6 +242,11 @@ void uiCurr(void) return; switch (guiInfo.StreamType) { +#ifdef CONFIG_CDDA + case STREAMTYPE_CDDA: + break; +#endif + #ifdef CONFIG_VCD case STREAMTYPE_VCD: break; @@ -281,6 +286,15 @@ void uiPrev(void) return; switch (guiInfo.StreamType) { +#ifdef CONFIG_CDDA + case STREAMTYPE_CDDA: + if (--guiInfo.Track == 0) { + guiInfo.Track = 1; + stop = 1; + } + break; +#endif + #ifdef CONFIG_VCD case STREAMTYPE_VCD: if (--guiInfo.Track == 1) { @@ -335,6 +349,17 @@ void uiNext(void) return; switch (guiInfo.StreamType) { +#ifdef CONFIG_CDDA + case STREAMTYPE_CDDA: + + if (++guiInfo.Track > guiInfo.Tracks) { + guiInfo.Track = guiInfo.Tracks; + stop = 1; + } + + break; +#endif + #ifdef CONFIG_VCD case STREAMTYPE_VCD: Modified: trunk/gui/ui/gtk/menu.c ============================================================================== --- trunk/gui/ui/gtk/menu.c Sat Dec 31 13:20:08 2011 (r34474) +++ trunk/gui/ui/gtk/menu.c Sat Dec 31 13:38:52 2011 (r34475) @@ -66,6 +66,10 @@ #include "gui/ui/pixmaps/empty.xpm" #include "gui/ui/pixmaps/loadeaf.xpm" #include "gui/ui/pixmaps/title.xpm" +#ifdef CONFIG_CDDA +#include "gui/ui/pixmaps/cd.xpm" +#include "gui/ui/pixmaps/playcd.xpm" +#endif #ifdef CONFIG_VCD #include "gui/ui/pixmaps/vcd.xpm" #include "gui/ui/pixmaps/playvcd.xpm" @@ -404,6 +408,8 @@ GtkWidget * DVDSubtitleLanguageMenu; GtkWidget * AspectMenu; GtkWidget * VCDSubMenu; GtkWidget * VCDTitleMenu; +GtkWidget * CDSubMenu; +GtkWidget * CDTitleMenu; GtkWidget * create_PopUpMenu( void ) { @@ -425,6 +431,9 @@ GtkWidget * create_PopUpMenu( void ) AddSeparator( Menu ); SubMenu=AddSubMenu( window1, (const char*)open_xpm, Menu,MSGTR_MENU_Open ); AddMenuItem( window1, (const char*)file2_xpm, SubMenu,MSGTR_MENU_PlayFile" ", evLoadPlay ); +#ifdef CONFIG_CDDA + AddMenuItem( window1, (const char*)playcd_xpm, SubMenu,MSGTR_MENU_PlayCD, evPlayCD ); +#endif #ifdef CONFIG_VCD AddMenuItem( window1, (const char*)playvcd_xpm, SubMenu,MSGTR_MENU_PlayVCD, evPlayVCD ); #endif @@ -450,6 +459,27 @@ GtkWidget * create_PopUpMenu( void ) // AddMenuItem( SubMenu,MSGTR_MENU_NormalSize" ", evNormalSize ); // AddMenuItem( SubMenu,MSGTR_MENU_DoubleSize, evDoubleSize ); // AddMenuItem( SubMenu,MSGTR_MENU_FullScreen, evFullScreen ); +#ifdef CONFIG_CDDA + CDSubMenu=AddSubMenu( window1, (const char*)cd_xpm, Menu,MSGTR_MENU_CD ); + AddMenuItem( window1, (const char*)playcd_xpm, CDSubMenu,MSGTR_MENU_PlayDisc,evPlayCD ); + AddSeparator( CDSubMenu ); + CDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, CDSubMenu,MSGTR_MENU_Titles ); + if ( guiInfo.Tracks ) + { + char tmp[32]; int i; + for ( i=1;i <= guiInfo.Tracks;i++ ) + { + snprintf( tmp,32,MSGTR_MENU_Title,i ); + //AddMenuItem( CDTitleMenu,tmp,( i << 16 ) + ivSetCDTrack ); + AddMenuItem(window1, (const char*)empty_xpm, CDTitleMenu,tmp,( i << 16 ) + ivSetCDTrack ); + } + } + else + { + MenuItem=AddMenuItem( window1, (const char*)empty_xpm, CDTitleMenu,MSGTR_MENU_None,evNone ); + gtk_widget_set_sensitive( MenuItem,FALSE ); + } +#endif #ifdef CONFIG_VCD VCDSubMenu=AddSubMenu( window1, (const char*)vcd_xpm, Menu,MSGTR_MENU_VCD ); AddMenuItem( window1, (const char*)playvcd_xpm, VCDSubMenu,MSGTR_MENU_PlayDisc,evPlayVCD ); Modified: trunk/gui/ui/main.c ============================================================================== --- trunk/gui/ui/main.c Sat Dec 31 13:20:08 2011 (r34474) +++ trunk/gui/ui/main.c Sat Dec 31 13:38:52 2011 (r34475) @@ -162,6 +162,14 @@ void uiEventHandling( int msg,float para mp_property_do("sub",M_PROPERTY_SET,&iparam,guiInfo.mpcontext); break; +#ifdef CONFIG_CDDA + case ivSetCDTrack: + guiInfo.Track=iparam; + case evPlayCD: + guiInfoMediumClear ( CLEAR_ALL ); + guiInfo.StreamType=STREAMTYPE_CDDA; + goto play; +#endif #ifdef CONFIG_VCD case ivSetVCDTrack: guiInfo.Track=iparam; @@ -202,6 +210,19 @@ play: guiInfo.Track=1; guiInfo.NewPlay=GUI_FILE_NEW; break; +#ifdef CONFIG_CDDA + case STREAMTYPE_CDDA: + guiInfoMediumClear( CLEAR_ALL - CLEAR_VCD - CLEAR_FILE ); + if ( !cdrom_device ) cdrom_device=gstrdup( DEFAULT_CDROM_DEVICE ); + uiSetFileName( NULL,cdrom_device,STREAMTYPE_CDDA ); + if ( guiInfo.Playing != GUI_PAUSE ) + { + if ( !guiInfo.Track ) + guiInfo.Track=1; + guiInfo.NewPlay=GUI_FILE_SAME; + } + break; +#endif #ifdef CONFIG_VCD case STREAMTYPE_VCD: guiInfoMediumClear( CLEAR_ALL - CLEAR_VCD - CLEAR_FILE ); Added: trunk/gui/ui/pixmaps/cd.xpm ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/gui/ui/pixmaps/cd.xpm Sat Dec 31 13:38:52 2011 (r34475) @@ -0,0 +1,129 @@ +/* XPM */ +static const char * const cd_xpm[] = { +"16 16 110 2", +" c None", +". c #CACCD2", +"+ c #D3D4D6", +"@ c #D2D2D3", +"# c #D1D1D2", +"$ c #D1D1D3", +"% c #B5B8BD", +"& c #EDEDEC", +"* c #FAFAFA", +"= c #FBFBFB", +"- c #FCFCFC", +"; c #FFFFFF", +"> c #D9D9D9", +", c #AFB1B5", +"' c #C6C6C7", +") c #FDFDFD", +"! c #F7F7F7", +"~ c #F9F9F9", +"{ c #F6F6F6", +"] c #F8F8F8", +"^ c #B8B9BD", +"/ c #B2B4BA", +"( c #EAE9E9", +"_ c #DCDCDC", +": c #F3F3F3", +"< c #F4F4F4", +"[ c #A8AAAF", +"} c #CBCBCA", +"| c #CCCCCC", +"1 c #D7D7D7", +"2 c #E1E1E1", +"3 c #F5F5F5", +"4 c #EFEFEF", +"5 c #CCCDCE", +"6 c #D2D2D2", +"7 c #CDCDCD", +"8 c #D6D6D6", +"9 c #E0E0E0", +"0 c #E7E7E7", +"a c #E6E6E6", +"b c #E5E5E5", +"c c #EBEBEB", +"d c #E3E3E3", +"e c #ECECEC", +"f c #9C9DA5", +"g c #C4C5C9", +"h c #C1C1C1", +"i c #CECECE", +"j c #E2E2E2", +"k c #E8E8E8", +"l c #D8D8D8", +"m c #E4E4E3", +"n c #DBDBDB", +"o c #F2F2F2", +"p c #DDDDDD", +"q c #D4D4D4", +"r c #A2A4AA", +"s c #C9CACC", +"t c #C4C4C4", +"u c #CFCFCF", +"v c #E4E4E4", +"w c #DBDAD9", +"x c #727789", +"y c #DFDEDD", +"z c #C8C8C8", +"A c #BCBCBC", +"B c #BFBFBF", +"C c #9E9FA4", +"D c #C6C7C9", +"E c #E2E2E1", +"F c #999CA6", +"G c #C5C5C4", +"H c #D3D3D3", +"I c #C7C7C7", +"J c #BBBBBB", +"K c #BABABA", +"L c #C4C4C3", +"M c #95969A", +"N c #C4C5C6", +"O c #D8D8D7", +"P c #CACACA", +"Q c #C6C6C6", +"R c #B9B9B9", +"S c #CCCCCB", +"T c #939395", +"U c #A0A2A7", +"V c #E5E5E4", +"W c #FEFEFE", +"X c #C5C5C5", +"Y c #C2C2C2", +"Z c #B8B8B8", +"` c #BCBBBA", +" . c #A3A6AD", +".. c #9B9C9F", +"+. c #F0F0F0", +"@. c #C0C0C0", +"#. c #7C7E84", +"$. c #EAEAEA", +"%. c #979798", +"&. c #989BA2", +"*. c #E9E9E9", +"=. c #959596", +"-. c #A6A8AD", +";. c #B7B7B5", +">. c #B4B4B3", +",. c #8B8D92", +"'. c #9B9DA0", +"). c #B6B6B7", +"!. c #B0B0B1", +"~. c #929396", +" . + @ # $ ", +" % & * = = = - ; > , ", +" ' ) ! ~ ~ ~ { ] * = ) ^ ", +" / ( _ : ! ] ! < ! ] ) ) = [ ", +" } | 1 2 { ] ! : 3 - - 3 4 5 ", +" 6 7 8 9 0 ] a b ) = : c d e f ", +"g h i 1 j k 6 l m n o 0 p q 2 r ", +"s t u n v _ w x y p 8 z A B C ", +"D 8 l 2 k d E F ^ G H I J K L M ", +"N v j k e = _ O 6 P Q A R K S T ", +"U V k c ; W 3 > ! 6 X Y R Z ` .", +" ..+.; : : > : : : X X h @.#. ", +" 1 = : > : : : : $.X I %. ", +" &.Q a > : : +.v *.< =. ", +" -.;.P j k p >.,. ", +" '.).!.~. "}; Modified: trunk/gui/ui/pixmaps/dvd.xpm ============================================================================== --- trunk/gui/ui/pixmaps/dvd.xpm Sat Dec 31 13:20:08 2011 (r34474) +++ trunk/gui/ui/pixmaps/dvd.xpm Sat Dec 31 13:38:52 2011 (r34475) @@ -1,129 +1,120 @@ /* XPM */ static const char * const dvd_xpm[] = { -"16 16 110 2", -" c None", -". c #CACCD2", -"+ c #D3D4D6", -"@ c #D2D2D3", -"# c #D1D1D2", -"$ c #D1D1D3", -"% c #B5B8BD", -"& c #EDEDEC", -"* c #FAFAFA", -"= c #FBFBFB", -"- c #FCFCFC", -"; c #FFFFFF", -"> c #D9D9D9", -", c #AFB1B5", -"' c #C6C6C7", -") c #FDFDFD", -"! c #F7F7F7", -"~ c #F9F9F9", -"{ c #F6F6F6", -"] c #F8F8F8", -"^ c #B8B9BD", -"/ c #B2B4BA", -"( c #EAE9E9", -"_ c #DCDCDC", -": c #F3F3F3", -"< c #F4F4F4", -"[ c #A8AAAF", -"} c #CBCBCA", -"| c #CCCCCC", -"1 c #D7D7D7", -"2 c #E1E1E1", -"3 c #F5F5F5", -"4 c #EFEFEF", -"5 c #CCCDCE", -"6 c #D2D2D2", -"7 c #CDCDCD", -"8 c #D6D6D6", -"9 c #E0E0E0", -"0 c #E7E7E7", -"a c #E6E6E6", -"b c #E5E5E5", -"c c #EBEBEB", -"d c #E3E3E3", -"e c #ECECEC", -"f c #9C9DA5", -"g c #C4C5C9", -"h c #C1C1C1", -"i c #CECECE", -"j c #E2E2E2", -"k c #E8E8E8", -"l c #D8D8D8", -"m c #E4E4E3", -"n c #DBDBDB", -"o c #F2F2F2", -"p c #DDDDDD", -"q c #D4D4D4", -"r c #A2A4AA", -"s c #C9CACC", -"t c #C4C4C4", -"u c #CFCFCF", -"v c #E4E4E4", -"w c #DBDAD9", -"x c #727789", -"y c #DFDEDD", -"z c #C8C8C8", -"A c #BCBCBC", -"B c #BFBFBF", -"C c #9E9FA4", -"D c #C6C7C9", -"E c #E2E2E1", -"F c #999CA6", -"G c #C5C5C4", -"H c #D3D3D3", -"I c #C7C7C7", -"J c #BBBBBB", -"K c #BABABA", -"L c #C4C4C3", -"M c #95969A", -"N c #C4C5C6", -"O c #D8D8D7", -"P c #CACACA", -"Q c #C6C6C6", -"R c #B9B9B9", -"S c #CCCCCB", -"T c #939395", -"U c #A0A2A7", -"V c #E5E5E4", -"W c #FEFEFE", -"X c #C5C5C5", -"Y c #C2C2C2", -"Z c #B8B8B8", -"` c #BCBBBA", -" . c #A3A6AD", -".. c #9B9C9F", -"+. c #F0F0F0", -"@. c #C0C0C0", -"#. c #7C7E84", -"$. c #EAEAEA", -"%. c #979798", -"&. c #989BA2", -"*. c #E9E9E9", -"=. c #959596", -"-. c #A6A8AD", -";. c #B7B7B5", -">. c #B4B4B3", -",. c #8B8D92", -"'. c #9B9DA0", -"). c #B6B6B7", -"!. c #B0B0B1", -"~. c #929396", -" . + @ # $ ", -" % & * = = = - ; > , ", -" ' ) ! ~ ~ ~ { ] * = ) ^ ", -" / ( _ : ! ] ! < ! ] ) ) = [ ", -" } | 1 2 { ] ! : 3 - - 3 4 5 ", -" 6 7 8 9 0 ] a b ) = : c d e f ", -"g h i 1 j k 6 l m n o 0 p q 2 r ", -"s t u n v _ w x y p 8 z A B C ", -"D 8 l 2 k d E F ^ G H I J K L M ", -"N v j k e = _ O 6 P Q A R K S T ", -"U V k c ; W 3 > ! 6 X Y R Z ` .", -" ..+.; : : > : : : X X h @.#. ", -" 1 = : > : : : : $.X I %. ", -" &.Q a > : : +.v *.< =. ", -" -.;.P j k p >.,. ", -" '.).!.~. "}; +"16 16 100 2", +" c #000000", +"! c #7277FF", +"# c #7C7EFF", +"$ c #8B8DFF", +"% c #9293FF", +"& c #9393FF", +"' c #9595FF", +"( c #9596FF", +") c #9797FF", +"* c #989BFF", +"+ c #999CFF", +", c #9B9CFF", +"- c #9B9DFF", +". c #9C9DFF", +"/ c #9E9FFF", +"0 c #A0A2FF", +"1 c #A2A4FF", +"2 c #A3A6FF", +"3 c #A6A8FF", +"4 c #A8AAFF", +"5 c #B0B0FF", +"6 c #AFB1FF", +"7 c #B2B4FF", +"8 c #B4B4FF", +"9 c #B6B6FF", +": c #B7B7FF", +"; c #B5B8FF", +"< c #B8B8FF", +"= c #B8B9FF", +"> c #B9B9FF", +"? c #BABAFF", +"@ c #BBBBFF", +"A c #BCBBFF", +"B c #BCBCFF", +"C c #BFBFFF", +"D c #C0C0FF", +"E c #C1C1FF", +"F c #C2C2FF", +"G c #C4C4FF", +"H c #C4C5FF", +"I c #C5C5FF", +"J c #C6C6FF", +"K c #C6C7FF", +"L c #C7C7FF", +"M c #C8C8FF", +"N c #C9CAFF", +"O c #CACAFF", +"P c #CBCBFF", +"Q c #CACCFF", +"R c #CCCCFF", +"S c #CCCDFF", +"T c #CDCDFF", +"U c #CECEFF", +"V c #CFCFFF", +"W c #D1D1FF", +"X c #D2D2FF", +"Y c #D3D3FF", +"Z c #D3D4FF", +"[ c #D4D4FF", +"[] c #D6D6FF", +"] c #D7D7FF", +"^ c #D8D8FF", +"_ c #D9D9FF", +"` c #DBDAFF", +"a c #DBDBFF", +"b c #DCDCFF", +"c c #DDDDFF", +"d c #DFDEFF", +"e c #E0E0FF", +"f c #E1E1FF", +"g c #E2E2FF", +"h c #E3E3FF", +"i c #E4E4FF", +"j c #E5E5FF", +"k c #E6E6FF", +"l c #E7E7FF", +"m c #E8E8FF", +"n c #E9E9FF", +"o c #EAE9FF", +"p c #EAEAFF", +"q c #EBEBFF", +"r c #ECECFF", +"s c #EDEDFF", +"t c #EFEFFF", +"u c #F0F0FF", +"v c #F2F2FF", +"w c #F3F3FF", +"x c #F4F4FF", +"y c #F5F5FF", +"z c #F6F6FF", +"{ c #F7F7FF", +"| c #F8F8FF", +"} c #F9F9FF", +"~ c #FAFAFF", +" ! c #FBFBFF", +"!! c #FCFCFF", +"#! c #FDFDFF", +"$! c #FEFEFF", +"%! c #FFFFFF", +"&! c None", +"&!&!&!&!&!Q Z X W W &!&!&!&!&!&!", +"&!&!&!; s ~ ! ! !!!%!_ 6 &!&!&!", +"&!&!J #!{ } } } z | ~ !#!= &!&!", +"&!7 o b w { | { x { | #!#! !4 &!", +"&!P R ] f z | { w y !!!!y t S &!", +"&!X T []e l | k j #! !w q h r . ", +"H E U ] g m X ^ i a v l c [ f 1 ", +"N G V a i b ` &!! d c []M B C / ", +"K []^ f m h g + = I Y L @ ? G ( ", +"H i g m r !b ^ X O J B > ? R & ", +"0 j m q %!$!y _ { X I F > < A 2 ", +"&!, u %!w w _ w w w I I E D # &!", +"&!&!] !w _ w w w w p I L ) &!&!", +"&!&!* J k _ w w u i n x ' &!&!&!", +"&!&!&!&!3 : O g m c 8 $ &!&!&!&!", +"&!&!&!&!&!&!- 9 5 % &!&!&!&!&!&!" +}; Added: trunk/gui/ui/pixmaps/playcd.xpm ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/gui/ui/pixmaps/playcd.xpm Sat Dec 31 13:38:52 2011 (r34475) @@ -0,0 +1,137 @@ +/* XPM */ +static const char * const playcd_xpm[] = { +"16 16 118 2", +" c None", +". c #CACCD2", +"+ c #D3D4D6", +"@ c #D2D2D3", +"# c #D1D1D2", +"$ c #D1D1D3", +"% c #B5B8BD", +"& c #EDEDEC", +"* c #FAFAFA", +"= c #FBFBFB", +"- c #FCFCFC", +"; c #FFFFFF", +"> c #D9D9D9", +", c #AFB1B5", +"' c #C6C6C7", +") c #FDFDFD", +"! c #F7F7F7", +"~ c #F9F9F9", +"{ c #F6F6F6", +"] c #F8F8F8", +"^ c #B8B9BD", +"/ c #B2B4BA", +"( c #EAE9E9", +"_ c #DCDCDC", +": c #F3F3F3", +"< c #F4F4F4", +"[ c #A8AAAF", +"} c #CBCBCA", +"| c #CCCCCC", +"1 c #D7D7D7", +"2 c #E1E1E1", +"3 c #F5F5F5", +"4 c #EFEFEF", +"5 c #CCCDCE", +"6 c #D2D2D2", +"7 c #CDCDCD", +"8 c #D6D6D6", +"9 c #E0E0E0", +"0 c #E7E7E7", +"a c #E6E6E6", +"b c #E5E5E5", +"c c #EBEBEB", +"d c #E3E3E3", +"e c #ECECEC", +"f c #9C9DA5", +"g c #C4C5C9", +"h c #C1C1C1", +"i c #CECECE", +"j c #E2E2E2", +"k c #E8E8E8", +"l c #D8D8D8", +"m c #E4E4E3", +"n c #DBDBDB", +"o c #F2F2F2", +"p c #404040", +"q c #DDDDDD", +"r c #D4D4D4", +"s c #A2A4AA", +"t c #C9CACC", +"u c #C4C4C4", +"v c #CFCFCF", +"w c #E4E4E4", +"x c #DBDAD9", +"y c #727789", +"z c #DFDEDD", +"A c #292828", +"B c #373737", +"C c #BCBCBC", +"D c #BFBFBF", +"E c #9E9FA4", +"F c #C6C7C9", +"G c #E2E2E1", +"H c #999CA6", +"I c #C5C5C4", +"J c #D3D3D3", +"K c #313131", +"L c #747472", +"M c #5C5C5C", +"N c #C4C4C3", +"O c #95969A", +"P c #C4C5C6", +"Q c #D8D8D7", +"R c #CACACA", +"S c #C6C6C6", +"T c #343333", +"U c #A1A09E", +"V c #939290", +"W c #939395", +"X c #A0A2A7", +"Y c #E5E5E4", +"Z c #FEFEFE", +"` c #C5C5C5", +" . c #363635", +".. c #A7A6A3", +"+. c #B8B7B4", +"@. c #91908E", +"#. c #9B9C9F", +"$. c #F0F0F0", +"%. c #383737", +"&. c #B0AFAC", +"*. c #C8C7C4", +"=. c #5A5A59", +"-. c #EAEAEA", +";. c #3E3D3D", +">. c #BEBCB9", +",. c #151414", +"'. c #989BA2", +"). c #E9E9E9", +"!. c #41403F", +"~. c #696867", +"{. c #A6A8AD", +"]. c #B7B7B5", +"^. c #B4B4B3", +"/. c #0A0A0A", +"(. c #9B9DA0", +"_. c #B6B6B7", +":. c #B0B0B1", +"<. c #929396", +" . + @ # $ ", +" % & * = = = - ; > , ", +" ' ) ! ~ ~ ~ { ] * = ) ^ ", +" / ( _ : ! ] ! < ! ] ) ) = [ ", +" } | 1 2 { ] ! : 3 - - 3 4 5 ", +" 6 7 8 9 0 ] a b ) = : c d e f ", +"g h i 1 j k 6 l m n o p q r 2 s ", +"t u v n w _ x y z q A B C D E ", +"F 8 l 2 k d G H ^ I J K L M N O ", +"P w j k e = _ Q 6 R S T U V M W ", +"X Y k c ; Z 3 > ! 6 ` ...+. at .M ", +" #.$.; : : > : : : ` %.&.*.=. ", +" 1 = : > : : : : -.;.>.,. ", +" '.S a > : : $.w ).!.~.Z ", +" {.].R j k q ^./.; ", +" (._.:.<. D "}; Modified: trunk/gui/ui/pixmaps/playdvd.xpm ============================================================================== --- trunk/gui/ui/pixmaps/playdvd.xpm Sat Dec 31 13:20:08 2011 (r34474) +++ trunk/gui/ui/pixmaps/playdvd.xpm Sat Dec 31 13:38:52 2011 (r34475) @@ -1,137 +1,129 @@ /* XPM */ static const char * const playdvd_xpm[] = { -"16 16 118 2", -" c None", -". c #CACCD2", -"+ c #D3D4D6", -"@ c #D2D2D3", -"# c #D1D1D2", -"$ c #D1D1D3", -"% c #B5B8BD", -"& c #EDEDEC", -"* c #FAFAFA", -"= c #FBFBFB", -"- c #FCFCFC", -"; c #FFFFFF", -"> c #D9D9D9", -", c #AFB1B5", -"' c #C6C6C7", -") c #FDFDFD", -"! c #F7F7F7", -"~ c #F9F9F9", -"{ c #F6F6F6", -"] c #F8F8F8", -"^ c #B8B9BD", -"/ c #B2B4BA", -"( c #EAE9E9", -"_ c #DCDCDC", -": c #F3F3F3", -"< c #F4F4F4", -"[ c #A8AAAF", -"} c #CBCBCA", -"| c #CCCCCC", -"1 c #D7D7D7", -"2 c #E1E1E1", -"3 c #F5F5F5", -"4 c #EFEFEF", -"5 c #CCCDCE", -"6 c #D2D2D2", -"7 c #CDCDCD", -"8 c #D6D6D6", -"9 c #E0E0E0", -"0 c #E7E7E7", -"a c #E6E6E6", -"b c #E5E5E5", -"c c #EBEBEB", -"d c #E3E3E3", -"e c #ECECEC", -"f c #9C9DA5", -"g c #C4C5C9", -"h c #C1C1C1", -"i c #CECECE", -"j c #E2E2E2", -"k c #E8E8E8", -"l c #D8D8D8", -"m c #E4E4E3", -"n c #DBDBDB", -"o c #F2F2F2", -"p c #404040", -"q c #DDDDDD", -"r c #D4D4D4", -"s c #A2A4AA", -"t c #C9CACC", -"u c #C4C4C4", -"v c #CFCFCF", -"w c #E4E4E4", -"x c #DBDAD9", -"y c #727789", -"z c #DFDEDD", -"A c #292828", -"B c #373737", -"C c #BCBCBC", -"D c #BFBFBF", -"E c #9E9FA4", -"F c #C6C7C9", -"G c #E2E2E1", -"H c #999CA6", -"I c #C5C5C4", -"J c #D3D3D3", -"K c #313131", -"L c #747472", -"M c #5C5C5C", -"N c #C4C4C3", -"O c #95969A", -"P c #C4C5C6", -"Q c #D8D8D7", -"R c #CACACA", -"S c #C6C6C6", -"T c #343333", -"U c #A1A09E", -"V c #939290", -"W c #939395", -"X c #A0A2A7", -"Y c #E5E5E4", -"Z c #FEFEFE", -"` c #C5C5C5", -" . c #363635", -".. c #A7A6A3", -"+. c #B8B7B4", -"@. c #91908E", -"#. c #9B9C9F", -"$. c #F0F0F0", -"%. c #383737", -"&. c #B0AFAC", -"*. c #C8C7C4", -"=. c #5A5A59", -"-. c #EAEAEA", -";. c #3E3D3D", -">. c #BEBCB9", -",. c #151414", -"'. c #989BA2", -"). c #E9E9E9", -"!. c #41403F", -"~. c #696867", -"{. c #A6A8AD", -"]. c #B7B7B5", -"^. c #B4B4B3", -"/. c #0A0A0A", -"(. c #9B9DA0", -"_. c #B6B6B7", -":. c #B0B0B1", -"<. c #929396", -" . + @ # $ ", -" % & * = = = - ; > , ", -" ' ) ! ~ ~ ~ { ] * = ) ^ ", -" / ( _ : ! ] ! < ! ] ) ) = [ ", -" } | 1 2 { ] ! : 3 - - 3 4 5 ", -" 6 7 8 9 0 ] a b ) = : c d e f ", -"g h i 1 j k 6 l m n o p q r 2 s ", -"t u v n w _ x y z q A B C D E ", -"F 8 l 2 k d G H ^ I J K L M N O ", -"P w j k e = _ Q 6 R S T U V M W ", -"X Y k c ; Z 3 > ! 6 ` ...+. at .M ", -" #.$.; : : > : : : ` %.&.*.=. ", -" 1 = : > : : : : -.;.>.,. ", -" '.S a > : : $.w ).!.~.Z ", -" {.].R j k q ^./.; ", -" (._.:.<. D "}; +"16 16 109 2", +" c #000000", +"! c #0A0A0A", +"# c #151414", +"$ c #292828", +"% c #313131", +"& c #343333", +"' c #363635", +"( c #373737", +") c #383737", +"* c #3E3D3D", +"+ c #41403F", +", c #404040", +"- c #5A5A59", +". c #5C5C5C", +"/ c #696867", +"0 c #747472", +"1 c #91908E", +"2 c #939290", +"3 c #A1A09E", +"4 c #A7A6A3", +"5 c #B0AFAC", +"6 c #B8B7B4", +"7 c #BEBCB9", +"8 c #C8C7C4", +"9 c #7277FF", +": c #9293FF", +"; c #9393FF", +"< c #9596FF", +"= c #989BFF", +"> c #999CFF", +"? c #9B9CFF", +"@ c #9B9DFF", +"A c #9C9DFF", +"B c #9E9FFF", +"C c #A0A2FF", +"D c #A2A4FF", +"E c #A6A8FF", +"F c #A8AAFF", +"G c #B0B0FF", +"H c #AFB1FF", +"I c #B2B4FF", +"J c #B4B4FF", +"K c #B6B6FF", +"L c #B7B7FF", +"M c #B5B8FF", +"N c #B8B9FF", +"O c #BCBCFF", +"P c #BFBFFF", +"Q c #C1C1FF", +"R c #C4C4FF", +"S c #C4C5FF", +"T c #C5C5FF", +"U c #C6C6FF", +"V c #C6C7FF", +"W c #C9CAFF", +"X c #CACAFF", +"Y c #CBCBFF", +"Z c #CACCFF", +"[ c #CCCCFF", +"[] c #CCCDFF", +"] c #CDCDFF", +"^ c #CECEFF", +"_ c #CFCFFF", +"` c #D1D1FF", +"a c #D2D2FF", +"b c #D3D3FF", +"c c #D3D4FF", +"d c #D4D4FF", +"e c #D6D6FF", +"f c #D7D7FF", +"g c #D8D8FF", +"h c #D9D9FF", +"i c #DBDAFF", +"j c #DBDBFF", +"k c #DCDCFF", +"l c #DDDDFF", +"m c #DFDEFF", +"n c #E0E0FF", +"o c #E1E1FF", +"p c #E2E2FF", +"q c #E3E3FF", +"r c #E4E4FF", +"s c #E5E5FF", +"t c #E6E6FF", +"u c #E7E7FF", +"v c #E8E8FF", +"w c #E9E9FF", +"x c #EAE9FF", +"y c #EAEAFF", +"z c #EBEBFF", +"{ c #ECECFF", +"| c #EDEDFF", +"} c #EFEFFF", +"~ c #F0F0FF", +" ! c #F2F2FF", +"!! c #F3F3FF", +"#! c #F4F4FF", +"$! c #F5F5FF", +"%! c #F6F6FF", +"&! c #F7F7FF", +"'! c #F8F8FF", +"(! c #F9F9FF", +")! c #FAFAFF", +"*! c #FBFBFF", +"+! c #FCFCFF", +",! c #FDFDFF", +"-! c #FEFEFF", +".! c #FFFFFF", +"/! c None", +"/!/!/!/!/!Z c a ` ` /!/!/!/!/!/!", +"/!/!/!M | )!*!*!*!+!.!h H /!/!/!", +"/!/!U ,!&!(!(!(!%!'!)!*!,!N /!/!", +"/!I x k !!&!'!&!#!&!'!,!,!*!F /!", +"/!Y [ f o %!'!&!!!$!+!+!$!} []/!", +"/!a ] e n u '!t s ,!*!!!z q { A ", +"S Q ^ f p v a g r j !, l d o D ", +"W R _ j r k i /!9 m l $ ( O P B ", +"V e g o v q p > N T b % 0 . R < ", +"S r p v { *!k g a X U & 3 2 . ; ", +"C s v z .!-!$!h &!a T ' 4 6 1 . ", +"/!? ~ .!!!!!h !!!!!!T ) 5 8 - /!", +"/!/!f *!!!h !!!!!!!!y * 7 # /!/!", +"/!/!= U t h !!!!~ r w + / -!/!/!", +"/!/!/!/!E L X p v l J ! .!/!/!/!", +"/!/!/!/!/!/!@ K G : /!P /!/!/!/!" +}; Modified: trunk/gui/ui/render.c ============================================================================== --- trunk/gui/ui/render.c Sat Dec 31 13:20:08 2011 (r34474) +++ trunk/gui/ui/render.c Sat Dec 31 13:38:52 2011 (r34475) @@ -206,6 +206,12 @@ calclengthmmmmss: av_strlcat(trbuf, "u", sizeof(trbuf)); break; +#ifdef CONFIG_CDDA + case STREAMTYPE_CDDA: + av_strlcat(trbuf, "a", sizeof(trbuf)); + break; +#endif + #ifdef CONFIG_VCD case STREAMTYPE_VCD: av_strlcat(trbuf, "v", sizeof(trbuf)); Modified: trunk/gui/util/string.c ============================================================================== --- trunk/gui/util/string.c Sat Dec 31 13:20:08 2011 (r34474) +++ trunk/gui/util/string.c Sat Dec 31 13:38:52 2011 (r34475) @@ -283,6 +283,12 @@ char *TranslateFilename(int how, char *f av_strlcpy(fname, guiInfo.Filename, maxlen); break; +#ifdef CONFIG_CDDA + case STREAMTYPE_CDDA: + snprintf(fname, maxlen, MSGTR_Title, guiInfo.Track); + break; +#endif + #ifdef CONFIG_VCD case STREAMTYPE_VCD: snprintf(fname, maxlen, MSGTR_Title, guiInfo.Track - 1); Modified: trunk/gui/win32/skinload.c ============================================================================== --- trunk/gui/win32/skinload.c Sat Dec 31 13:20:08 2011 (r34474) +++ trunk/gui/win32/skinload.c Sat Dec 31 13:38:52 2011 (r34475) @@ -57,6 +57,7 @@ static const evName evNames[] = { evLoadSubtitle, "evLoadSubtitle" }, { evDropSubtitle, "evDropSubtitle" }, { evPlaylist, "evPlaylist" }, + { evPlayCD, "evPlayCD" }, { evPlayVCD, "evPlayVCD" }, { evPlayDVD, "evPlayDVD" }, { evLoadURL, "evSetURL" }, // legacy Modified: trunk/gui/win32/skinload.h ============================================================================== --- trunk/gui/win32/skinload.h Sat Dec 31 13:20:08 2011 (r34474) +++ trunk/gui/win32/skinload.h Sat Dec 31 13:38:52 2011 (r34475) @@ -192,6 +192,7 @@ skin_t *loadskin(char *skindir, int desk #define ivSetDVDTitle 5009 #define ivSetDVDChapter 5010 #define ivSetVCDTrack 5012 +#define ivSetCDTrack 5014 #define ivRedraw 7002 From subversion at mplayerhq.hu Sat Dec 31 13:45:46 2011 From: subversion at mplayerhq.hu (ib) Date: Sat, 31 Dec 2011 13:45:46 +0100 (CET) Subject: [MPlayer-cvslog] r34476 - trunk/gui/interface.c Message-ID: <20111231124546.AFE9E12CF7A@avserver.banki.hu> Author: ib Date: Sat Dec 31 13:45:46 2011 New Revision: 34476 Log: Replace VCD's STREAM_CTRL_GET_NUM_CHAPTERS by STREAM_CTRL_GET_NUM_TITLES. Although both commands are synonymous, it's more consistent. Modified: trunk/gui/interface.c Modified: trunk/gui/interface.c ============================================================================== --- trunk/gui/interface.c Sat Dec 31 13:38:52 2011 (r34475) +++ trunk/gui/interface.c Sat Dec 31 13:45:46 2011 (r34476) @@ -632,7 +632,7 @@ int gui(int what, void *data) #ifdef CONFIG_VCD case STREAMTYPE_VCD: guiInfo.Tracks = 0; - stream_control(stream, STREAM_CTRL_GET_NUM_CHAPTERS, &guiInfo.Tracks); + stream_control(stream, STREAM_CTRL_GET_NUM_TITLES, &guiInfo.Tracks); break; #endif From subversion at mplayerhq.hu Sat Dec 31 13:55:28 2011 From: subversion at mplayerhq.hu (ib) Date: Sat, 31 Dec 2011 13:55:28 +0100 (CET) Subject: [MPlayer-cvslog] r34477 - trunk/gui/interface.c Message-ID: <20111231125528.4EA6F12CDAE@avserver.banki.hu> Author: ib Date: Sat Dec 31 13:55:28 2011 New Revision: 34477 Log: Retrieve DVD's titles, chapters and angles by stream control commands. Don't access the private vmg_file member structure. Modified: trunk/gui/interface.c Modified: trunk/gui/interface.c ============================================================================== --- trunk/gui/interface.c Sat Dec 31 13:45:46 2011 (r34476) +++ trunk/gui/interface.c Sat Dec 31 13:55:28 2011 (r34477) @@ -638,10 +638,13 @@ int gui(int what, void *data) #ifdef CONFIG_DVDREAD case STREAMTYPE_DVD: + guiInfo.Tracks = 0; + stream_control(stream, STREAM_CTRL_GET_NUM_TITLES, &guiInfo.Tracks); + guiInfo.Chapters = 0; + stream_control(stream, STREAM_CTRL_GET_NUM_CHAPTERS, &guiInfo.Chapters); + guiInfo.Angles = 0; + stream_control(stream, STREAM_CTRL_GET_NUM_ANGLES, &guiInfo.Angles); dvd = stream->priv; - guiInfo.Tracks = dvd->vmg_file->tt_srpt->nr_of_srpts; - guiInfo.Chapters = dvd->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts; - guiInfo.Angles = dvd->vmg_file->tt_srpt->title[dvd_title].nr_of_angles; guiInfo.AudioStreams = dvd->nr_of_channels; memcpy(guiInfo.AudioStream, dvd->audio_streams, sizeof(dvd->audio_streams)); guiInfo.Subtitles = dvd->nr_of_subtitles; From subversion at mplayerhq.hu Sat Dec 31 14:15:31 2011 From: subversion at mplayerhq.hu (ib) Date: Sat, 31 Dec 2011 14:15:31 +0100 (CET) Subject: [MPlayer-cvslog] r34478 - in trunk/gui/win32: dialogs.h preferences.c wincfg.c Message-ID: <20111231131531.272EF12CFC1@avserver.banki.hu> Author: ib Date: Sat Dec 31 14:15:30 2011 New Revision: 34478 Log: Remove options cdrom_device and dvd_device from the Win32 GUI. Windows determines these devices by directly checking all drives for type CDROM (and may handle even multiple of them). Modified: trunk/gui/win32/dialogs.h trunk/gui/win32/preferences.c trunk/gui/win32/wincfg.c Modified: trunk/gui/win32/dialogs.h ============================================================================== --- trunk/gui/win32/dialogs.h Sat Dec 31 13:55:28 2011 (r34477) +++ trunk/gui/win32/dialogs.h Sat Dec 31 14:15:30 2011 (r34478) @@ -68,8 +68,6 @@ #define ID_OSD1 34 #define ID_OSD2 35 #define ID_OSD3 36 -#define ID_DVDDEVICE 37 -#define ID_CDDEVICE 38 #define ID_PRIO 39 #define ID_URL 40 #define ID_TITLESEL 41 Modified: trunk/gui/win32/preferences.c ============================================================================== --- trunk/gui/win32/preferences.c Sat Dec 31 13:55:28 2011 (r34477) +++ trunk/gui/win32/preferences.c Sat Dec 31 14:15:30 2011 (r34478) @@ -61,11 +61,9 @@ static void set_defaults(void) static LRESULT CALLBACK PrefsWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { - HWND btn, label, edit1, edit2, edit3, updown1, updown2, track1, track2; + HWND btn, label, edit1, edit2, updown1, updown2, track1, track2; static HWND vo_driver, ao_driver, prio; int i = 0, j = 0; - char dvddevice[MAX_PATH]; - char cdromdevice[MAX_PATH]; char procprio[11]; float x = 10.0, y = 100.0, stereopos, delaypos; stereopos = gtkAOExtraStereoMul * x; @@ -111,20 +109,6 @@ static LRESULT CALLBACK PrefsWndProc(HWN NULL); SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); - label = CreateWindow("static", acp(MSGTR_PREFERENCES_DVDDevice), - WS_CHILD | WS_VISIBLE | SS_RIGHT, - 55, 387, 100, 15, hwnd, - NULL, ((LPCREATESTRUCT) lParam) -> hInstance, - NULL); - SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); - - label = CreateWindow("static", acp(MSGTR_PREFERENCES_CDROMDevice), - WS_CHILD | WS_VISIBLE | SS_RIGHT, - 185, 387, 100, 15, hwnd, - NULL, ((LPCREATESTRUCT) lParam) -> hInstance, - NULL); - SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); - label = CreateWindow("static", acp(MSGTR_PREFERENCES_Priority), WS_CHILD | WS_VISIBLE | SS_RIGHT, 200, 286, 100, 15, hwnd, @@ -360,25 +344,6 @@ static LRESULT CALLBACK PrefsWndProc(HWN (HWND)edit2, 0, 0, 0); SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETRANGE32, (WPARAM)0, (LPARAM)10000); - /* dvd and cd devices */ - edit3 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", NULL, - WS_CHILD | WS_VISIBLE | - ES_LEFT | ES_AUTOHSCROLL, - 165, 384, 20, 20, hwnd, - (HMENU) ID_DVDDEVICE, - ((LPCREATESTRUCT) lParam) -> hInstance, - NULL); - SendMessage(edit3, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); - - edit3 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", NULL, - WS_CHILD | WS_VISIBLE | - ES_LEFT| ES_AUTOHSCROLL, - 295, 384, 20, 20, hwnd, - (HMENU) ID_CDDEVICE, - ((LPCREATESTRUCT) lParam) -> hInstance, - NULL); - SendMessage(edit3, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0); - while(video_out_drivers[i]) { const vo_info_t *info = video_out_drivers[i++]->info; @@ -476,14 +441,6 @@ static LRESULT CALLBACK PrefsWndProc(HWN else if(osd_level == 3) SendDlgItemMessage(hwnd, ID_OSD3, BM_SETCHECK, 1, 0); - if(dvd_device) - SendDlgItemMessage(hwnd, ID_DVDDEVICE, WM_SETTEXT, 0, (LPARAM)dvd_device); - else SendDlgItemMessage(hwnd, ID_DVDDEVICE, WM_SETTEXT, 0, (LPARAM)"D:"); - - if(cdrom_device) - SendDlgItemMessage(hwnd, ID_CDDEVICE, WM_SETTEXT, 0, (LPARAM)cdrom_device); - else SendDlgItemMessage(hwnd, ID_CDDEVICE, WM_SETTEXT, 0, (LPARAM)"D:"); - if(proc_priority) SendDlgItemMessage(hwnd, ID_PRIO, CB_SETCURSEL, (WPARAM)SendMessage(prio, CB_FINDSTRING, -1, @@ -577,8 +534,6 @@ static LRESULT CALLBACK PrefsWndProc(HWN SendDlgItemMessage(hwnd, ID_OSD1, BM_SETCHECK, 1, 0); SendDlgItemMessage(hwnd, ID_OSD2, BM_SETCHECK, 0, 0); SendDlgItemMessage(hwnd, ID_OSD3, BM_SETCHECK, 0, 0); - SendDlgItemMessage(hwnd, ID_DVDDEVICE, WM_SETTEXT, 0, (LPARAM)"D:"); - SendDlgItemMessage(hwnd, ID_CDDEVICE, WM_SETTEXT, 0, (LPARAM)"D:"); SendMessage(hwnd, WM_COMMAND, (WPARAM)ID_APPLY, 0); break; } @@ -677,12 +632,6 @@ static LRESULT CALLBACK PrefsWndProc(HWN else if(SendDlgItemMessage(hwnd, ID_OSD3, BM_GETCHECK, 0, 0) == BST_CHECKED) osd_level = 3; - /* dvd and cd devices */ - SendDlgItemMessage(hwnd, ID_DVDDEVICE, WM_GETTEXT, MAX_PATH, (LPARAM)dvddevice); - dvd_device = strdup(dvddevice); - SendDlgItemMessage(hwnd, ID_CDDEVICE, WM_GETTEXT, MAX_PATH, (LPARAM)cdromdevice); - cdrom_device = strdup(cdromdevice); - MessageBox(hwnd, acp(MSGTR_PREFERENCES_Message), acp(MSGTR_MSGBOX_LABEL_Warning), MB_OK); DestroyWindow(hwnd); break; Modified: trunk/gui/win32/wincfg.c ============================================================================== --- trunk/gui/win32/wincfg.c Sat Dec 31 13:55:28 2011 (r34477) +++ trunk/gui/win32/wincfg.c Sat Dec 31 14:15:30 2011 (r34478) @@ -70,8 +70,6 @@ static const m_option_t gui_opts[] = { "ao_extra_stereo", >kAOExtraStereo, CONF_TYPE_FLAG, 0, 0, 1, NULL }, { "ao_extra_stereo_coefficient", >kAOExtraStereoMul, CONF_TYPE_FLOAT, CONF_RANGE, -10, 10, NULL }, { "delay", &audio_delay, CONF_TYPE_FLOAT, CONF_RANGE, -100.0, 100.0, NULL}, - { "dvd_device", &dvd_device, CONF_TYPE_STRING, 0, 0, 0, NULL }, - { "cdrom_device", &cdrom_device, CONF_TYPE_STRING, 0, 0, 0, NULL }, { "osd_level", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL }, { "cache", >kCacheOn, CONF_TYPE_FLAG, 0, 0, 1, NULL }, { "cache_size", >kCacheSize, CONF_TYPE_INT, CONF_RANGE, -1, 65535, NULL }, From subversion at mplayerhq.hu Sat Dec 31 14:20:30 2011 From: subversion at mplayerhq.hu (ib) Date: Sat, 31 Dec 2011 14:20:30 +0100 (CET) Subject: [MPlayer-cvslog] r34479 - in trunk/gui/win32: gui.c interface.c Message-ID: <20111231132030.303B912CFAA@avserver.banki.hu> Author: ib Date: Sat Dec 31 14:20:29 2011 New Revision: 34479 Log: Fix Win32 GUI DVD playback. The "open disk" menu item for DVDs didn't work. Reported by Stephen Sheldon, sfsheldo gmail com. Modified: trunk/gui/win32/gui.c trunk/gui/win32/interface.c Modified: trunk/gui/win32/gui.c ============================================================================== --- trunk/gui/win32/gui.c Sat Dec 31 14:15:30 2011 (r34478) +++ trunk/gui/win32/gui.c Sat Dec 31 14:20:29 2011 (r34479) @@ -1055,7 +1055,6 @@ static LRESULT CALLBACK EventProc(HWND h #ifdef CONFIG_DVDREAD free(dvd_device); dvd_device = strdup(device + pos); - dvd_title = dvd_chapter = dvd_angle = 1; handlemsg(hWnd, evPlayDVD); #endif } Modified: trunk/gui/win32/interface.c ============================================================================== --- trunk/gui/win32/interface.c Sat Dec 31 14:15:30 2011 (r34478) +++ trunk/gui/win32/interface.c Sat Dec 31 14:20:29 2011 (r34479) @@ -114,9 +114,9 @@ static void guiSetEvent(int event) case evPlayDVD: { static char dvdname[MAX_PATH]; - guiInfo.Track = dvd_title; - guiInfo.Chapter = dvd_chapter; - guiInfo.Angle = dvd_angle; + guiInfo.Track = 1; + guiInfo.Chapter = 1; + guiInfo.Angle = 1; guiInfo.NewPlay = GUI_FILE_SAME; uiSetFileName(NULL, dvd_device, STREAMTYPE_DVD); @@ -125,10 +125,9 @@ static void guiSetEvent(int event) GetVolumeInformation(dvd_device, dvdname, MAX_PATH, NULL, NULL, NULL, NULL, 0); capitalize(dvdname); mp_msg(MSGT_GPLAYER, MSGL_V, "Opening DVD %s -> %s\n", dvd_device, dvdname); - gui(GUI_PREPARE, (void *) STREAMTYPE_DVD); mygui->playlist->clear_playlist(mygui->playlist); mygui->playlist->add_track(mygui->playlist, filename, NULL, dvdname, 0); - mygui->startplay(mygui); + uiPlay(); break; } #endif @@ -502,31 +501,17 @@ int gui(int what, void *data) dvd_title = 0; force_fps = 0; if(!mygui->playlist->tracks) return 0; - uiSetFileName(NULL, mygui->playlist->tracks[mygui->playlist->current]->filename, STREAMTYPE_FILE); - guiInfo.Track = mygui->playlist->current + 1; - guiInfo.VideoWindow = 1; - if(gtkAONorm) greplace(&af_cfg.list, "volnorm", "volnorm"); - if(gtkAOExtraStereo) - { - char *name = malloc(12 + 20 + 1); - snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul); - name[12 + 20] = 0; - greplace(&af_cfg.list, "extrastereo", name); - free(name); - } - if(gtkCacheOn) stream_cache_size = gtkCacheSize; - if(gtkAutoSyncOn) autosync = gtkAutoSync; - guiInfo.NewPlay = 0; switch(guiInfo.StreamType) { case STREAMTYPE_FILE: case STREAMTYPE_STREAM: + uiSetFileName(NULL, mygui->playlist->tracks[mygui->playlist->current]->filename, STREAMTYPE_FILE); + guiInfo.Track = mygui->playlist->current + 1; break; #ifdef CONFIG_DVDREAD case STREAMTYPE_DVD: { char tmp[512]; - dvd_title = guiInfo.Track; dvd_chapter = guiInfo.Chapter; dvd_angle = guiInfo.Angle; sprintf(tmp,"dvd://%d", guiInfo.Track); @@ -535,6 +520,19 @@ int gui(int what, void *data) } #endif } + guiInfo.VideoWindow = 1; + if(gtkAONorm) greplace(&af_cfg.list, "volnorm", "volnorm"); + if(gtkAOExtraStereo) + { + char *name = malloc(12 + 20 + 1); + snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul); + name[12 + 20] = 0; + greplace(&af_cfg.list, "extrastereo", name); + free(name); + } + if(gtkCacheOn) stream_cache_size = gtkCacheSize; + if(gtkAutoSyncOn) autosync = gtkAutoSync; + guiInfo.NewPlay = 0; break; } case GUI_SET_AUDIO: From subversion at mplayerhq.hu Sat Dec 31 14:25:23 2011 From: subversion at mplayerhq.hu (ib) Date: Sat, 31 Dec 2011 14:25:23 +0100 (CET) Subject: [MPlayer-cvslog] r34480 - trunk/gui/win32/interface.c Message-ID: <20111231132523.5D28612CE26@avserver.banki.hu> Author: ib Date: Sat Dec 31 14:25:23 2011 New Revision: 34480 Log: Allow Windows style devices for Wine port. Determine the Linux style device by asking Wine's mount manager. Modified: trunk/gui/win32/interface.c Modified: trunk/gui/win32/interface.c ============================================================================== --- trunk/gui/win32/interface.c Sat Dec 31 14:20:29 2011 (r34479) +++ trunk/gui/win32/interface.c Sat Dec 31 14:25:23 2011 (r34480) @@ -25,6 +25,11 @@ #if defined(__CYGWIN__) || defined(__WINE__) #define _beginthreadex CreateThread +#ifdef __WINE__ +#include +#define WINE_MOUNTMGR_EXTENSIONS +#include +#endif #else #include #endif @@ -76,6 +81,53 @@ const ao_functions_t *audio_out = NULL; const vo_functions_t *video_out = NULL; mixer_t *mixer = NULL; +#ifdef __WINE__ +/** + * @brief Convert a Windows style device name into an Unix style one. + * + * @param device pointer to the device name to be converted + * + * @return pointer to the converted device name + */ +static char *unix_device (char *device) +{ + static char *unix_devname; + HANDLE mgr; + DWORD size = 1024; + + mgr = CreateFileW(MOUNTMGR_DOS_DEVICE_NAME, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); + + if (mgr != INVALID_HANDLE_VALUE) + { + struct mountmgr_unix_drive input; + struct mountmgr_unix_drive *data; + + data = HeapAlloc(GetProcessHeap(), 0, size); + + if (data) + { + memset(&input, 0, sizeof(input)); + input.letter = *device; + + if (DeviceIoControl(mgr, IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE, &input, sizeof(input), data, size, NULL, NULL)) + { + if (data->device_offset) + { + setdup(&unix_devname, (char *) data + data->device_offset); + device = unix_devname; + } + } + + HeapFree(GetProcessHeap(), 0, data); + } + + CloseHandle(mgr); + } + + return device; +} +#endif + /* test for playlist files, no need to specify -playlist on the commandline. * add any conceivable playlist extensions here. * - Erik @@ -119,6 +171,12 @@ static void guiSetEvent(int event) guiInfo.Angle = 1; guiInfo.NewPlay = GUI_FILE_SAME; +#ifdef __WINE__ + // dvd_device is in the Windows style (D:\), which needs to be + // converted for MPlayer, so that it will find the device in the + // Linux filesystem. + dvd_device = unix_device(dvd_device); +#endif uiSetFileName(NULL, dvd_device, STREAMTYPE_DVD); dvdname[0] = 0; strcat(dvdname, "DVD Movie"); From subversion at mplayerhq.hu Sat Dec 31 14:42:24 2011 From: subversion at mplayerhq.hu (ib) Date: Sat, 31 Dec 2011 14:42:24 +0100 (CET) Subject: [MPlayer-cvslog] r34481 - trunk/gui/win32/interface.c Message-ID: <20111231134224.4441612CFDA@avserver.banki.hu> Author: ib Date: Sat Dec 31 14:42:24 2011 New Revision: 34481 Log: Cosmetic: Collect together Wine port related functions. Modified: trunk/gui/win32/interface.c Modified: trunk/gui/win32/interface.c ============================================================================== --- trunk/gui/win32/interface.c Sat Dec 31 14:25:23 2011 (r34480) +++ trunk/gui/win32/interface.c Sat Dec 31 14:42:24 2011 (r34481) @@ -83,6 +83,42 @@ mixer_t *mixer = NULL; #ifdef __WINE__ /** + * @brief Convert a Windows style path to a file name into an Unix style one. + * + * @param filename pointer to the file path to be converted + * + * @return pointer to the converted file path + */ +static char *unix_name (char *filename) +{ + static char *unix_filename; + LPSTR (*CDECL wine_get_unix_file_name_ptr)(LPCWSTR); + int wchar_conv; + + if (*filename && (filename[1] == ':')) + { + wine_get_unix_file_name_ptr = (void *) GetProcAddress(GetModuleHandleA("KERNEL32"), "wine_get_unix_file_name"); + wchar_conv = MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, NULL, 0); + + if (wine_get_unix_file_name_ptr && wchar_conv) + { + WCHAR *ntpath; + char *unix_name; + + ntpath = HeapAlloc(GetProcessHeap(), 0, sizeof(*ntpath) * (wchar_conv + 1)); + MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, ntpath, wchar_conv); + unix_name = wine_get_unix_file_name_ptr(ntpath); + setdup(&unix_filename, unix_name); + filename = unix_filename; + HeapFree(GetProcessHeap(), 0, unix_name); + HeapFree(GetProcessHeap(), 0, ntpath); + } + } + + return filename; +} + +/** * @brief Convert a Windows style device name into an Unix style one. * * @param device pointer to the device name to be converted @@ -388,44 +424,6 @@ void uiPrev(void) mygui->startplay(mygui); } -#ifdef __WINE__ -/** - * @brief Convert a Windows style path to a file name into an Unix style one. - * - * @param filename pointer to the file path to be converted - * - * @return pointer to the converted file path - */ -static char *unix_name (char *filename) -{ - static char *unix_filename; - LPSTR (*CDECL wine_get_unix_file_name_ptr)(LPCWSTR); - int wchar_conv; - - if (*filename && (filename[1] == ':')) - { - wine_get_unix_file_name_ptr = (void *) GetProcAddress(GetModuleHandleA("KERNEL32"), "wine_get_unix_file_name"); - wchar_conv = MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, NULL, 0); - - if (wine_get_unix_file_name_ptr && wchar_conv) - { - WCHAR *ntpath; - char *unix_name; - - ntpath = HeapAlloc(GetProcessHeap(), 0, sizeof(*ntpath) * (wchar_conv + 1)); - MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, ntpath, wchar_conv); - unix_name = wine_get_unix_file_name_ptr(ntpath); - setdup(&unix_filename, unix_name); - filename = unix_filename; - HeapFree(GetProcessHeap(), 0, unix_name); - HeapFree(GetProcessHeap(), 0, ntpath); - } - } - - return filename; -} -#endif - void uiSetFileName(char *dir, char *name, int type) { if(!name) return; From Reimar.Doeffinger at gmx.de Sat Dec 31 17:22:51 2011 From: Reimar.Doeffinger at gmx.de (Reimar =?iso-8859-1?Q?D=F6ffinger?=) Date: Sat, 31 Dec 2011 17:22:51 +0100 Subject: [MPlayer-cvslog] r34475 - in trunk: DOCS/xml/de/skin.xml DOCS/xml/en/skin.xml gui/app.c gui/app.h gui/interface.c gui/ui/actions.c gui/ui/gtk/menu.c gui/ui/main.c gui/ui/pixmaps/cd.xpm gui/ui/pixmaps/dvd.xpm gui/ui... In-Reply-To: <20111231123853.479EF12CE90@avserver.banki.hu> References: <20111231123853.479EF12CE90@avserver.banki.hu> Message-ID: <20111231162251.GA4265@1und1.de> On Sat, Dec 31, 2011 at 01:38:53PM +0100, ib wrote: > Author: ib > Date: Sat Dec 31 13:38:52 2011 > New Revision: 34475 > > Log: > Add audio CD playback support to the X11/GTK GUI. > > (The Win32 GUI already had this support. Add missing - although already > used - user event evPlayCD here as well as internal event ivSetCDTrack > - although it's unused - for consistency.) Could I convince you to work on removing those ifdefs (both CDDA, VCD and probably more)? By what I can tell they save maybe 1kB out of 12 MB (as in, 0.01%) from the compiled binary, that just isn't worth the amount of code mess they add. From ib at wupperonline.de Sat Dec 31 17:46:12 2011 From: ib at wupperonline.de (=?ISO-8859-1?Q?Ingo=20Br=FCckl?=) Date: Sat, 31 Dec 2011 17:46:12 +0100 Subject: [MPlayer-cvslog] r34475 - in trunk: DOCS/xml/de/skin.xml DOCS/xml/en/skin.xml gui/app.c gui/app In-Reply-To: <20111231162251.GA4265@1und1.de> Message-ID: <4eff3d09.73633ce1.bm000@wupperonline.de> Reimar D?ffinger wrote on Sat, 31 Dec 2011 17:22:51 +0100: > Could I convince you to work on removing those ifdefs (both CDDA, VCD > and probably more)? Yes, it's on top of my todo list. The CDDA ifdefs are only because I used VCD as template and I didn't want to change the code I've been testing for the last weeks. Ingo From Reimar.Doeffinger at gmx.de Sat Dec 31 18:05:56 2011 From: Reimar.Doeffinger at gmx.de (Reimar =?iso-8859-1?Q?D=F6ffinger?=) Date: Sat, 31 Dec 2011 18:05:56 +0100 Subject: [MPlayer-cvslog] r34475 - in trunk: DOCS/xml/de/skin.xml DOCS/xml/en/skin.xml gui/app.c gui/app In-Reply-To: <4eff3d09.73633ce1.bm000@wupperonline.de> References: <20111231162251.GA4265@1und1.de> <4eff3d09.73633ce1.bm000@wupperonline.de> Message-ID: <20111231170556.GA24187@1und1.de> On Sat, Dec 31, 2011 at 05:46:12PM +0100, Ingo Br?ckl wrote: > Reimar D?ffinger wrote on Sat, 31 Dec 2011 17:22:51 +0100: > > > Could I convince you to work on removing those ifdefs (both CDDA, VCD > > and probably more)? > > Yes, it's on top of my todo list. > > The CDDA ifdefs are only because I used VCD as template and I didn't want to > change the code I've been testing for the last weeks. Ok, sorry for being impatient :-)