Mercurial > mplayer.hg
comparison spudec.c @ 5833:91d766389a5d
VobSub updates, custom palette support and other stuff, can't write the name of the chinese(?) patch supplier.
author | atmos4 |
---|---|
date | Thu, 25 Apr 2002 18:46:44 +0000 |
parents | 86663f1b9b00 |
children | 31159f453cf9 |
comparison
equal
deleted
inserted
replaced
5832:041bd56e41dc | 5833:91d766389a5d |
---|---|
41 unsigned int packet_offset; /* end of the currently assembled fragment */ | 41 unsigned int packet_offset; /* end of the currently assembled fragment */ |
42 unsigned int packet_size; /* size of the packet once all fragments are assembled */ | 42 unsigned int packet_size; /* size of the packet once all fragments are assembled */ |
43 unsigned int control_start; /* index of start of control data */ | 43 unsigned int control_start; /* index of start of control data */ |
44 unsigned int palette[4]; | 44 unsigned int palette[4]; |
45 unsigned int alpha[4]; | 45 unsigned int alpha[4]; |
46 unsigned int cuspal[4]; | |
47 unsigned int custom; | |
46 unsigned int now_pts; | 48 unsigned int now_pts; |
47 unsigned int start_pts, end_pts; | 49 unsigned int start_pts, end_pts; |
48 unsigned int start_col, end_col; | 50 unsigned int start_col, end_col; |
49 unsigned int start_row, end_row; | 51 unsigned int start_row, end_row; |
50 unsigned int width, height, stride; | 52 unsigned int width, height, stride; |
120 this->scaled_frame_height = 0; | 122 this->scaled_frame_height = 0; |
121 for (i = 0; i < 4; ++i) { | 123 for (i = 0; i < 4; ++i) { |
122 alpha[i] = mkalpha(this->alpha[i]); | 124 alpha[i] = mkalpha(this->alpha[i]); |
123 if (alpha[i] == 0) | 125 if (alpha[i] == 0) |
124 cmap[i] = 0; | 126 cmap[i] = 0; |
127 else if (this->custom){ | |
128 cmap[i] = ((this->cuspal[i] >> 16) & 0xff); | |
129 if (cmap[i] + alpha[i] > 255) | |
130 cmap[i] = 256 - alpha[i]; | |
131 } | |
125 else { | 132 else { |
126 cmap[i] = ((this->global_palette[this->palette[i]] >> 16) & 0xff); | 133 cmap[i] = ((this->global_palette[this->palette[i]] >> 16) & 0xff); |
127 if (cmap[i] + alpha[i] > 255) | 134 if (cmap[i] + alpha[i] > 255) |
128 cmap[i] = 256 - alpha[i]; | 135 cmap[i] = 256 - alpha[i]; |
129 } | 136 } |
690 else | 697 else |
691 perror("FATAL: spudec_init: calloc"); | 698 perror("FATAL: spudec_init: calloc"); |
692 return this; | 699 return this; |
693 } | 700 } |
694 | 701 |
702 /* get palette custom color, width, height from .idx file */ | |
703 void *spudec_new_scaled_vobsub(unsigned int *palette, unsigned int *cuspal, unsigned int custom, unsigned int frame_width, unsigned int frame_height) | |
704 { | |
705 spudec_handle_t *this = calloc(1, sizeof(spudec_handle_t)); | |
706 if (this){ | |
707 if (palette){ | |
708 memcpy(this->global_palette, palette, sizeof(this->global_palette)); | |
709 memcpy(this->cuspal, cuspal, sizeof(this->cuspal)); | |
710 } | |
711 //(fprintf(stderr,"VobSub Custom Palette: %d,%d,%d,%d", this->cuspal[0], this->cuspal[1], this->cuspal[2],this->cuspal[3]); | |
712 this->packet = NULL; | |
713 this->image = NULL; | |
714 this->scaled_image = NULL; | |
715 this->orig_frame_width = frame_width; | |
716 this->orig_frame_height = frame_height; | |
717 this->custom = custom; | |
718 } | |
719 else | |
720 perror("FATAL: spudec_init: calloc"); | |
721 return this; | |
722 } | |
695 void *spudec_new(unsigned int *palette) | 723 void *spudec_new(unsigned int *palette) |
696 { | 724 { |
697 return spudec_new_scaled(palette, 0, 0); | 725 return spudec_new_scaled(palette, 0, 0); |
698 } | 726 } |
699 | 727 |