[vlc-commits] vout: flaschen: refactor for next changes
Thomas Guillem
git at videolan.org
Tue Nov 27 15:48:51 CET 2018
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sun Oct 28 15:56:48 2018 +0100| [5eb4ddd7d4f00795b31adcf9809f8106d7f4579e] | committer: Steve Lhomme
vout: flaschen: refactor for next changes
vd->fmt and vd->cfg will be removed.
fmt and cfg will be passed by Open() and controls.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5eb4ddd7d4f00795b31adcf9809f8106d7f4579e
---
modules/video_output/flaschen.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/modules/video_output/flaschen.c b/modules/video_output/flaschen.c
index 62ae1327e9..565b88c894 100644
--- a/modules/video_output/flaschen.c
+++ b/modules/video_output/flaschen.c
@@ -90,6 +90,7 @@ static int Control(vout_display_t *, int, va_list);
static int Open(vlc_object_t *object)
{
vout_display_t *vd = (vout_display_t *)object;
+ video_format_t *fmtp = &vd->fmt;
vout_display_sys_t *sys;
int fd;
const unsigned port = 1337;
@@ -101,7 +102,7 @@ static int Open(vlc_object_t *object)
sys->fd = -1;
/* */
- video_format_t fmt = vd->fmt;
+ video_format_t fmt = *fmtp;
fmt.i_chroma = VLC_CODEC_RGB24;
/* TODO: check if this works on big-endian systems */
fmt.i_rmask = 0xff0000;
@@ -140,7 +141,7 @@ static int Open(vlc_object_t *object)
setsockopt (fd, SOL_SOCKET, SO_RCVBUF, &(int){ 0 }, sizeof (int));
- vd->fmt = fmt;
+ *fmtp = fmt;
vd->pool = Pool;
vd->prepare = NULL;
@@ -178,16 +179,17 @@ static void Display(vout_display_t *vd, picture_t *picture)
const long iovmax = sysconf(_SC_IOV_MAX);
#endif
vout_display_sys_t *sys = vd->sys;
+ video_format_t *fmt = &picture->format;
int result;
char buffer[64];
int header_len = snprintf(buffer, sizeof(buffer), "P6\n%d %d\n255\n",
- vd->fmt.i_width, vd->fmt.i_height);
+ fmt->i_width, fmt->i_height);
/* TODO: support offset_{x,y,z}? (#FT:...) */
/* Note the protocol doesn't include any picture order field. */
/* (maybe add as comment?) */
- int iovcnt = 1 + vd->fmt.i_height;
+ int iovcnt = 1 + fmt->i_height;
if (unlikely(iovcnt > iovmax))
return;
@@ -199,7 +201,7 @@ static void Display(vout_display_t *vd, picture_t *picture)
for (int i = 1; i < iovcnt; i++)
{
iov[i].iov_base = src;
- iov[i].iov_len = vd->fmt.i_width * 3;
+ iov[i].iov_len = fmt->i_width * 3;
src += picture->p->i_pitch;
}
@@ -215,7 +217,7 @@ static void Display(vout_display_t *vd, picture_t *picture)
result = sendmsg(sys->fd, &hdr, 0);
if (result < 0)
msg_Err(vd, "sendmsg: error %s in vout display flaschen", vlc_strerror_c(errno));
- else if (result < (int)(header_len + vd->fmt.i_width * vd->fmt.i_height * 3))
+ else if (result < (int)(header_len + fmt->i_width * fmt->i_height * 3))
msg_Err(vd, "sendmsg only sent %d bytes in vout display flaschen", result);
/* we might want to drop some frames? */
}
More information about the vlc-commits
mailing list