0

ffmpeg を使用する C++ アプリケーションがあります。

私がやりたいことは、スレッド ベースのフィルター実行を独自のタスク スケジューラ ベースの実行に置き換えることです。

ただし、「カスタム」関数で関数ポインターを呼び出そうとするとすぐに、「カスタム」関数が ffmpeg のものとまったく同じであっても、アクセス違反が発生します。

何が原因でしょうか? ある種の呼び出し規約ですか?

例えば

struct AVFilterInternal {
    int (*execute)(AVFilterContext *ctx, int (*func)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs), void *arg,
                   int *ret, int nb_jobs);
};

static int custom_execute(AVFilterContext *ctx, int (*func)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs), void *arg,
                           int *ret, int nb_jobs)
{
    int i;

    for (i = 0; i < nb_jobs; i++) { // MY goal is to have this as tbb::parallel_for
        int r = func(ctx, arg, i, nb_jobs); // Access Violation. If I replace "func" with an inline implementation everything works fine.
        if (ret)
            ret[i] = r;
    }
    return 0;
}

void init()
{
     /* Create filter graph */

     // For each filter in filtergraph
     reinterpret_cast<AVFilterInternal*>(filter->internal)->execute = custom_execute;
}
4

0 に答える 0