Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

- [X] I looked for a similar issue and couldn't find any.
- [X] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
- [X] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95

Detailed guidelines: http://gpac.io/2013/07/16/how-to-file-a-bug-properly/

I'm working integrating `libgpac` into another framework. For now, I'm trying to build simple applications to understand the basics of gpac. The simplest I came out with is one that creates a file using the `fout` filter and dumps some bytes to disk. The bytes comes from outside the gpac filter session.

```c

#include <stdio.h>
#include <stdlib.h>

#include <gpac/filters.h>

/// @brief Print the input and output PIDs of a filter
/// @param filter 
static void print_filter(GF_Filter *filter) {

    // iterate over filter input PIDs
    u32 input_pid_count = gf_filter_get_ipid_count(filter);
    printf("is source : %s\n", gf_filter_is_source(filter) ? "true" : "false");
    printf("is sink   : %s\n", gf_filter_is_sink(filter) ? "true" : "false");
    printf("input PIDs: %u\n", input_pid_count);
    for (u32 i = 0; i < input_pid_count; ++i)
    {
        GF_FilterPid *input_pid = gf_filter_get_ipid(filter, i);
        const char *pid_name = gf_filter_pid_get_name(input_pid);
        printf("  %u: %s\n", i, pid_name);
    }

    // iterate over filter output PIDs
    u32 output_pid_count = gf_filter_get_opid_count(filter);
    printf("output PIDs: %u\n", output_pid_count);
    for (u32 i = 0; i < output_pid_count; ++i)
    {
        GF_FilterPid *output_pid = gf_filter_get_ipid(filter, i);
        const char *pid_name = gf_filter_pid_get_name(output_pid);
        printf("  %u: %s\n", i, pid_name);
    }
}

int main(int argc, char *argv[])
{
    GF_FilterSession *session = gf_fs_new_defaults(0u);
    if (session == NULL) {
        fprintf(stderr, "Failed to create GPAC session\n");
        return EXIT_FAILURE;
    }

    GF_Err gf_err = GF_OK;
    GF_Filter *filter = gf_fs_load_filter(session, "fout:dst=from_gpac.ts", &gf_err);
    if (gf_err != GF_OK)
    {
        fprintf(stderr, "Failed to load filter: %s", gf_error_to_string(gf_err));
    }

    // this prints the correct destination file
    GF_PropertyValue prop_value;
    gf_filter_get_arg(filter, "dst", &prop_value);
    printf("filter dst: %s\n", prop_value.value.string);

    // 0 input  PIDs
    // 0 output PIDs (expected)
    print_filter(filter);

    u8 buffer_data[188];
    for (u32 i = 0; i < 10; ++i) {
        
        // fill the data with some content
        for (u32 j = 0; j < 188; ++j) {
            buffer_data[j] = (u8)i;
        }

        // TODO: create a packet to send to the filter
        // TODO: push the packet to the filter
        // TODO: run the session (blocking mode?)
        // gf_fs_run(session);
    }

    
    gf_fs_del(session);
    session = NULL;

    return EXIT_SUCCESS;
}

```

Running the code prints:

```
filter dst: from_gpac.ts
is source : false
is sink   : true
input PIDs: 0
output PIDs: 0
```

I have problems figuring out how to get input PID from the `fout` filter to feed the buffer to store in the file.

The closest issue to mine is https://github.com/gpac/gpac/issues/2190 which suggests the creation of custom filters for handling communication in and out of the gpac filter graph.

Is there another example I could look at?

How to push data to a filter session from application code
This is a GitHub Issue
repo:gpac
owner:gpac
Title : How to push data to a filter session from application code
Issue date:

--- start body ---
Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

- [X] I looked for a similar issue and couldn't find any.
- [X] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
- [X] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95

Detailed guidelines: http://gpac.io/2013/07/16/how-to-file-a-bug-properly/

I'm working integrating `libgpac` into another framework. For now, I'm trying to build simple applications to understand the basics of gpac. The simplest I came out with is one that creates a file using the `fout` filter and dumps some bytes to disk. The bytes comes from outside the gpac filter session.

```c

#include <stdio.h>
#include <stdlib.h>

#include <gpac/filters.h>

/// @brief Print the input and output PIDs of a filter
/// @param filter 
static void print_filter(GF_Filter *filter) {

    // iterate over filter input PIDs
    u32 input_pid_count = gf_filter_get_ipid_count(filter);
    printf("is source : %s\n", gf_filter_is_source(filter) ? "true" : "false");
    printf("is sink   : %s\n", gf_filter_is_sink(filter) ? "true" : "false");
    printf("input PIDs: %u\n", input_pid_count);
    for (u32 i = 0; i < input_pid_count; ++i)
    {
        GF_FilterPid *input_pid = gf_filter_get_ipid(filter, i);
        const char *pid_name = gf_filter_pid_get_name(input_pid);
        printf("  %u: %s\n", i, pid_name);
    }

    // iterate over filter output PIDs
    u32 output_pid_count = gf_filter_get_opid_count(filter);
    printf("output PIDs: %u\n", output_pid_count);
    for (u32 i = 0; i < output_pid_count; ++i)
    {
        GF_FilterPid *output_pid = gf_filter_get_ipid(filter, i);
        const char *pid_name = gf_filter_pid_get_name(output_pid);
        printf("  %u: %s\n", i, pid_name);
    }
}

int main(int argc, char *argv[])
{
    GF_FilterSession *session = gf_fs_new_defaults(0u);
    if (session == NULL) {
        fprintf(stderr, "Failed to create GPAC session\n");
        return EXIT_FAILURE;
    }

    GF_Err gf_err = GF_OK;
    GF_Filter *filter = gf_fs_load_filter(session, "fout:dst=from_gpac.ts", &gf_err);
    if (gf_err != GF_OK)
    {
        fprintf(stderr, "Failed to load filter: %s", gf_error_to_string(gf_err));
    }

    // this prints the correct destination file
    GF_PropertyValue prop_value;
    gf_filter_get_arg(filter, "dst", &prop_value);
    printf("filter dst: %s\n", prop_value.value.string);

    // 0 input  PIDs
    // 0 output PIDs (expected)
    print_filter(filter);

    u8 buffer_data[188];
    for (u32 i = 0; i < 10; ++i) {
        
        // fill the data with some content
        for (u32 j = 0; j < 188; ++j) {
            buffer_data[j] = (u8)i;
        }

        // TODO: create a packet to send to the filter
        // TODO: push the packet to the filter
        // TODO: run the session (blocking mode?)
        // gf_fs_run(session);
    }

    
    gf_fs_del(session);
    session = NULL;

    return EXIT_SUCCESS;
}

```

Running the code prints:

```
filter dst: from_gpac.ts
is source : false
is sink   : true
input PIDs: 0
output PIDs: 0
```

I have problems figuring out how to get input PID from the `fout` filter to feed the buffer to store in the file.

The closest issue to mine is https://github.com/gpac/gpac/issues/2190 which suggests the creation of custom filters for handling communication in and out of the gpac filter graph.

Is there another example I could look at?

--- end body ---
