AVS4YOU

Content Plugin API - Developer Guide

Overview

Content Plugin is a plugin type that provides menu items, UI elements, and context-specific functionality. These plugins can add custom menu items to AVS4YOU application context menus, create custom dialogs, and interact with users.

Plugin Type

When implementing the PluginType() function, return:

Plugins::PluginType::Content

How to Create a Content Plugin

1. Project Structure

Create a dynamic-link library (DLL) project in Visual Studio or another IDE.

Required files:

2. Required Exported Functions

Your plugin must export the following functions:

Information functions (without instance creation):

Lifecycle management:

Instance operations:

3. Minimal Plugin Example

#define PLUGIN_EXPORTS
#include "CContentPluginIntf.h"
#include <string>

// Plugin data
class MyPlugin {
public:
    std::wstring language = L"en";
    void* parentWindow = nullptr;
    std::wstring tempPath;
};

// Information functions
PLUGIN_API Plugins::PluginType __stdcall PluginType() {
    return Plugins::PluginType::Content;
}

PLUGIN_API wchar_t* __stdcall PluginId() {
    return _wcsdup(L"com.example.myplugin");
}

PLUGIN_API wchar_t* __stdcall PluginName() {
    return _wcsdup(L"My Content Plugin");
}

PLUGIN_API wchar_t* __stdcall PluginVersion() {
    return _wcsdup(L"1.0.0");
}

PLUGIN_API bool __stdcall IsApplicationSupported(int appId) {
    // Support for AVS Video Editor
    return appId == AVS_VIDEO_EDITOR;
}

// Instance management
PLUGIN_API PluginHandle __stdcall CreatePlugin() {
    return new MyPlugin();
}

PLUGIN_API void __stdcall DeletePlugin(PluginHandle handle) {
    delete static_cast<MyPlugin*>(handle);
}

// String release
PLUGIN_API void __stdcall ReleasePluginString(wchar_t* str) {
    free(str);
}

API Reference

Plugin Lifecycle Management

CreatePlugin()

PLUGIN_API PluginHandle __stdcall CreatePlugin()

Description: Creates a new plugin instance.

Returns: Handle (pointer) to the created plugin instance.

Note: Memory must be released using DeletePlugin().


DeletePlugin(PluginHandle handle)

PLUGIN_API void __stdcall DeletePlugin(PluginHandle handle)

Description: Deletes a plugin instance and releases its resources.

Parameters:


Plugin Information

PluginType()

PLUGIN_API Plugins::PluginType __stdcall PluginType()

Description: Returns the plugin type.

Returns: Plugins::PluginType::Content


PluginId()

PLUGIN_API wchar_t* __stdcall PluginId()

Description: Returns the unique plugin identifier.

Returns: String containing the plugin ID (e.g., “com.company.pluginname”).

Note: Memory must be released using ReleasePluginString().


PluginName()

PLUGIN_API wchar_t* __stdcall PluginName()

Description: Returns the plugin name.

Returns: String containing the plugin name.

Note: Memory must be released using ReleasePluginString().


PluginVersion()

PLUGIN_API wchar_t* __stdcall PluginVersion()

Description: Returns the plugin version.

Returns: String containing the version (e.g., “1.0.0”).

Note: Memory must be released using ReleasePluginString().


PluginIcon(PluginHandle handle)

PLUGIN_API wchar_t* __stdcall PluginIcon(PluginHandle handle)

Description: Returns the path to the plugin icon.

Parameters:

Returns: String containing the icon file path.

Note: Memory must be released using ReleasePluginString().


IsApplicationSupported(int appId)

PLUGIN_API bool __stdcall IsApplicationSupported(int appId)

Description: Checks if the specified application is supported by the plugin.

Parameters:

Returns: true if the application is supported, otherwise false.

Application constants:


PluginInfo(PluginHandle handle)

PLUGIN_API wchar_t* __stdcall PluginInfo(PluginHandle handle)

Description: Returns additional information about the plugin in JSON format.

Parameters:

Returns: JSON string with additional information.

Note: Memory must be released using ReleasePluginString().


Memory Management

ReleasePluginString(wchar_t* str)

PLUGIN_API void __stdcall ReleasePluginString(wchar_t* str)

Description: Releases memory allocated for a plugin string.

Parameters:

Important: Must be called for ALL strings obtained from the plugin.


Plugin Configuration

SetLanguage(PluginHandle handle, const wchar_t* language)

PLUGIN_API void __stdcall SetLanguage(PluginHandle handle, const wchar_t* language)

Description: Sets the language for the plugin interface.

Parameters:

Purpose: Affects localization of menu items and UI elements.


SetParentWindow(PluginHandle handle, void* hwnd)

PLUGIN_API void __stdcall SetParentWindow(PluginHandle handle, void* hwnd)

Description: Sets the parent window for plugin dialogs.

Parameters:

Purpose: Used for proper modal dialog behavior and ownership.


SetTemporaryPath(PluginHandle handle, wchar_t* path)

PLUGIN_API void __stdcall SetTemporaryPath(PluginHandle handle, wchar_t* path)

Description: Sets the temporary files path for the plugin.

Parameters:

Purpose: Plugin should use this directory for any temporary files.


CleanTemporaryFiles(PluginHandle handle)

PLUGIN_API void __stdcall CleanTemporaryFiles(PluginHandle handle)

Description: Cleans up temporary files created by the plugin.

Parameters:

When to call: Should be called when plugin is no longer needed.


CleanCachedData(PluginHandle handle)

PLUGIN_API void __stdcall CleanCachedData(PluginHandle handle)

Description: Cleans up cached data created by the plugin.

Parameters:

When to call: Should be called before plugin is uninstalled.


GetMenuForContext(PluginHandle handle, Plugins::ContextType context)

PLUGIN_API wchar_t* __stdcall GetMenuForContext(PluginHandle handle, Plugins::ContextType context)

Description: Gets the menu structure for a specific context.

Parameters:

Returns: XML or JSON string describing the context menu structure.

Note: Memory must be released using ReleasePluginString().

Context types:


GetPluginMenu(PluginHandle handle)

PLUGIN_API wchar_t* __stdcall GetPluginMenu(PluginHandle handle)

Description: Gets the main plugin menu structure.

Parameters:

Returns: XML or JSON string describing the plugin menu structure.

Note: Memory must be released using ReleasePluginString().


GetIconById(PluginHandle handle, int iconId)

PLUGIN_API wchar_t* __stdcall GetIconById(PluginHandle handle, int iconId)

Description: Gets an icon by its identifier.

Parameters:

Returns: String containing icon path or data.

Note: Memory must be released using ReleasePluginString().


ClickMenuItem(PluginHandle handle, int itemId)

PLUGIN_API void __stdcall ClickMenuItem(PluginHandle handle, int itemId)

Description: Handles a menu item click event.

Parameters:

Purpose: Called when user clicks a menu item provided by the plugin.


Callback Management

SetCallbackHandler(PluginHandle handle, AsyncCallback callback, void* userData)

PLUGIN_API void __stdcall SetCallbackHandler(PluginHandle handle, AsyncCallback callback, void* userData)

Description: Sets the callback handler for asynchronous operations.

Parameters:

AsyncCallback type:

typedef void (*AsyncCallback)(wchar_t*, wchar_t*, int, void*);

Purpose: Used for notifications and asynchronous operation results.


Development Guidelines

1. Memory Management

2. Thread Safety

3. Error Handling

4. Testing


Usage Examples

{
  "items": [
    {
      "id": 1,
      "title": "My Plugin Action",
      "icon": 100
    },
    {
      "id": 2,
      "title": "Settings",
      "icon": 101
    }
  ]
}
PLUGIN_API void __stdcall ClickMenuItem(PluginHandle handle, int itemId) {
    MyPlugin* plugin = static_cast<MyPlugin*>(handle);

    switch(itemId) {
        case 1:
            // Perform action
            DoAction(plugin);
            break;
        case 2:
            // Open settings
            ShowSettings(plugin);
            break;
    }
}

SDK Package

All required header files are located in the sdk/include/ directory:


Additional Resources


Document version: 1.0 Last updated: 2026-01-23