Mercurial > mplayer.hg
view osdep/getch2-os2.c @ 27518:e54c9b7eb0d8
Revert bad changes to SSA/ASS subtitle packet format
The following commits are reverted partially or completely:
"a valid ASS line contains 9 ',' before actual text"
"demux_mkv: output correctly formated ASS packets"
"libass: add a new ass_process_data() to process demuxed subtitle packets"
These commits converted the internal representation of SSA/ASS
subtitle packets from the format used by Matroska to a custom format
where each packet has contents exactly matching one line in complete
SSA script files. AFAIK no files natively use such a format for muxed
subtitles. The stated reason for this change was to use a format that
could in principle be muxed into a maximal number of containers. SSA
subtitles do not have an implicit duration so both start time and
duration or end time need to be specified explicitly; the new format
moved timing information inside the codec packet data so it could be
muxed without modification into containers that can represent only
start time at the container level. However such a change is wrong from
the viewpoint of program architecture. Timing information belongs to
the demuxer level, but these commits moved not only the duration but
also the authoritative value of the start time to inside the codec
data. Additionally the new format lost the value of the Matroska
ReadOrder field which is used by MPlayer.
This commit changes the internal packet format back to that used by
Matroska and makes the internal Matroska demuxer output that format
again. Libavformat still outputs the "new" format; it could be
converted back to the Matroska format in demux_lavf.c, but I'm not
adding that code at least yet. The current lavf code has similar
problems as the reverted code in MPlayer, and it also currently fails
to provide any way to access the value of the ReadOrder field. I hope
that the lavf side will be improved; if it isn't conversion can be
added later. For now I'll make MPlayer default to the internal Matroska
demuxer instead of the lavf one in a separate commit.
author | uau |
---|---|
date | Mon, 08 Sep 2008 21:26:22 +0000 |
parents | 4876c89bafdd |
children | d5d66bff938a |
line wrap: on
line source
/* * getch2-os2.c : OS/2 TermIO for MPlayer * * Copyright (c) 2007 KO Myung-Hun (komh@chollian.net) * * This file is part of MPlayer. * * MPlayer is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * MPlayer is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with MPlayer; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #define INCL_KBD #define INCL_VIO #define INCL_DOS #include <os2.h> #include <stdio.h> #include "config.h" #include "keycodes.h" #include "input/input.h" #include "mp_fifo.h" #if defined(HAVE_LANGINFO) && defined(CONFIG_ICONV) #include <locale.h> #include <langinfo.h> #endif int mp_input_slave_cmd_func( int fd, char *dest, int size ) { PPIB ppib; CHAR szPipeName[ 100 ]; HFILE hpipe; ULONG ulAction; ULONG cbActual; ULONG rc; DosGetInfoBlocks( NULL, &ppib ); sprintf( szPipeName, "\\PIPE\\MPLAYER\\%lx", ppib->pib_ulpid ); rc = DosOpen( szPipeName, &hpipe, &ulAction, 0, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS, OPEN_SHARE_DENYREADWRITE | OPEN_ACCESS_READWRITE, NULL ); if( rc ) return MP_INPUT_NOTHING; rc = DosRead( hpipe, dest, size, &cbActual ); if( rc ) return MP_INPUT_NOTHING; rc = cbActual; // Send ACK DosWrite( hpipe, &rc, sizeof( ULONG ), &cbActual ); DosClose( hpipe ); return rc; } int screen_width = 80; int screen_height = 24; char *erase_to_end_of_line = NULL; void get_screen_size( void ) { VIOMODEINFO vmi; vmi.cb = sizeof( VIOMODEINFO ); VioGetMode( &vmi, 0 ); screen_width = vmi.col; screen_height = vmi.row; } static int getch2_status = 0; static int getch2_internal( void ) { KBDKEYINFO kki; if( !getch2_status ) return -1; if( KbdCharIn( &kki, IO_NOWAIT, 0 )) return -1; // key pressed ? if( kki.fbStatus ) { // extended key ? if(( kki.chChar == 0x00 ) || ( kki.chChar == 0xE0 )) { switch( kki.chScan ) { case 0x4B : // Left return KEY_LEFT; case 0x48 : // Up return KEY_UP; case 0x4D : // Right return KEY_RIGHT; case 0x50 : // Down return KEY_DOWN; case 0x53 : // Delete return KEY_DELETE; case 0x52 : // Insert return KEY_INSERT; case 0x47 : // Home return KEY_HOME; case 0x4F : // End return KEY_END; case 0x49 : // Page Up return KEY_PAGE_UP; case 0x51 : // Page Down return KEY_PAGE_DOWN; } } else { switch( kki.chChar ) { case 0x08 : // Backspace return KEY_BS; case 0x1B : // Esc return KEY_ESC; case 0x0D : // Enter // Keypad Enter ? if( kki.chScan == 0xE0 ) return KEY_KPENTER; break; } return kki.chChar; } } return -1; } void getch2( void ) { int key; key = getch2_internal(); if( key != -1 ) mplayer_put_key( key ); } void getch2_enable( void ) { getch2_status = 1; } void getch2_disable( void ) { getch2_status = 0; } #ifdef CONFIG_ICONV char *get_term_charset( void ) { char *charset = NULL; #ifdef HAVE_LANGINFO setlocale( LC_CTYPE, ""); charset = nl_langinfo( CODESET ); setlocale( LC_CTYPE, "C"); #endif return charset; } #endif