[MPlayer-cvslog] CVS: main/libvo vo_jpeg.c, 1.24, 1.25 vo_md5sum.c, 1.2, 1.3 vo_pnm.c, 1.3, 1.4 vo_yuv4mpeg.c, 1.20, 1.21
Reimar Döffinger CVS
syncmail at mplayerhq.hu
Wed Jan 19 18:10:23 CET 2005
CVS change done by Reimar Döffinger CVS
Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv11220/libvo
Modified Files:
vo_jpeg.c vo_md5sum.c vo_pnm.c vo_yuv4mpeg.c
Log Message:
New suboption type: malloc'ed, zero terminated string
Index: vo_jpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_jpeg.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- vo_jpeg.c 15 Jan 2005 23:53:08 -0000 1.24
+++ vo_jpeg.c 19 Jan 2005 17:10:20 -0000 1.25
@@ -325,7 +325,6 @@
static uint32_t preinit(const char *arg)
{
- strarg_t outdir = {0, NULL}, subdirs = {0, NULL};
opt_t subopts[] = {
{"progressive", OPT_ARG_BOOL, &jpeg_progressive_mode, NULL},
{"baseline", OPT_ARG_BOOL, &jpeg_baseline, NULL},
@@ -335,8 +334,8 @@
(opt_test_f)int_zero_hundred},
{"quality", OPT_ARG_INT, &jpeg_quality,
(opt_test_f)int_zero_hundred},
- {"outdir", OPT_ARG_STR, &outdir, NULL},
- {"subdirs", OPT_ARG_STR, &subdirs, NULL},
+ {"outdir", OPT_ARG_MSTRZ, &jpeg_outdir, NULL},
+ {"subdirs", OPT_ARG_MSTRZ, &jpeg_subdirs, NULL},
{"maxfiles", OPT_ARG_INT, &jpeg_maxfiles, (opt_test_f)int_pos},
{NULL}
};
@@ -351,25 +350,13 @@
jpeg_smooth = 0;
jpeg_quality = 75;
jpeg_maxfiles = 1000;
+ jpeg_outdir = strdup(".");
+ jpeg_subdirs = NULL;
if (subopt_parse(arg, subopts) != 0) {
return -1;
}
- if (outdir.len) {
- jpeg_outdir = malloc(outdir.len + 1);
- memcpy(jpeg_outdir, outdir.str, outdir.len);
- jpeg_outdir[outdir.len] = '\0';
- } else {
- jpeg_outdir = strdup(".");
- }
-
- if (subdirs.len) {
- jpeg_subdirs = malloc(subdirs.len + 1);
- memcpy(jpeg_subdirs, subdirs.str, subdirs.len);
- jpeg_subdirs[subdirs.len] = '\0';
- }
-
if (jpeg_progressive_mode) info_message = MSGTR_VO_JPEG_ProgressiveJPEG;
else info_message = MSGTR_VO_JPEG_NoProgressiveJPEG;
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, info_message);
Index: vo_md5sum.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_md5sum.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- vo_md5sum.c 15 Jan 2005 23:54:49 -0000 1.2
+++ vo_md5sum.c 19 Jan 2005 17:10:20 -0000 1.3
@@ -103,9 +103,8 @@
static uint32_t preinit(const char *arg)
{
- strarg_t outfile = {0, NULL};
opt_t subopts[] = {
- {"outfile", OPT_ARG_STR, &outfile, NULL},
+ {"outfile", OPT_ARG_MSTRZ, &md5sum_outfile, NULL},
{NULL}
};
@@ -114,18 +113,11 @@
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name,
MSGTR_VO_ParsingSuboptions);
+ md5sum_outfile = strdup("md5sums");
if (subopt_parse(arg, subopts) != 0) {
return -1;
}
- if (outfile.len) {
- md5sum_outfile = malloc(outfile.len + 1);
- memcpy(md5sum_outfile, outfile.str, outfile.len);
- md5sum_outfile[outfile.len] = '\0';
- } else {
- md5sum_outfile = strdup("md5sums");
- }
-
mp_msg(MSGT_VO, MSGL_V, "%s: outfile --> %s\n", info.short_name,
md5sum_outfile);
Index: vo_pnm.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_pnm.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- vo_pnm.c 15 Jan 2005 21:21:07 -0000 1.3
+++ vo_pnm.c 19 Jan 2005 17:10:20 -0000 1.4
@@ -130,16 +130,14 @@
{
int ppm_type = 0, pgm_type = 0, pgmyuv_type = 0,
raw_mode = 0, ascii_mode = 0;
- strarg_t outdir = {0, NULL},
- subdirs = {0, NULL};
opt_t subopts[] = {
{"ppm", OPT_ARG_BOOL, &ppm_type, NULL},
{"pgm", OPT_ARG_BOOL, &pgm_type, NULL},
{"pgmyuv", OPT_ARG_BOOL, &pgmyuv_type, NULL},
{"raw", OPT_ARG_BOOL, &raw_mode, NULL},
{"ascii", OPT_ARG_BOOL, &ascii_mode, NULL},
- {"outdir", OPT_ARG_STR, &outdir, NULL},
- {"subdirs", OPT_ARG_STR, &subdirs, NULL},
+ {"outdir", OPT_ARG_MSTRZ, &pnm_outdir, NULL},
+ {"subdirs", OPT_ARG_MSTRZ, &pnm_subdirs, NULL},
{"maxfiles", OPT_ARG_INT, &pnm_maxfiles, (opt_test_f)int_pos},
{NULL}
};
@@ -149,6 +147,8 @@
MSGTR_VO_ParsingSuboptions);
pnm_maxfiles = 1000;
+ pnm_outdir = strdup(".");
+ pnm_subdirs = NULL;
if (subopt_parse(arg, subopts) != 0) {
return -1;
@@ -163,20 +163,6 @@
if (ascii_mode) pnm_mode = PNM_ASCII_MODE;
if (raw_mode) pnm_mode = PNM_RAW_MODE;
- if (outdir.len) {
- pnm_outdir = malloc(outdir.len + 1);
- memcpy(pnm_outdir, outdir.str, outdir.len);
- pnm_outdir[outdir.len] = '\0';
- } else {
- pnm_outdir = strdup(".");
- }
-
- if (subdirs.len) {
- pnm_subdirs = malloc(subdirs.len + 1);
- memcpy(pnm_subdirs, subdirs.str, subdirs.len);
- pnm_subdirs[subdirs.len] = '\0';
- }
-
switch (pnm_mode) {
case PNM_ASCII_MODE:
info_message = MSGTR_VO_PNM_ASCIIMode;
Index: vo_yuv4mpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_yuv4mpeg.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- vo_yuv4mpeg.c 31 Dec 2004 14:54:58 -0000 1.20
+++ vo_yuv4mpeg.c 19 Jan 2005 17:10:20 -0000 1.21
@@ -141,12 +141,12 @@
write_bytes = image_width * image_height * 3 / 2;
image = malloc(write_bytes);
- yuv_out = fopen(yuv_filename ? yuv_filename : "stream.yuv", "wb");
+ yuv_out = fopen(yuv_filename, "wb");
if (!yuv_out || image == 0)
{
mp_msg(MSGT_VO,MSGL_FATAL,
MSGTR_VO_YUV4MPEG_OutFileOpenError,
- yuv_filename ? yuv_filename : "stream.yuv");
+ yuv_filename);
return -1;
}
image_y = image;
@@ -496,17 +496,16 @@
static uint32_t preinit(const char *arg)
{
int il, il_bf;
- strarg_t file;
opt_t subopts[] = {
{"interlaced", OPT_ARG_BOOL, &il, NULL},
{"interlaced_bf", OPT_ARG_BOOL, &il_bf, NULL},
- {"file", OPT_ARG_STR, &file, NULL},
+ {"file", OPT_ARG_MSTRZ, &yuv_filename, NULL},
{NULL}
};
il = 0;
il_bf = 0;
- file.len = 0;
+ yuv_filename = strdup("stream.yuv");
if (subopt_parse(arg, subopts) != 0) {
mp_msg(MSGT_VO, MSGL_FATAL, MSGTR_VO_YUV4MPEG_UnknownSubDev, arg);
return -1;
@@ -517,12 +516,6 @@
config_interlace = Y4M_ILACE_TOP_FIRST;
if (il_bf)
config_interlace = Y4M_ILACE_BOTTOM_FIRST;
- yuv_filename = NULL;
- if (file.len > 0) {
- yuv_filename = malloc(file.len + 1);
- memcpy(yuv_filename, file.str, file.len);
- yuv_filename[file.len] = 0;
- }
/* Inform user which output mode is used */
switch (config_interlace)
More information about the MPlayer-cvslog
mailing list