mirror of
https://github.com/mpv-player/mpv
synced 2025-03-22 19:34:14 +00:00
printf->mp_msg
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3823 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
0b3a3ea97e
commit
a8dd07aaad
35
spudec.c
35
spudec.c
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "mp_msg.h"
|
||||||
|
|
||||||
#ifdef USE_DVDREAD
|
#ifdef USE_DVDREAD
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ static inline unsigned char get_nibble(spudec_handle_t *this)
|
|||||||
unsigned char nib;
|
unsigned char nib;
|
||||||
int *nibblep = this->current_nibble + this->deinterlace_oddness;
|
int *nibblep = this->current_nibble + this->deinterlace_oddness;
|
||||||
if (*nibblep / 2 >= this->control_start) {
|
if (*nibblep / 2 >= this->control_start) {
|
||||||
fprintf(stderr, "ERROR: get_nibble past end of packet\n");
|
mp_msg(MSGT_SPUDEC,MSGL_WARN, "SPUdec: ERROR: get_nibble past end of packet\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
nib = this->packet[*nibblep / 2];
|
nib = this->packet[*nibblep / 2];
|
||||||
@ -177,23 +178,23 @@ static void spudec_process_control(spudec_handle_t *this)
|
|||||||
start_off = next_off;
|
start_off = next_off;
|
||||||
date = get_be16(this->packet + start_off);
|
date = get_be16(this->packet + start_off);
|
||||||
next_off = get_be16(this->packet + start_off + 2);
|
next_off = get_be16(this->packet + start_off + 2);
|
||||||
printf("date=%d\n", date);
|
mp_msg(MSGT_SPUDEC,MSGL_DBG2, "date=%d\n", date);
|
||||||
off = start_off + 4;
|
off = start_off + 4;
|
||||||
for (type = this->packet[off++]; type != 0xff; type = this->packet[off++]) {
|
for (type = this->packet[off++]; type != 0xff; type = this->packet[off++]) {
|
||||||
printf("cmd=%d ",type);
|
mp_msg(MSGT_SPUDEC,MSGL_DBG2, "cmd=%d ",type);
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
/* Menu ID, 1 byte */
|
/* Menu ID, 1 byte */
|
||||||
printf("Menu ID\n");
|
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Menu ID\n");
|
||||||
break;
|
break;
|
||||||
case 0x01:
|
case 0x01:
|
||||||
/* Start display */
|
/* Start display */
|
||||||
printf("Start display!\n");
|
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Start display!\n");
|
||||||
this->start_pts = this->now_pts + date;
|
this->start_pts = this->now_pts + date;
|
||||||
break;
|
break;
|
||||||
case 0x02:
|
case 0x02:
|
||||||
/* Stop display */
|
/* Stop display */
|
||||||
printf("Stop display!\n");
|
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Stop display!\n");
|
||||||
this->end_pts = this->now_pts + date;
|
this->end_pts = this->now_pts + date;
|
||||||
break;
|
break;
|
||||||
case 0x03:
|
case 0x03:
|
||||||
@ -202,7 +203,7 @@ static void spudec_process_control(spudec_handle_t *this)
|
|||||||
this->palette[1] = this->packet[off] & 0xf;
|
this->palette[1] = this->packet[off] & 0xf;
|
||||||
this->palette[2] = this->packet[off + 1] >> 4;
|
this->palette[2] = this->packet[off + 1] >> 4;
|
||||||
this->palette[3] = this->packet[off + 1] & 0xf;
|
this->palette[3] = this->packet[off + 1] & 0xf;
|
||||||
printf("Palette %d, %d, %d, %d\n",
|
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Palette %d, %d, %d, %d\n",
|
||||||
this->palette[0], this->palette[1], this->palette[2], this->palette[3]);
|
this->palette[0], this->palette[1], this->palette[2], this->palette[3]);
|
||||||
off+=2;
|
off+=2;
|
||||||
break;
|
break;
|
||||||
@ -212,7 +213,7 @@ static void spudec_process_control(spudec_handle_t *this)
|
|||||||
this->alpha[1] = this->packet[off] & 0xf;
|
this->alpha[1] = this->packet[off] & 0xf;
|
||||||
this->alpha[2] = this->packet[off + 1] >> 4;
|
this->alpha[2] = this->packet[off + 1] >> 4;
|
||||||
this->alpha[3] = this->packet[off + 1] & 0xf;
|
this->alpha[3] = this->packet[off + 1] & 0xf;
|
||||||
printf("Alpha %d, %d, %d, %d\n",
|
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Alpha %d, %d, %d, %d\n",
|
||||||
this->alpha[0], this->alpha[1], this->alpha[2], this->alpha[3]);
|
this->alpha[0], this->alpha[1], this->alpha[2], this->alpha[3]);
|
||||||
off+=2;
|
off+=2;
|
||||||
break;
|
break;
|
||||||
@ -227,7 +228,7 @@ static void spudec_process_control(spudec_handle_t *this)
|
|||||||
this->start_row = b >> 12;
|
this->start_row = b >> 12;
|
||||||
this->end_row = b & 0xfff;
|
this->end_row = b & 0xfff;
|
||||||
this->height = this->end_row - this->start_row /* + 1 */;
|
this->height = this->end_row - this->start_row /* + 1 */;
|
||||||
printf("Coords col: %d - %d row: %d - %d (%dx%d)\n",
|
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Coords col: %d - %d row: %d - %d (%dx%d)\n",
|
||||||
this->start_col, this->end_col, this->start_row, this->end_row,
|
this->start_col, this->end_col, this->start_row, this->end_row,
|
||||||
this->width, this->height);
|
this->width, this->height);
|
||||||
off+=6;
|
off+=6;
|
||||||
@ -236,17 +237,17 @@ static void spudec_process_control(spudec_handle_t *this)
|
|||||||
/* Graphic lines */
|
/* Graphic lines */
|
||||||
this->current_nibble[0] = 2 * get_be16(this->packet + off);
|
this->current_nibble[0] = 2 * get_be16(this->packet + off);
|
||||||
this->current_nibble[1] = 2 * get_be16(this->packet + off + 2);
|
this->current_nibble[1] = 2 * get_be16(this->packet + off + 2);
|
||||||
printf("Graphic offset 1: %d offset 2: %d\n",
|
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Graphic offset 1: %d offset 2: %d\n",
|
||||||
this->current_nibble[0] / 2, this->current_nibble[1] / 2);
|
this->current_nibble[0] / 2, this->current_nibble[1] / 2);
|
||||||
off+=4;
|
off+=4;
|
||||||
break;
|
break;
|
||||||
case 0xff:
|
case 0xff:
|
||||||
/* All done, bye-bye */
|
/* All done, bye-bye */
|
||||||
printf("Done!\n");
|
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Done!\n");
|
||||||
return;
|
return;
|
||||||
break;
|
// break;
|
||||||
default:
|
default:
|
||||||
printf("spudec: Error determining control type 0x%02x. Skipping %d bytes.\n",
|
mp_msg(MSGT_SPUDEC,MSGL_WARN,"spudec: Error determining control type 0x%02x. Skipping %d bytes.\n",
|
||||||
type, next_off - off);
|
type, next_off - off);
|
||||||
goto next_control;
|
goto next_control;
|
||||||
}
|
}
|
||||||
@ -285,7 +286,7 @@ void spudec_assemble(void *this, unsigned char *packet, int len, int pts100)
|
|||||||
} else {
|
} else {
|
||||||
// Continue current fragment
|
// Continue current fragment
|
||||||
if (spu->packet_size < spu->packet_offset + len){
|
if (spu->packet_size < spu->packet_offset + len){
|
||||||
fprintf(stderr,"invalid fragment\n");
|
mp_msg(MSGT_SPUDEC,MSGL_WARN,"SPUasm: invalid fragment\n");
|
||||||
spu->packet_size = spu->packet_offset = 0;
|
spu->packet_size = spu->packet_offset = 0;
|
||||||
} else {
|
} else {
|
||||||
memcpy(spu->packet + spu->packet_offset, packet, len);
|
memcpy(spu->packet + spu->packet_offset, packet, len);
|
||||||
@ -299,16 +300,16 @@ void spudec_assemble(void *this, unsigned char *packet, int len, int pts100)
|
|||||||
{ int x=0,y;
|
{ int x=0,y;
|
||||||
while(x>=0 && x+4<=spu->packet_offset){
|
while(x>=0 && x+4<=spu->packet_offset){
|
||||||
y=get_be16(spu->packet+x+2); // next control pointer
|
y=get_be16(spu->packet+x+2); // next control pointer
|
||||||
printf("SPUtest: x=%d y=%d off=%d size=%d\n",x,y,spu->packet_offset,spu->packet_size);
|
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"SPUtest: x=%d y=%d off=%d size=%d\n",x,y,spu->packet_offset,spu->packet_size);
|
||||||
if(x>=4 && x==y){ // if it points to self - we're done!
|
if(x>=4 && x==y){ // if it points to self - we're done!
|
||||||
// we got it!
|
// we got it!
|
||||||
printf("SPUgot: off=%d size=%d \n",spu->packet_offset,spu->packet_size);
|
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"SPUgot: off=%d size=%d \n",spu->packet_offset,spu->packet_size);
|
||||||
spudec_decode(spu);
|
spudec_decode(spu);
|
||||||
spu->packet_offset = 0;
|
spu->packet_offset = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(y<=x || y>=spu->packet_size){ // invalid?
|
if(y<=x || y>=spu->packet_size){ // invalid?
|
||||||
printf("SPUtest: broken packet!!!!! y=%d < x=%d\n",y,x);
|
mp_msg(MSGT_SPUDEC,MSGL_WARN,"SPUtest: broken packet!!!!! y=%d < x=%d\n",y,x);
|
||||||
spu->packet_size = spu->packet_offset = 0;
|
spu->packet_size = spu->packet_offset = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user