mirror of
https://github.com/mpv-player/mpv
synced 2024-09-16 22:19:59 +02:00
tv update
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2811 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
ff534f0810
commit
a0cfaaf615
@ -42,7 +42,7 @@ int tv_param_input = 0; /* used in v4l and bttv */
|
||||
/* fill demux->video and demux->audio */
|
||||
int demux_tv_fill_buffer(demuxer_t *demux, tvi_handle_t *tvh)
|
||||
{
|
||||
int seq = tvh->seq;
|
||||
int seq = tvh->seq++;
|
||||
demux_stream_t *ds_video = NULL;
|
||||
demux_packet_t *dp_video = NULL;
|
||||
demux_stream_t *ds_audio = NULL;
|
||||
@ -53,8 +53,8 @@ int demux_tv_fill_buffer(demuxer_t *demux, tvi_handle_t *tvh)
|
||||
|
||||
demux->filepos = -1;
|
||||
|
||||
seq++;
|
||||
tvh->seq++;
|
||||
// seq++;
|
||||
// tvh->seq++;
|
||||
|
||||
/* ================== ADD VIDEO PACKET =================== */
|
||||
len_video = tvh->functions->get_video_framesize(tvh->priv);
|
||||
@ -146,7 +146,7 @@ int demux_open_tv(demuxer_t *demuxer, tvi_handle_t *tvh)
|
||||
|
||||
/* get IMGFMT_ */
|
||||
funcs->control(tvh->priv, TVI_CONTROL_VID_GET_FORMAT, &sh_video->format);
|
||||
if (IMGFMT_IS_RGB(sh_video->format) || IMGFMT_IS_BGR(sh_video->format))
|
||||
// if (IMGFMT_IS_RGB(sh_video->format) || IMGFMT_IS_BGR(sh_video->format))
|
||||
sh_video->format = 0x0;
|
||||
|
||||
/* set FPS and FRAMETIME */
|
||||
|
@ -32,13 +32,6 @@ static tvi_info_t info = {
|
||||
"under development"
|
||||
};
|
||||
|
||||
struct vid_fmt {
|
||||
int fmtid;
|
||||
int width;
|
||||
int height;
|
||||
int bytesperline;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
/* general */
|
||||
char *video_device;
|
||||
@ -81,16 +74,43 @@ static const char *device_pal[] = {
|
||||
|
||||
static int palette2depth(int palette)
|
||||
{
|
||||
if (palette == VIDEO_PALETTE_YUV420P)
|
||||
return 12;
|
||||
return 32;
|
||||
switch(palette)
|
||||
{
|
||||
case VIDEO_PALETTE_RGB555:
|
||||
return(15);
|
||||
case VIDEO_PALETTE_RGB565:
|
||||
return(16);
|
||||
case VIDEO_PALETTE_RGB24:
|
||||
return(24);
|
||||
case VIDEO_PALETTE_RGB32:
|
||||
return(32);
|
||||
case VIDEO_PALETTE_YUV420P:
|
||||
return(12);
|
||||
case VIDEO_PALETTE_YUV422:
|
||||
case VIDEO_PALETTE_UYVY:
|
||||
return(16);
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
static int format2palette(int format)
|
||||
{
|
||||
if (format == IMGFMT_YV12)
|
||||
return VIDEO_PALETTE_YUV420P;
|
||||
return VIDEO_PALETTE_RGB24;
|
||||
switch(format)
|
||||
{
|
||||
case IMGFMT_RGB15:
|
||||
return(VIDEO_PALETTE_RGB555);
|
||||
case IMGFMT_RGB16:
|
||||
return(VIDEO_PALETTE_RGB565);
|
||||
case IMGFMT_RGB24:
|
||||
return(VIDEO_PALETTE_RGB24);
|
||||
case IMGFMT_RGB32:
|
||||
return(VIDEO_PALETTE_RGB32);
|
||||
case IMGFMT_YV12:
|
||||
return(VIDEO_PALETTE_YUV420P);
|
||||
case IMGFMT_UYVY:
|
||||
return(VIDEO_PALETTE_YUV422);
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -220,7 +240,7 @@ static int init(priv_t *priv, tvi_param_t *params)
|
||||
{
|
||||
int i;
|
||||
|
||||
priv->fd = open(priv->video_device, O_RDONLY);
|
||||
priv->fd = open(priv->video_device, O_RDWR);
|
||||
if (priv->fd == -1)
|
||||
{
|
||||
printf("v4l: unable to open '%s': %s\n",
|
||||
@ -249,7 +269,7 @@ static int init(priv_t *priv, tvi_param_t *params)
|
||||
printf("priv->input: %d\n", priv->input);
|
||||
#endif
|
||||
|
||||
printf("Selected device: %s\n", priv->capability.name);
|
||||
printf("Selected device: %s\n", priv->capability.name);
|
||||
printf(" Capabilites: ");
|
||||
for (i = 0; device_cap[i] != NULL; i++)
|
||||
if (priv->capability.type & (1 << i))
|
||||
@ -299,11 +319,6 @@ static int init(priv_t *priv, tvi_param_t *params)
|
||||
if (priv->mmap == -1)
|
||||
{
|
||||
printf("Unabel to map memory for buffers: %s\n", strerror(errno));
|
||||
priv->mmap = malloc(priv->mbuf.size); /* our buffer */
|
||||
}
|
||||
if (!priv->mmap)
|
||||
{
|
||||
printf("Unable to allocate memory for buffers: %s\n", strerror(errno));
|
||||
goto err;
|
||||
}
|
||||
printf("our buffer: %p\n", priv->mmap);
|
||||
@ -441,7 +456,7 @@ static int control(priv_t *priv, int cmd, void *arg)
|
||||
(int)*(void **)arg = 1;
|
||||
return(TVI_CONTROL_TRUE);
|
||||
case TVI_CONTROL_VID_GET_BITS:
|
||||
(int)*(void **)arg = 12;
|
||||
(int)*(void **)arg = palette2depth(format2palette(priv->format));
|
||||
return(TVI_CONTROL_TRUE);
|
||||
case TVI_CONTROL_VID_GET_WIDTH:
|
||||
(int)*(void **)arg = priv->width;
|
||||
@ -451,8 +466,8 @@ static int control(priv_t *priv, int cmd, void *arg)
|
||||
int req_width = (int)*(void **)arg;
|
||||
|
||||
printf("Requested width: %d\n", req_width);
|
||||
if ((req_width > priv->capability.minwidth) &&
|
||||
(req_width < priv->capability.maxwidth))
|
||||
if ((req_width >= priv->capability.minwidth) &&
|
||||
(req_width <= priv->capability.maxwidth))
|
||||
return(TVI_CONTROL_TRUE);
|
||||
return(TVI_CONTROL_FALSE);
|
||||
}
|
||||
@ -467,8 +482,8 @@ static int control(priv_t *priv, int cmd, void *arg)
|
||||
int req_height = (int)*(void **)arg;
|
||||
|
||||
printf("Requested height: %d\n", req_height);
|
||||
if ((req_height > priv->capability.minheight) &&
|
||||
(req_height < priv->capability.maxheight))
|
||||
if ((req_height >= priv->capability.minheight) &&
|
||||
(req_height <= priv->capability.maxheight))
|
||||
return(TVI_CONTROL_TRUE);
|
||||
return(TVI_CONTROL_FALSE);
|
||||
}
|
||||
@ -654,7 +669,8 @@ static int grab_video_frame(priv_t *priv, char *buffer, int len)
|
||||
return(0);
|
||||
}
|
||||
|
||||
ioctl(priv->fd, VIDIOCSYNC, &priv->buf[frame]);
|
||||
if (ioctl(priv->fd, VIDIOCSYNC, &priv->buf[frame]) == -1)
|
||||
printf("ioctl sync failed: %s\n", strerror(errno));
|
||||
priv->queue++;
|
||||
|
||||
printf("mmap: %p + offset: %d => %p\n",
|
||||
|
Loading…
Reference in New Issue
Block a user