<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Remi,<div><br></div><div><div><div>Am 11.05.2014 um 03:42 schrieb Rémi Denis-Courmont <<a href="mailto:remi@remlab.net">remi@remlab.net</a>>:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Le 2014-05-10 18:42,<span class="Apple-converted-space"> </span><a href="mailto:david.fuhrmann@gmail.com">david.fuhrmann@gmail.com</a><span class="Apple-converted-space"> </span>a écrit :<br><blockquote type="cite">From: David Fuhrmann <<a href="mailto:dfuhrmann@videolan.org">dfuhrmann@videolan.org</a>><br><br>This flag can be used with input_item_AddOption to replace the value<br>of an input option, if this option already exists. Otherwise, the<br>new option is added as usual.<br><br>This can be used for instance to change the starttime option.<br><br>refs #11471<br>---<br>include/vlc_input_item.h | 5 +++++<br>src/input/item.c | 23 +++++++++++++++++++++++<br>2 files changed, 28 insertions(+)<br><br>diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h<br>index 944ac2f..d8ffd34 100644<br>--- a/include/vlc_input_item.h<br>+++ b/include/vlc_input_item.h<br>@@ -179,6 +179,11 @@ enum input_item_option_e<br> /* Add the option, unless the same option<br> * is already present. */<br> VLC_INPUT_OPTION_UNIQUE = 0x100,<br>+<br>+ /* Search for an existing option in the format<br>+ * option=value and replaces the first one found.<br>+ * Else, the new option is added. */<br>+ VLC_INPUT_OPTION_REPLACE = 0x400,<br>};<br><br>/**<br>diff --git a/src/input/item.c b/src/input/item.c<br>index b27250b..36e1279 100644<br>--- a/src/input/item.c<br>+++ b/src/input/item.c<br>@@ -473,6 +473,29 @@ int input_item_AddOption( input_item_t *p_input,<br>const char *psz_option,<br> goto out;<br> }<br><br>+ if (flags & VLC_INPUT_OPTION_REPLACE)<br></blockquote><br>That won't work if UNIQUE was set too.<br></div></blockquote><div><br></div><div>UNIQUE and REPLACE are mutually exclusive. I will add this to the documentation. If someone still passes both flags, it looks fine that UNIQUE as the the „stronger“ variant take precedence. </div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br><blockquote type="cite">+ {<br>+ /* search for option format "option=value" */<br>+<br>+ const char *psz_found = strchr( psz_option, '=' );<br>+ if( unlikely( psz_found == NULL ) )<br>+ {<br>+ err = VLC_EGENERIC;<br>+ goto out;<br></blockquote><br>Uh, that does not seem right?<br></div></blockquote><div><br></div></div>Looks like no caller checks for the return value anyway. So it make sense to have a softer fallback, indeed.</div><div><br></div><div>With best regards,</div><div>David</div></body></html>