summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dxr3/dxr3_decoder.c36
-rw-r--r--src/dxr3/video_out_dxr3.c51
2 files changed, 67 insertions, 20 deletions
diff --git a/src/dxr3/dxr3_decoder.c b/src/dxr3/dxr3_decoder.c
index 92d18c0da..e36ae4d86 100644
--- a/src/dxr3/dxr3_decoder.c
+++ b/src/dxr3/dxr3_decoder.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: dxr3_decoder.c,v 1.15 2001/09/23 08:11:11 ehasenle Exp $
+ * $Id: dxr3_decoder.c,v 1.16 2001/10/14 14:49:54 ehasenle Exp $
*
* dxr3 video and spu decoder plugin. Accepts the video and spu data
* from XINE and sends it directly to the corresponding dxr3 devices.
@@ -55,6 +55,9 @@ typedef struct dxr3_decoder_s {
int last_pts;
scr_plugin_t *scr;
int scr_prio;
+ int width;
+ int height;
+ int aspect;
} dxr3_decoder_t;
static int dxr3_tested = 0;
@@ -118,7 +121,7 @@ static int dxr3scr_set_speed (scr_plugin_t *scr, int speed) {
em_speed = 0x900*4;
break;
default:
- em_speed = 0x900;
+ em_speed = 0;
}
if (ioctl(self->fd_control, EM8300_IOCTL_SCR_SETSPEED, &em_speed))
fprintf(stderr, "dxr3scr: failed to set speed (%s)\n", strerror(errno));
@@ -215,6 +218,32 @@ static void dxr3_init (video_decoder_t *this_gen, vo_instance_t *video_out)
this->scr->start(this->scr, 0);
}
+#define HEADER_OFFSET 4
+static void find_aspect(dxr3_decoder_t *this, uint8_t * buffer)
+{
+ /* only carry on if we have a legitimate mpeg header... */
+ if (buffer[1]==0 && buffer[0]==0 && buffer[2]==1 && buffer[3]==0xb3) {
+ int old_h = this->height;
+ int old_w = this->width;
+ int old_a = this->aspect;
+
+ /* grab video resolution and aspect ratio from the stream */
+ this->height = (buffer[HEADER_OFFSET+0] << 16) |
+ (buffer[HEADER_OFFSET+1] << 8) |
+ buffer[HEADER_OFFSET+2];
+ this->width = ((this->height >> 12) + 15) & ~15;
+ this->height = ((this->height & 0xfff) + 15) & ~15;
+ this->aspect = buffer[HEADER_OFFSET+3] >> 4;
+
+ /* and ship the data if different ... appeasing any other vo plugins
+ that are active ... */
+ if (old_h!=this->height || old_w!=this->width || old_a!=this->aspect)
+ this->video_out->get_frame(this->video_out,
+ this->width,this->height,this->aspect,
+ IMGFMT_YV12, 1, VO_BOTH_FIELDS);
+ }
+}
+
static void dxr3_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
{
dxr3_decoder_t *this = (dxr3_decoder_t *) this_gen;
@@ -250,6 +279,9 @@ static void dxr3_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
if (written != buf->size)
fprintf(stderr, "dxr3: Could only write %d of %d video bytes.\n",
written, buf->size);
+
+ /* run the header parser here... otherwise the dxr3 tends to block... */
+ find_aspect(this, buf->content);
}
static void dxr3_close (video_decoder_t *this_gen)
diff --git a/src/dxr3/video_out_dxr3.c b/src/dxr3/video_out_dxr3.c
index e5d5eda03..d86a2f7ef 100644
--- a/src/dxr3/video_out_dxr3.c
+++ b/src/dxr3/video_out_dxr3.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_dxr3.c,v 1.9 2001/10/10 10:05:03 jkeil Exp $
+ * $Id: video_out_dxr3.c,v 1.10 2001/10/14 14:49:54 ehasenle Exp $
*
* Dummy video out plugin for the dxr3. Is responsible for setting
* tv_mode, bcs values and the aspectratio.
@@ -67,10 +67,16 @@ typedef struct dxr3_driver_s {
int width, height;
int overlay_enabled;
float desired_ratio;
+
+ int video_width;
+ int video_height;
+ int video_aspect;
void (*request_dest_size) (int video_width, int video_height, int *dest_x,
int *dest_y, int *dest_height, int *dest_width);
} dxr3_driver_t;
+static int dxr3_set_property (vo_driver_t *this_gen, int property, int value);
+
static void dxr3_overlay_adapt_area(dxr3_driver_t *this,
int dest_x, int dest_y, int dest_width, int dest_height)
{
@@ -187,8 +193,19 @@ static void dxr3_update_frame_format (vo_driver_t *this_gen,
uint32_t width, uint32_t height,
int ratio_code, int format, int flags)
{
- /* dxr3_driver_t *this = (dxr3_driver_t *) this_gen; */
- fprintf(stderr, "dxr3_vo: dummy function update_frame_format called!\n");
+ dxr3_driver_t *this = (dxr3_driver_t *) this_gen;
+
+ int aspect;
+ this->video_width = width;
+ this->video_height = height;
+ this->video_aspect = ratio_code;
+
+ if (ratio_code < 3 || ratio_code>4)
+ aspect = ASPECT_FULL;
+ else
+ aspect = ASPECT_ANAMORPHIC;
+ if(this->aspectratio!=aspect)
+ dxr3_set_property (this_gen, VO_PROP_ASPECT_RATIO, aspect);
}
static void dxr3_display_frame (vo_driver_t *this_gen, vo_frame_t *frame)
@@ -339,6 +356,8 @@ static void dxr3_translate_gui2video(dxr3_driver_t *this,
int x, int y,
int *vid_x, int *vid_y)
{
+ x = x * this->video_width / this->width;
+ y = y * this->video_height / this->height;
*vid_x = x;
*vid_y = y;
}
@@ -370,23 +389,21 @@ static int dxr3_gui_data_exchange (vo_driver_t *this_gen,
dxr3_set_property((vo_driver_t*) this,
VO_PROP_ASPECT_RATIO, this->aspectratio);
break;
- /* FIXME: implement this
case GUI_DATA_EX_TRANSLATE_GUI_TO_VIDEO:
{
- int x1, y1, x2, y2;
- x11_rectangle_t *rect = data;
-
- dxr3_translate_gui2video(this, rect->x, rect->y,
- &x1, &y1);
- dxr3_translate_gui2video(this, rect->x+rect->w, rect->y+rect->h,
- &x2, &y2);
- rect->x = x1;
- rect->y = y1;
- rect->w = x2-x1;
- rect->h = y2-y1;
+ int x1, y1, x2, y2;
+ x11_rectangle_t *rect = data;
+
+ dxr3_translate_gui2video(this, rect->x, rect->y,
+ &x1, &y1);
+ dxr3_translate_gui2video(this, rect->w, rect->h,
+ &x2, &y2);
+ rect->x = x1;
+ rect->y = y1;
+ rect->w = x2-x1;
+ rect->h = y2-y1;
}
break;
- */
default:
return -1;
}
@@ -477,8 +494,6 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen)
/* default values */
this->overlay_enabled = 0;
this->aspectratio = ASPECT_FULL;
- dxr3_set_property((vo_driver_t*) this,
- VO_PROP_ASPECT_RATIO, this->aspectratio);
dxr3_read_config(this, config);