Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Normally you would follow the instructions in the <a href="http://www.gstreamer.net/data/doc/gstreamer/head/manual/html/chapter-init.html" rel="nofollow noreferrer">manual</a>, and pass pointers to the arguments provided by <code>main</code>, so that gstreamer can remove the arguments which it handles.</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;gst/gst.h&gt; int main ( int argc, char *argv[] ) { gst_init (&amp;argc, &amp;argv); // handle the remaining argc values of argv </code></pre> <p>If you want to create your own arguments, then create the same sort of array which <code>main</code> would have:</p> <pre><code>void gst_init(int *argc, char **argv[]) { // strip one argument --*argc; ++*argv; } void foo () { int argc = 2; char* args[] = {"myvalue1", "myvalue2"}; char** argv = args; for(int i= 0; i &lt; argc; ++i) printf("%s\n", argv[i]); gst_init(&amp;argc, &amp;argv); for(int i= 0; i &lt; argc; ++i) printf("%s\n", argv[i]); } </code></pre> <p>If you're not using C99, it's easier to have a separate pointer to the local array of string literals. Using C99, you could just write <code>char** argv = (char*[]){"myvalue1", "myvalue2"};</code> to start with a pointer to the first element in an anonymous array.</p> <p>You need to pass a pointer to a variable pointing to the array rather than a pointer to the first element in the array; in the first case the degradation of an array parameter to a pointer achieves the same effect as the second case declaring a pointer local variable - you then can pass the address of this variable and the function can modify it. sizeof( args) is 8 on a 32bit machine as the compiler deduces the number of elements in the array; sizeof(argv) is 4, therefore ++args would move the pointer to the end of the array rather than to the next element as ++argv does. The compiler protects you from such an operation.</p> <p>But normally you'd use it in the way the manual suggests.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload