zhuizhu 8 luni în urmă
părinte
comite
151dd6c5da

+ 0 - 173
AvPlayer2/interfaces/IAudioRenderer.h

@@ -1,173 +0,0 @@
-#ifndef IAUDIORENDERER_H
-#define IAUDIORENDERER_H
-
-#include <functional>
-#include <memory>
-#include <vector>
-
-namespace AVPlayer2 {
-namespace Core {
-
-/**
- * 音频渲染器状态枚举
- */
-enum class AudioRendererState {
-    Stopped,    // 停止状态
-    Playing,    // 播放状态
-    Paused,     // 暂停状态
-    Error       // 错误状态
-};
-
-} // namespace Core
-
-namespace Types {
-
-/**
- * 音频格式参数
- */
-struct AudioFormat {
-    int sampleRate;     // 采样率
-    int channels;       // 声道数
-    int bitsPerSample;  // 位深度
-    int frameSize;      // 帧大小
-};
-
-} // namespace Types
-
-namespace Core {
-
-/**
- * 音频渲染器抽象接口
- * 提供与平台无关的音频输出功能
- */
-class IAudioRenderer {
-public:
-    virtual ~IAudioRenderer() = default;
-
-    /**
-     * 初始化音频渲染器
-     * @param format 音频格式参数
-     * @return 是否初始化成功
-     */
-    virtual bool initialize(const Types::AudioFormat& format) = 0;
-
-    /**
-     * 开始播放
-     * @return 是否开始成功
-     */
-    virtual bool start() = 0;
-
-    /**
-     * 停止播放
-     */
-    virtual void stop() = 0;
-
-    /**
-     * 暂停播放
-     */
-    virtual void pause() = 0;
-
-    /**
-     * 恢复播放
-     */
-    virtual void resume() = 0;
-
-    /**
-     * 写入音频数据
-     * @param data 音频数据指针
-     * @param size 数据大小(字节)
-     * @return 实际写入的字节数
-     */
-    virtual int writeData(const char* data, int size) = 0;
-
-    /**
-     * 设置音量
-     * @param volume 音量值 (0.0 - 1.0)
-     */
-    virtual void setVolume(float volume) = 0;
-
-    /**
-     * 获取当前音量
-     * @return 当前音量值 (0.0 - 1.0)
-     */
-    virtual float getVolume() const = 0;
-
-    /**
-     * 设置静音状态
-     * @param muted 是否静音
-     */
-    virtual void setMuted(bool muted) = 0;
-
-    /**
-     * 获取静音状态
-     * @return 是否静音
-     */
-    virtual bool isMuted() const = 0;
-
-    /**
-     * 获取当前状态
-     * @return 渲染器状态
-     */
-    virtual AudioRendererState getState() const = 0;
-
-    /**
-     * 获取缓冲区大小
-     * @return 缓冲区大小(字节)
-     */
-    virtual int getBufferSize() const = 0;
-
-    /**
-     * 获取可用缓冲区大小
-     * @return 可用缓冲区大小(字节)
-     */
-    virtual int getAvailableBufferSize() const = 0;
-
-    /**
-     * 清空缓冲区
-     */
-    virtual void clearBuffer() = 0;
-
-    /**
-     * 设置状态变化回调
-     * @param callback 状态变化回调函数
-     */
-    virtual void setStateCallback(std::function<void(AudioRendererState)> callback) = 0;
-
-    /**
-     * 设置缓冲区不足回调
-     * @param callback 缓冲区不足回调函数
-     */
-    virtual void setUnderrunCallback(std::function<void()> callback) = 0;
-};
-
-/**
- * 音频渲染器工厂接口
- */
-class IAudioRendererFactory {
-public:
-    virtual ~IAudioRendererFactory() = default;
-
-    /**
-     * 创建音频渲染器实例
-     * @return 音频渲染器智能指针
-     */
-    virtual std::unique_ptr<IAudioRenderer> createRenderer() = 0;
-
-    /**
-     * 获取支持的音频格式列表
-     * @return 支持的音频格式列表
-     */
-    virtual std::vector<Types::AudioFormat> getSupportedFormats() = 0;
-
-    /**
-     * 检查是否支持指定格式
-     * @param format 音频格式
-     * @return 是否支持
-     */
-    virtual bool isFormatSupported(const Types::AudioFormat& format) = 0;
-};
-
-} // namespace Core
-} // namespace AVPlayer2
-
-#endif // IAUDIORENDERER_H

+ 0 - 475
AvPlayer2/interfaces/IBufferManager.h

@@ -1,475 +0,0 @@
-#ifndef IBUFFERMANAGER_H
-#define IBUFFERMANAGER_H
-
-#include <memory>
-#include <functional>
-#include <chrono>
-#include <string>
-#include <vector>
-
-namespace AVPlayer2 {
-namespace Core {
-
-/**
- * 缓冲区状态枚举
- */
-enum class BufferState {
-    Empty,          // 空缓冲区
-    Filling,        // 填充中
-    Ready,          // 准备就绪
-    Full,           // 缓冲区满
-    Draining,       // 排空中
-    Error           // 错误状态
-};
-
-/**
- * 缓冲区类型枚举
- */
-enum class BufferType {
-    Audio,          // 音频缓冲区
-    Video,          // 视频缓冲区
-    Subtitle,       // 字幕缓冲区
-    Packet,         // 数据包缓冲区
-    Frame           // 帧缓冲区
-};
-
-/**
- * 缓冲策略枚举
- */
-enum class BufferStrategy {
-    FixedSize,      // 固定大小
-    DynamicSize,    // 动态大小
-    TimeBased,      // 基于时间
-    AdaptiveSize    // 自适应大小
-};
-
-} // namespace Core
-
-namespace Types {
-
-/**
- * 缓冲区配置
- */
-struct BufferConfig {
-    Core::BufferType type;              // 缓冲区类型
-    Core::BufferStrategy strategy;      // 缓冲策略
-    size_t maxSize;                     // 最大大小(字节)
-    size_t minSize;                     // 最小大小(字节)
-    int maxCount;                       // 最大数量
-    int minCount;                       // 最小数量
-    std::chrono::milliseconds maxDuration;     // 最大时长
-    std::chrono::milliseconds minDuration;     // 最小时长
-    double lowWaterMark;                // 低水位标记(0.0-1.0)
-    double highWaterMark;               // 高水位标记(0.0-1.0)
-    bool enablePreallocation;           // 启用预分配
-    bool enableMemoryPool;              // 启用内存池
-    
-    BufferConfig() {
-        type = Core::BufferType::Audio;
-        strategy = Core::BufferStrategy::FixedSize;
-        maxSize = 1024 * 1024;  // 1MB
-        minSize = 64 * 1024;    // 64KB
-        maxCount = 100;
-        minCount = 10;
-        maxDuration = std::chrono::milliseconds(5000);  // 5秒
-        minDuration = std::chrono::milliseconds(1000);  // 1秒
-        lowWaterMark = 0.2;
-        highWaterMark = 0.8;
-        enablePreallocation = true;
-        enableMemoryPool = true;
-    }
-};
-
-/**
- * 缓冲区统计信息
- */
-struct BufferStats {
-    Core::BufferType type;              // 缓冲区类型
-    Core::BufferState state;            // 当前状态
-    size_t currentSize;                 // 当前大小(字节)
-    size_t maxSize;                     // 最大大小(字节)
-    int currentCount;                   // 当前数量
-    int maxCount;                       // 最大数量
-    std::chrono::milliseconds currentDuration;  // 当前时长
-    std::chrono::milliseconds maxDuration;      // 最大时长
-    double fillLevel;                   // 填充级别(0.0-1.0)
-    double utilizationRate;             // 利用率(0.0-1.0)
-    int underrunCount;                  // 下溢次数
-    int overrunCount;                   // 上溢次数
-    double averageInputRate;            // 平均输入速率(字节/秒)
-    double averageOutputRate;           // 平均输出速率(字节/秒)
-    std::chrono::microseconds lastInputTime;    // 最后输入时间
-    std::chrono::microseconds lastOutputTime;   // 最后输出时间
-    
-    BufferStats() {
-        type = Core::BufferType::Audio;
-        state = Core::BufferState::Empty;
-        currentSize = 0;
-        maxSize = 0;
-        currentCount = 0;
-        maxCount = 0;
-        currentDuration = std::chrono::milliseconds(0);
-        maxDuration = std::chrono::milliseconds(0);
-        fillLevel = 0.0;
-        utilizationRate = 0.0;
-        underrunCount = 0;
-        overrunCount = 0;
-        averageInputRate = 0.0;
-        averageOutputRate = 0.0;
-        lastInputTime = std::chrono::microseconds(0);
-        lastOutputTime = std::chrono::microseconds(0);
-    }
-};
-
-/**
- * 缓冲区项目信息
- */
-struct BufferItem {
-    std::string id;                     // 项目ID
-    std::shared_ptr<void> data;         // 数据指针
-    size_t size;                        // 数据大小
-    std::chrono::microseconds timestamp;        // 时间戳
-    std::chrono::microseconds duration;         // 持续时间
-    int priority;                       // 优先级
-    std::map<std::string, std::string> metadata;  // 元数据
-    
-    BufferItem() {
-        size = 0;
-        timestamp = std::chrono::microseconds(0);
-        duration = std::chrono::microseconds(0);
-        priority = 0;
-    }
-};
-
-/**
- * 内存池统计信息
- */
-struct MemoryPoolStats {
-    size_t totalAllocated;              // 总分配内存
-    size_t totalUsed;                   // 总使用内存
-    size_t totalFree;                   // 总空闲内存
-    int allocationCount;                // 分配次数
-    int deallocationCount;              // 释放次数
-    int poolHitCount;                   // 池命中次数
-    int poolMissCount;                  // 池未命中次数
-    double fragmentationRatio;          // 碎片率
-    
-    MemoryPoolStats() {
-        totalAllocated = 0;
-        totalUsed = 0;
-        totalFree = 0;
-        allocationCount = 0;
-        deallocationCount = 0;
-        poolHitCount = 0;
-        poolMissCount = 0;
-        fragmentationRatio = 0.0;
-    }
-};
-
-} // namespace Types
-
-namespace Core {
-
-/**
- * 缓冲区管理器抽象接口
- * 提供统一的缓冲区管理功能
- */
-class IBufferManager {
-public:
-    virtual ~IBufferManager() = default;
-
-    /**
-     * 初始化缓冲区管理器
-     * @param configs 缓冲区配置列表
-     * @return 是否初始化成功
-     */
-    virtual bool initialize(const std::vector<Types::BufferConfig>& configs) = 0;
-
-    /**
-     * 释放缓冲区管理器
-     */
-    virtual void release() = 0;
-
-    /**
-     * 启动缓冲区管理器
-     * @return 是否启动成功
-     */
-    virtual bool start() = 0;
-
-    /**
-     * 停止缓冲区管理器
-     */
-    virtual void stop() = 0;
-
-    /**
-     * 重置所有缓冲区
-     */
-    virtual void reset() = 0;
-
-    // ========== 缓冲区操作 ==========
-    
-    /**
-     * 创建缓冲区
-     * @param name 缓冲区名称
-     * @param config 缓冲区配置
-     * @return 是否创建成功
-     */
-    virtual bool createBuffer(const std::string& name, const Types::BufferConfig& config) = 0;
-
-    /**
-     * 销毁缓冲区
-     * @param name 缓冲区名称
-     * @return 是否销毁成功
-     */
-    virtual bool destroyBuffer(const std::string& name) = 0;
-
-    /**
-     * 清空缓冲区
-     * @param name 缓冲区名称
-     * @return 是否清空成功
-     */
-    virtual bool clearBuffer(const std::string& name) = 0;
-
-    /**
-     * 调整缓冲区大小
-     * @param name 缓冲区名称
-     * @param newConfig 新配置
-     * @return 是否调整成功
-     */
-    virtual bool resizeBuffer(const std::string& name, const Types::BufferConfig& newConfig) = 0;
-
-    // ========== 数据操作 ==========
-    
-    /**
-     * 向缓冲区写入数据
-     * @param name 缓冲区名称
-     * @param item 缓冲区项目
-     * @param blocking 是否阻塞等待
-     * @return 是否写入成功
-     */
-    virtual bool writeData(const std::string& name, const Types::BufferItem& item, bool blocking = false) = 0;
-
-    /**
-     * 从缓冲区读取数据
-     * @param name 缓冲区名称
-     * @param item 输出的缓冲区项目
-     * @param blocking 是否阻塞等待
-     * @return 是否读取成功
-     */
-    virtual bool readData(const std::string& name, Types::BufferItem& item, bool blocking = false) = 0;
-
-    /**
-     * 预览缓冲区数据(不移除)
-     * @param name 缓冲区名称
-     * @param item 输出的缓冲区项目
-     * @param index 预览索引(0为最前面)
-     * @return 是否预览成功
-     */
-    virtual bool peekData(const std::string& name, Types::BufferItem& item, int index = 0) = 0;
-
-    /**
-     * 跳过指定数量的数据项
-     * @param name 缓冲区名称
-     * @param count 跳过数量
-     * @return 实际跳过的数量
-     */
-    virtual int skipData(const std::string& name, int count) = 0;
-
-    /**
-     * 根据时间戳跳转
-     * @param name 缓冲区名称
-     * @param timestamp 目标时间戳
-     * @return 是否跳转成功
-     */
-    virtual bool seekToTimestamp(const std::string& name, std::chrono::microseconds timestamp) = 0;
-
-    // ========== 状态查询 ==========
-    
-    /**
-     * 获取缓冲区状态
-     * @param name 缓冲区名称
-     * @return 缓冲区状态
-     */
-    virtual BufferState getBufferState(const std::string& name) = 0;
-
-    /**
-     * 获取缓冲区统计信息
-     * @param name 缓冲区名称
-     * @return 统计信息
-     */
-    virtual Types::BufferStats getBufferStats(const std::string& name) = 0;
-
-    /**
-     * 获取所有缓冲区统计信息
-     * @return 所有缓冲区统计信息
-     */
-    virtual std::vector<Types::BufferStats> getAllBufferStats() = 0;
-
-    /**
-     * 检查缓冲区是否存在
-     * @param name 缓冲区名称
-     * @return 是否存在
-     */
-    virtual bool hasBuffer(const std::string& name) = 0;
-
-    /**
-     * 检查缓冲区是否为空
-     * @param name 缓冲区名称
-     * @return 是否为空
-     */
-    virtual bool isEmpty(const std::string& name) = 0;
-
-    /**
-     * 检查缓冲区是否已满
-     * @param name 缓冲区名称
-     * @return 是否已满
-     */
-    virtual bool isFull(const std::string& name) = 0;
-
-    /**
-     * 检查缓冲区是否达到低水位
-     * @param name 缓冲区名称
-     * @return 是否达到低水位
-     */
-    virtual bool isLowWaterMark(const std::string& name) = 0;
-
-    /**
-     * 检查缓冲区是否达到高水位
-     * @param name 缓冲区名称
-     * @return 是否达到高水位
-     */
-    virtual bool isHighWaterMark(const std::string& name) = 0;
-
-    /**
-     * 获取缓冲区可用空间
-     * @param name 缓冲区名称
-     * @return 可用空间(字节)
-     */
-    virtual size_t getAvailableSpace(const std::string& name) = 0;
-
-    /**
-     * 获取缓冲区已用空间
-     * @param name 缓冲区名称
-     * @return 已用空间(字节)
-     */
-    virtual size_t getUsedSpace(const std::string& name) = 0;
-
-    /**
-     * 获取缓冲区数据项数量
-     * @param name 缓冲区名称
-     * @return 数据项数量
-     */
-    virtual int getItemCount(const std::string& name) = 0;
-
-    /**
-     * 获取缓冲区时长
-     * @param name 缓冲区名称
-     * @return 缓冲区时长
-     */
-    virtual std::chrono::milliseconds getBufferDuration(const std::string& name) = 0;
-
-    // ========== 内存池管理 ==========
-    
-    /**
-     * 启用内存池
-     * @param enable 是否启用
-     */
-    virtual void enableMemoryPool(bool enable) = 0;
-
-    /**
-     * 获取内存池统计信息
-     * @return 内存池统计信息
-     */
-    virtual Types::MemoryPoolStats getMemoryPoolStats() = 0;
-
-    /**
-     * 清理内存池
-     */
-    virtual void cleanupMemoryPool() = 0;
-
-    /**
-     * 预分配内存
-     * @param size 预分配大小(字节)
-     * @param count 预分配数量
-     * @return 是否预分配成功
-     */
-    virtual bool preallocateMemory(size_t size, int count) = 0;
-
-    // ========== 回调设置 ==========
-    
-    /**
-     * 设置缓冲区状态变化回调
-     * @param callback 状态变化回调函数
-     */
-    virtual void setBufferStateChangedCallback(
-        std::function<void(const std::string&, BufferState, BufferState)> callback) = 0;
-
-    /**
-     * 设置低水位回调
-     * @param callback 低水位回调函数
-     */
-    virtual void setLowWaterMarkCallback(
-        std::function<void(const std::string&)> callback) = 0;
-
-    /**
-     * 设置高水位回调
-     * @param callback 高水位回调函数
-     */
-    virtual void setHighWaterMarkCallback(
-        std::function<void(const std::string&)> callback) = 0;
-
-    /**
-     * 设置缓冲区满回调
-     * @param callback 缓冲区满回调函数
-     */
-    virtual void setBufferFullCallback(
-        std::function<void(const std::string&)> callback) = 0;
-
-    /**
-     * 设置缓冲区空回调
-     * @param callback 缓冲区空回调函数
-     */
-    virtual void setBufferEmptyCallback(
-        std::function<void(const std::string&)> callback) = 0;
-
-    /**
-     * 设置错误回调
-     * @param callback 错误回调函数
-     */
-    virtual void setErrorCallback(
-        std::function<void(const std::string&, const std::string&)> callback) = 0;
-};
-
-/**
- * 缓冲区管理器工厂接口
- */
-class IBufferManagerFactory {
-public:
-    virtual ~IBufferManagerFactory() = default;
-
-    /**
-     * 创建缓冲区管理器实例
-     * @param name 管理器名称
-     * @return 缓冲区管理器智能指针
-     */
-    virtual std::unique_ptr<IBufferManager> createBufferManager(const std::string& name = "") = 0;
-
-    /**
-     * 获取默认缓冲区配置
-     * @param type 缓冲区类型
-     * @return 默认配置
-     */
-    virtual Types::BufferConfig getDefaultConfig(BufferType type) = 0;
-
-    /**
-     * 获取推荐的缓冲区大小
-     * @param type 缓冲区类型
-     * @return 推荐大小(字节)
-     */
-    virtual size_t getRecommendedBufferSize(BufferType type) = 0;
-};
-
-} // namespace Core
-} // namespace AVPlayer2
-
-#endif // IBUFFERMANAGER_H

+ 0 - 232
AvPlayer2/interfaces/IMediaDecoder.h

@@ -1,232 +0,0 @@
-#ifndef IMEDIADECODER_H
-#define IMEDIADECODER_H
-
-#include <functional>
-#include <memory>
-#include <vector>
-#include <string>
-
-namespace AVPlayer2 {
-namespace Core {
-
-/**
- * 解码器状态枚举
- */
-enum class DecoderState {
-    Idle,       // 空闲状态
-    Decoding,   // 解码中
-    Paused,     // 暂停状态
-    Stopped,    // 停止状态
-    Error       // 错误状态
-};
-
-/**
- * 媒体类型枚举
- */
-enum class MediaType {
-    Audio,      // 音频
-    Video,      // 视频
-    Subtitle    // 字幕
-};
-
-/**
- * 解码器类型枚举
- */
-enum class DecoderType {
-    Software,   // 软件解码
-    Hardware    // 硬件解码
-};
-
-} // namespace Core
-
-namespace Types {
-
-/**
- * 媒体包数据
- */
-struct MediaPacket {
-    unsigned char* data;        // 数据指针
-    int size;                   // 数据大小
-    double timestamp;           // 时间戳(秒)
-    int64_t pts;               // 显示时间戳
-    int64_t dts;               // 解码时间戳
-    int streamIndex;           // 流索引
-    bool isKeyFrame;           // 是否关键帧
-    Core::MediaType mediaType; // 媒体类型
-};
-
-/**
- * 解码器配置
- */
-struct DecoderConfig {
-    Core::DecoderType type;     // 解码器类型
-    std::string codecName;      // 编解码器名称
-    int threadCount;            // 线程数
-    bool enableHardwareAccel;   // 是否启用硬件加速
-    std::string hwAccelDevice;  // 硬件加速设备
-};
-
-/**
- * 解码统计信息
- */
-struct DecoderStats {
-    int framesDecoded;          // 已解码帧数
-    int framesDropped;          // 丢弃帧数
-    double averageDecodeTime;   // 平均解码时间(毫秒)
-    double currentFps;          // 当前解码帧率
-};
-
-} // namespace Types
-
-namespace Core {
-
-/**
- * 媒体解码器抽象接口
- * 提供与平台无关的媒体解码功能
- */
-class IMediaDecoder {
-public:
-    virtual ~IMediaDecoder() = default;
-
-    /**
-     * 初始化解码器
-     * @param config 解码器配置
-     * @return 是否初始化成功
-     */
-    virtual bool initialize(const Types::DecoderConfig& config) = 0;
-
-    /**
-     * 开始解码
-     * @return 是否开始成功
-     */
-    virtual bool start() = 0;
-
-    /**
-     * 停止解码
-     */
-    virtual void stop() = 0;
-
-    /**
-     * 暂停解码
-     */
-    virtual void pause() = 0;
-
-    /**
-     * 恢复解码
-     */
-    virtual void resume() = 0;
-
-    /**
-     * 输入媒体包进行解码
-     * @param packet 媒体包数据
-     * @return 是否输入成功
-     */
-    virtual bool inputPacket(const Types::MediaPacket& packet) = 0;
-
-    /**
-     * 获取解码后的音频帧
-     * @param audioFrame 输出音频帧数据
-     * @return 是否获取成功
-     */
-    virtual bool getAudioFrame(Types::AudioFrame& audioFrame) = 0;
-
-    /**
-     * 获取解码后的视频帧
-     * @param videoFrame 输出视频帧数据
-     * @return 是否获取成功
-     */
-    virtual bool getVideoFrame(Types::VideoFrame& videoFrame) = 0;
-
-    /**
-     * 刷新解码器缓冲区
-     */
-    virtual void flush() = 0;
-
-    /**
-     * 重置解码器
-     */
-    virtual void reset() = 0;
-
-    /**
-     * 获取当前状态
-     * @return 解码器状态
-     */
-    virtual DecoderState getState() const = 0;
-
-    /**
-     * 获取支持的媒体类型
-     * @return 支持的媒体类型列表
-     */
-    virtual std::vector<MediaType> getSupportedMediaTypes() const = 0;
-
-    /**
-     * 检查是否支持硬件加速
-     * @return 是否支持硬件加速
-     */
-    virtual bool isHardwareAccelSupported() const = 0;
-
-    /**
-     * 获取解码统计信息
-     * @return 解码统计信息
-     */
-    virtual Types::DecoderStats getStats() const = 0;
-
-    /**
-     * 设置状态变化回调
-     * @param callback 状态变化回调函数
-     */
-    virtual void setStateCallback(std::function<void(DecoderState)> callback) = 0;
-
-    /**
-     * 设置帧解码完成回调
-     * @param callback 帧解码完成回调函数
-     */
-    virtual void setFrameDecodedCallback(std::function<void(MediaType, double)> callback) = 0;
-
-    /**
-     * 设置解码错误回调
-     * @param callback 解码错误回调函数
-     */
-    virtual void setErrorCallback(std::function<void(const std::string&)> callback) = 0;
-};
-
-/**
- * 媒体解码器工厂接口
- */
-class IMediaDecoderFactory {
-public:
-    virtual ~IMediaDecoderFactory() = default;
-
-    /**
-     * 创建解码器实例
-     * @param mediaType 媒体类型
-     * @return 解码器智能指针
-     */
-    virtual std::unique_ptr<IMediaDecoder> createDecoder(MediaType mediaType) = 0;
-
-    /**
-     * 获取支持的编解码器列表
-     * @param mediaType 媒体类型
-     * @return 支持的编解码器名称列表
-     */
-    virtual std::vector<std::string> getSupportedCodecs(MediaType mediaType) = 0;
-
-    /**
-     * 检查是否支持指定编解码器
-     * @param codecName 编解码器名称
-     * @param mediaType 媒体类型
-     * @return 是否支持
-     */
-    virtual bool isCodecSupported(const std::string& codecName, MediaType mediaType) = 0;
-
-    /**
-     * 获取可用的硬件加速设备列表
-     * @return 硬件加速设备名称列表
-     */
-    virtual std::vector<std::string> getAvailableHwAccelDevices() = 0;
-};
-
-} // namespace Core
-} // namespace AVPlayer2
-
-#endif // IMEDIADECODER_H

+ 0 - 560
AvPlayer2/interfaces/IPlayerController.h

@@ -1,560 +0,0 @@
-#ifndef IPLAYERCONTROLLER_H
-#define IPLAYERCONTROLLER_H
-
-#include <string>
-#include <memory>
-#include <functional>
-#include <chrono>
-#include <vector>
-#include <map>
-
-namespace AVPlayer2 {
-namespace Core {
-
-/**
- * 播放器状态枚举
- */
-enum class PlayerState {
-    Stopped,        // 停止状态
-    Loading,        // 加载中
-    Loaded,         // 已加载
-    Playing,        // 播放中
-    Paused,         // 暂停
-    Seeking,        // 跳转中
-    Buffering,      // 缓冲中
-    Error           // 错误状态
-};
-
-/**
- * 播放模式枚举
- */
-enum class PlayMode {
-    Normal,         // 正常播放
-    Loop,           // 循环播放
-    Shuffle,        // 随机播放
-    RepeatOne       // 单曲循环
-};
-
-/**
- * 缩放模式枚举
- */
-enum class ScaleMode {
-    Fit,            // 适应窗口
-    Fill,           // 填充窗口
-    Stretch,        // 拉伸
-    Original,       // 原始大小
-    Custom          // 自定义
-};
-
-} // namespace Core
-
-namespace Types {
-
-/**
- * 播放器配置
- */
-struct PlayerConfig {
-    bool enableHardwareDecoding;       // 启用硬件解码
-    bool enableAudioOutput;            // 启用音频输出
-    bool enableVideoOutput;            // 启用视频输出
-    bool enableSubtitles;              // 启用字幕
-    int maxVideoFrameBuffer;           // 最大视频帧缓冲
-    int maxAudioFrameBuffer;           // 最大音频帧缓冲
-    double seekAccuracy;               // 跳转精度(秒)
-    bool autoPlay;                     // 自动播放
-    double defaultVolume;              // 默认音量(0.0-1.0)
-    Core::PlayMode defaultPlayMode;    // 默认播放模式
-    Core::ScaleMode defaultScaleMode;  // 默认缩放模式
-    std::string userAgent;             // 用户代理
-    int networkTimeout;                // 网络超时(毫秒)
-    
-    PlayerConfig() {
-        enableHardwareDecoding = true;
-        enableAudioOutput = true;
-        enableVideoOutput = true;
-        enableSubtitles = true;
-        maxVideoFrameBuffer = 10;
-        maxAudioFrameBuffer = 20;
-        seekAccuracy = 1.0;
-        autoPlay = false;
-        defaultVolume = 1.0;
-        defaultPlayMode = Core::PlayMode::Normal;
-        defaultScaleMode = Core::ScaleMode::Fit;
-        userAgent = "AVPlayer2/1.0";
-        networkTimeout = 30000;
-    }
-};
-
-/**
- * 播放器统计信息
- */
-struct PlayerStats {
-    std::chrono::microseconds totalDuration;   // 总时长
-    std::chrono::microseconds currentPosition; // 当前位置
-    double playbackSpeed;                      // 播放速度
-    int videoFrameRate;                        // 视频帧率
-    int audioSampleRate;                       // 音频采样率
-    int videoBitrate;                          // 视频比特率
-    int audioBitrate;                          // 音频比特率
-    int droppedFrames;                         // 丢弃帧数
-    int renderedFrames;                        // 渲染帧数
-    double bufferHealth;                       // 缓冲健康度(0.0-1.0)
-    std::string videoCodec;                    // 视频编解码器
-    std::string audioCodec;                    // 音频编解码器
-    
-    PlayerStats() {
-        totalDuration = std::chrono::microseconds(0);
-        currentPosition = std::chrono::microseconds(0);
-        playbackSpeed = 1.0;
-        videoFrameRate = 0;
-        audioSampleRate = 0;
-        videoBitrate = 0;
-        audioBitrate = 0;
-        droppedFrames = 0;
-        renderedFrames = 0;
-        bufferHealth = 0.0;
-    }
-};
-
-/**
- * 播放列表项
- */
-struct PlaylistItem {
-    std::string id;                 // 项目ID
-    std::string url;                // 媒体URL
-    std::string title;              // 标题
-    std::string artist;             // 艺术家
-    std::string album;              // 专辑
-    std::chrono::microseconds duration;  // 时长
-    std::map<std::string, std::string> metadata;  // 元数据
-    
-    PlaylistItem() {
-        duration = std::chrono::microseconds(0);
-    }
-};
-
-/**
- * 字幕信息
- */
-struct SubtitleTrack {
-    int index;                      // 轨道索引
-    std::string language;           // 语言
-    std::string title;              // 标题
-    std::string codec;              // 编解码器
-    bool isDefault;                 // 是否默认
-    bool isForced;                  // 是否强制
-    
-    SubtitleTrack() {
-        index = -1;
-        isDefault = false;
-        isForced = false;
-    }
-};
-
-/**
- * 音频轨道信息
- */
-struct AudioTrack {
-    int index;                      // 轨道索引
-    std::string language;           // 语言
-    std::string title;              // 标题
-    std::string codec;              // 编解码器
-    int channels;                   // 声道数
-    int sampleRate;                 // 采样率
-    int bitrate;                    // 比特率
-    bool isDefault;                 // 是否默认
-    
-    AudioTrack() {
-        index = -1;
-        channels = 0;
-        sampleRate = 0;
-        bitrate = 0;
-        isDefault = false;
-    }
-};
-
-} // namespace Types
-
-namespace Core {
-
-/**
- * 播放器控制器抽象接口
- * 提供完整的媒体播放控制功能
- */
-class IPlayerController {
-public:
-    virtual ~IPlayerController() = default;
-
-    /**
-     * 初始化播放器
-     * @param config 播放器配置
-     * @return 是否初始化成功
-     */
-    virtual bool initialize(const Types::PlayerConfig& config) = 0;
-
-    /**
-     * 释放播放器资源
-     */
-    virtual void release() = 0;
-
-    // ========== 媒体加载 ==========
-    
-    /**
-     * 加载媒体文件
-     * @param url 媒体文件URL或路径
-     * @return 是否开始加载
-     */
-    virtual bool loadMedia(const std::string& url) = 0;
-
-    /**
-     * 卸载当前媒体
-     */
-    virtual void unloadMedia() = 0;
-
-    // ========== 播放控制 ==========
-    
-    /**
-     * 开始播放
-     * @return 是否开始播放
-     */
-    virtual bool play() = 0;
-
-    /**
-     * 暂停播放
-     */
-    virtual void pause() = 0;
-
-    /**
-     * 停止播放
-     */
-    virtual void stop() = 0;
-
-    /**
-     * 跳转到指定位置
-     * @param position 目标位置(微秒)
-     * @return 是否开始跳转
-     */
-    virtual bool seekTo(std::chrono::microseconds position) = 0;
-
-    /**
-     * 相对跳转
-     * @param offset 偏移量(微秒,正数向前,负数向后)
-     * @return 是否开始跳转
-     */
-    virtual bool seekBy(std::chrono::microseconds offset) = 0;
-
-    // ========== 播放参数 ==========
-    
-    /**
-     * 设置播放速度
-     * @param speed 播放速度(1.0为正常速度)
-     */
-    virtual void setPlaybackSpeed(double speed) = 0;
-
-    /**
-     * 获取播放速度
-     * @return 当前播放速度
-     */
-    virtual double getPlaybackSpeed() const = 0;
-
-    /**
-     * 设置音量
-     * @param volume 音量(0.0-1.0)
-     */
-    virtual void setVolume(double volume) = 0;
-
-    /**
-     * 获取音量
-     * @return 当前音量
-     */
-    virtual double getVolume() const = 0;
-
-    /**
-     * 设置静音
-     * @param muted 是否静音
-     */
-    virtual void setMuted(bool muted) = 0;
-
-    /**
-     * 获取静音状态
-     * @return 是否静音
-     */
-    virtual bool isMuted() const = 0;
-
-    // ========== 状态查询 ==========
-    
-    /**
-     * 获取播放器状态
-     * @return 当前状态
-     */
-    virtual PlayerState getState() const = 0;
-
-    /**
-     * 获取当前播放位置
-     * @return 当前位置(微秒)
-     */
-    virtual std::chrono::microseconds getCurrentPosition() const = 0;
-
-    /**
-     * 获取媒体总时长
-     * @return 总时长(微秒)
-     */
-    virtual std::chrono::microseconds getDuration() const = 0;
-
-    /**
-     * 获取缓冲进度
-     * @return 缓冲进度(0.0-1.0)
-     */
-    virtual double getBufferProgress() const = 0;
-
-    /**
-     * 是否可以播放
-     * @return 是否可以播放
-     */
-    virtual bool canPlay() const = 0;
-
-    /**
-     * 是否可以暂停
-     * @return 是否可以暂停
-     */
-    virtual bool canPause() const = 0;
-
-    /**
-     * 是否可以跳转
-     * @return 是否可以跳转
-     */
-    virtual bool canSeek() const = 0;
-
-    // ========== 轨道管理 ==========
-    
-    /**
-     * 获取音频轨道列表
-     * @return 音频轨道列表
-     */
-    virtual std::vector<Types::AudioTrack> getAudioTracks() const = 0;
-
-    /**
-     * 获取字幕轨道列表
-     * @return 字幕轨道列表
-     */
-    virtual std::vector<Types::SubtitleTrack> getSubtitleTracks() const = 0;
-
-    /**
-     * 选择音频轨道
-     * @param index 轨道索引
-     * @return 是否选择成功
-     */
-    virtual bool selectAudioTrack(int index) = 0;
-
-    /**
-     * 选择字幕轨道
-     * @param index 轨道索引(-1表示关闭字幕)
-     * @return 是否选择成功
-     */
-    virtual bool selectSubtitleTrack(int index) = 0;
-
-    /**
-     * 获取当前音频轨道索引
-     * @return 当前音频轨道索引
-     */
-    virtual int getCurrentAudioTrack() const = 0;
-
-    /**
-     * 获取当前字幕轨道索引
-     * @return 当前字幕轨道索引
-     */
-    virtual int getCurrentSubtitleTrack() const = 0;
-
-    // ========== 播放列表 ==========
-    
-    /**
-     * 设置播放模式
-     * @param mode 播放模式
-     */
-    virtual void setPlayMode(PlayMode mode) = 0;
-
-    /**
-     * 获取播放模式
-     * @return 当前播放模式
-     */
-    virtual PlayMode getPlayMode() const = 0;
-
-    /**
-     * 添加播放列表项
-     * @param item 播放列表项
-     * @return 是否添加成功
-     */
-    virtual bool addPlaylistItem(const Types::PlaylistItem& item) = 0;
-
-    /**
-     * 移除播放列表项
-     * @param index 项目索引
-     * @return 是否移除成功
-     */
-    virtual bool removePlaylistItem(int index) = 0;
-
-    /**
-     * 清空播放列表
-     */
-    virtual void clearPlaylist() = 0;
-
-    /**
-     * 获取播放列表
-     * @return 播放列表
-     */
-    virtual std::vector<Types::PlaylistItem> getPlaylist() const = 0;
-
-    /**
-     * 播放指定项目
-     * @param index 项目索引
-     * @return 是否开始播放
-     */
-    virtual bool playItem(int index) = 0;
-
-    /**
-     * 播放下一项
-     * @return 是否开始播放
-     */
-    virtual bool playNext() = 0;
-
-    /**
-     * 播放上一项
-     * @return 是否开始播放
-     */
-    virtual bool playPrevious() = 0;
-
-    /**
-     * 获取当前播放项索引
-     * @return 当前播放项索引
-     */
-    virtual int getCurrentPlaylistIndex() const = 0;
-
-    // ========== 视频控制 ==========
-    
-    /**
-     * 设置视频缩放模式
-     * @param mode 缩放模式
-     */
-    virtual void setScaleMode(ScaleMode mode) = 0;
-
-    /**
-     * 获取视频缩放模式
-     * @return 当前缩放模式
-     */
-    virtual ScaleMode getScaleMode() const = 0;
-
-    /**
-     * 设置视频旋转角度
-     * @param angle 旋转角度(度)
-     */
-    virtual void setRotation(int angle) = 0;
-
-    /**
-     * 获取视频旋转角度
-     * @return 当前旋转角度
-     */
-    virtual int getRotation() const = 0;
-
-    // ========== 统计信息 ==========
-    
-    /**
-     * 获取播放器统计信息
-     * @return 统计信息
-     */
-    virtual Types::PlayerStats getStats() const = 0;
-
-    /**
-     * 重置统计信息
-     */
-    virtual void resetStats() = 0;
-
-    // ========== 回调设置 ==========
-    
-    /**
-     * 设置状态变化回调
-     * @param callback 状态变化回调函数
-     */
-    virtual void setStateChangedCallback(
-        std::function<void(PlayerState, PlayerState)> callback) = 0;
-
-    /**
-     * 设置位置变化回调
-     * @param callback 位置变化回调函数
-     */
-    virtual void setPositionChangedCallback(
-        std::function<void(std::chrono::microseconds)> callback) = 0;
-
-    /**
-     * 设置时长变化回调
-     * @param callback 时长变化回调函数
-     */
-    virtual void setDurationChangedCallback(
-        std::function<void(std::chrono::microseconds)> callback) = 0;
-
-    /**
-     * 设置缓冲进度回调
-     * @param callback 缓冲进度回调函数
-     */
-    virtual void setBufferProgressCallback(
-        std::function<void(double)> callback) = 0;
-
-    /**
-     * 设置媒体加载完成回调
-     * @param callback 媒体加载完成回调函数
-     */
-    virtual void setMediaLoadedCallback(
-        std::function<void(const std::string&)> callback) = 0;
-
-    /**
-     * 设置播放完成回调
-     * @param callback 播放完成回调函数
-     */
-    virtual void setPlaybackFinishedCallback(
-        std::function<void()> callback) = 0;
-
-    /**
-     * 设置错误回调
-     * @param callback 错误回调函数
-     */
-    virtual void setErrorCallback(
-        std::function<void(const std::string&, const std::string&)> callback) = 0;
-};
-
-/**
- * 播放器控制器工厂接口
- */
-class IPlayerControllerFactory {
-public:
-    virtual ~IPlayerControllerFactory() = default;
-
-    /**
-     * 创建播放器控制器实例
-     * @param name 控制器名称
-     * @return 播放器控制器智能指针
-     */
-    virtual std::unique_ptr<IPlayerController> createPlayerController(const std::string& name = "") = 0;
-
-    /**
-     * 获取默认播放器配置
-     * @return 默认配置
-     */
-    virtual Types::PlayerConfig getDefaultConfig() = 0;
-
-    /**
-     * 获取支持的媒体格式列表
-     * @return 支持的格式列表
-     */
-    virtual std::vector<std::string> getSupportedFormats() = 0;
-
-    /**
-     * 检查是否支持指定格式
-     * @param format 媒体格式
-     * @return 是否支持
-     */
-    virtual bool isFormatSupported(const std::string& format) = 0;
-};
-
-} // namespace Core
-} // namespace AVPlayer2
-
-#endif // IPLAYERCONTROLLER_H

+ 0 - 356
AvPlayer2/interfaces/ISyncController.h

@@ -1,356 +0,0 @@
-#ifndef ISYNCCONTROLLER_H
-#define ISYNCCONTROLLER_H
-
-#include <chrono>
-#include <functional>
-#include <memory>
-#include <string>
-
-namespace AVPlayer2 {
-namespace Core {
-
-/**
- * 同步状态枚举
- */
-enum class SyncState {
-    Stopped,        // 停止状态
-    Running,        // 运行状态
-    Paused,         // 暂停状态
-    Seeking,        // 跳转状态
-    Buffering       // 缓冲状态
-};
-
-/**
- * 同步模式枚举
- */
-enum class SyncMode {
-    AudioMaster,    // 以音频为主时钟
-    VideoMaster,    // 以视频为主时钟
-    ExternalMaster, // 以外部时钟为主
-    FreeRun         // 自由运行模式
-};
-
-/**
- * 时钟类型枚举
- */
-enum class ClockType {
-    Audio,          // 音频时钟
-    Video,          // 视频时钟
-    External,       // 外部时钟
-    System          // 系统时钟
-};
-
-} // namespace Core
-
-namespace Types {
-
-/**
- * 时间戳信息
- */
-struct TimestampInfo {
-    std::chrono::microseconds pts;          // 显示时间戳
-    std::chrono::microseconds dts;          // 解码时间戳
-    std::chrono::microseconds duration;     // 持续时间
-    std::chrono::system_clock::time_point systemTime;  // 系统时间
-    double timeBase;                        // 时间基准
-    
-    TimestampInfo() {
-        pts = std::chrono::microseconds(0);
-        dts = std::chrono::microseconds(0);
-        duration = std::chrono::microseconds(0);
-        systemTime = std::chrono::system_clock::now();
-        timeBase = 1.0;
-    }
-};
-
-/**
- * 时钟信息
- */
-struct ClockInfo {
-    Core::ClockType type;                   // 时钟类型
-    std::chrono::microseconds currentTime;  // 当前时间
-    std::chrono::microseconds lastUpdate;   // 最后更新时间
-    double speed;                           // 播放速度
-    bool isPaused;                          // 是否暂停
-    double drift;                           // 时钟漂移
-    
-    ClockInfo() {
-        type = Core::ClockType::System;
-        currentTime = std::chrono::microseconds(0);
-        lastUpdate = std::chrono::microseconds(0);
-        speed = 1.0;
-        isPaused = false;
-        drift = 0.0;
-    }
-};
-
-/**
- * 同步统计信息
- */
-struct SyncStats {
-    double audioVideoDelay;         // 音视频延迟(毫秒)
-    double averageDelay;            // 平均延迟
-    double maxDelay;                // 最大延迟
-    double minDelay;                // 最小延迟
-    int droppedFrames;              // 丢弃帧数
-    int duplicatedFrames;           // 重复帧数
-    int syncAdjustments;            // 同步调整次数
-    double clockDrift;              // 时钟漂移
-    
-    SyncStats() {
-        audioVideoDelay = 0.0;
-        averageDelay = 0.0;
-        maxDelay = 0.0;
-        minDelay = 0.0;
-        droppedFrames = 0;
-        duplicatedFrames = 0;
-        syncAdjustments = 0;
-        clockDrift = 0.0;
-    }
-};
-
-/**
- * 同步配置
- */
-struct SyncConfig {
-    Core::SyncMode mode;                    // 同步模式
-    double maxAudioDelay;                   // 最大音频延迟(毫秒)
-    double maxVideoDelay;                   // 最大视频延迟(毫秒)
-    double syncThreshold;                   // 同步阈值(毫秒)
-    bool enableFrameDrop;                   // 是否启用丢帧
-    bool enableFrameDuplication;            // 是否启用重复帧
-    double speedAdjustmentRange;            // 速度调整范围
-    int maxConsecutiveDrops;                // 最大连续丢帧数
-    
-    SyncConfig() {
-        mode = Core::SyncMode::AudioMaster;
-        maxAudioDelay = 100.0;
-        maxVideoDelay = 100.0;
-        syncThreshold = 40.0;
-        enableFrameDrop = true;
-        enableFrameDuplication = false;
-        speedAdjustmentRange = 0.1;
-        maxConsecutiveDrops = 5;
-    }
-};
-
-} // namespace Types
-
-namespace Core {
-
-/**
- * 同步控制器抽象接口
- * 提供音视频同步功能
- */
-class ISyncController {
-public:
-    virtual ~ISyncController() = default;
-
-    /**
-     * 初始化同步控制器
-     * @param config 同步配置
-     * @return 是否初始化成功
-     */
-    virtual bool initialize(const Types::SyncConfig& config) = 0;
-
-    /**
-     * 启动同步控制器
-     * @return 是否启动成功
-     */
-    virtual bool start() = 0;
-
-    /**
-     * 停止同步控制器
-     */
-    virtual void stop() = 0;
-
-    /**
-     * 暂停同步
-     */
-    virtual void pause() = 0;
-
-    /**
-     * 恢复同步
-     */
-    virtual void resume() = 0;
-
-    /**
-     * 重置同步状态
-     */
-    virtual void reset() = 0;
-
-    /**
-     * 设置同步模式
-     * @param mode 同步模式
-     */
-    virtual void setSyncMode(SyncMode mode) = 0;
-
-    /**
-     * 获取同步模式
-     * @return 当前同步模式
-     */
-    virtual SyncMode getSyncMode() const = 0;
-
-    /**
-     * 设置播放速度
-     * @param speed 播放速度(1.0为正常速度)
-     */
-    virtual void setPlaybackSpeed(double speed) = 0;
-
-    /**
-     * 获取播放速度
-     * @return 当前播放速度
-     */
-    virtual double getPlaybackSpeed() const = 0;
-
-    /**
-     * 更新音频时钟
-     * @param timestamp 时间戳信息
-     */
-    virtual void updateAudioClock(const Types::TimestampInfo& timestamp) = 0;
-
-    /**
-     * 更新视频时钟
-     * @param timestamp 时间戳信息
-     */
-    virtual void updateVideoClock(const Types::TimestampInfo& timestamp) = 0;
-
-    /**
-     * 更新外部时钟
-     * @param timestamp 时间戳信息
-     */
-    virtual void updateExternalClock(const Types::TimestampInfo& timestamp) = 0;
-
-    /**
-     * 获取主时钟时间
-     * @return 主时钟当前时间(微秒)
-     */
-    virtual std::chrono::microseconds getMasterClockTime() = 0;
-
-    /**
-     * 获取指定类型时钟信息
-     * @param type 时钟类型
-     * @return 时钟信息
-     */
-    virtual Types::ClockInfo getClockInfo(ClockType type) = 0;
-
-    /**
-     * 计算音频延迟
-     * @param audioTimestamp 音频时间戳
-     * @return 延迟时间(毫秒)
-     */
-    virtual double calculateAudioDelay(const Types::TimestampInfo& audioTimestamp) = 0;
-
-    /**
-     * 计算视频延迟
-     * @param videoTimestamp 视频时间戳
-     * @return 延迟时间(毫秒)
-     */
-    virtual double calculateVideoDelay(const Types::TimestampInfo& videoTimestamp) = 0;
-
-    /**
-     * 判断是否应该丢弃视频帧
-     * @param videoTimestamp 视频时间戳
-     * @return 是否应该丢弃
-     */
-    virtual bool shouldDropVideoFrame(const Types::TimestampInfo& videoTimestamp) = 0;
-
-    /**
-     * 判断是否应该重复视频帧
-     * @param videoTimestamp 视频时间戳
-     * @return 是否应该重复
-     */
-    virtual bool shouldDuplicateVideoFrame(const Types::TimestampInfo& videoTimestamp) = 0;
-
-    /**
-     * 计算音频样本调整
-     * @param audioTimestamp 音频时间戳
-     * @param sampleCount 样本数
-     * @return 调整后的样本数
-     */
-    virtual int calculateAudioSampleAdjustment(const Types::TimestampInfo& audioTimestamp, 
-                                               int sampleCount) = 0;
-
-    /**
-     * 跳转到指定时间
-     * @param seekTime 目标时间(微秒)
-     */
-    virtual void seekTo(std::chrono::microseconds seekTime) = 0;
-
-    /**
-     * 获取同步状态
-     * @return 同步状态
-     */
-    virtual SyncState getState() const = 0;
-
-    /**
-     * 获取同步统计信息
-     * @return 统计信息
-     */
-    virtual Types::SyncStats getStats() const = 0;
-
-    /**
-     * 重置统计信息
-     */
-    virtual void resetStats() = 0;
-
-    /**
-     * 设置同步状态变化回调
-     * @param callback 状态变化回调函数
-     */
-    virtual void setStateChangedCallback(
-        std::function<void(SyncState)> callback) = 0;
-
-    /**
-     * 设置时钟更新回调
-     * @param callback 时钟更新回调函数
-     */
-    virtual void setClockUpdateCallback(
-        std::function<void(ClockType, const Types::ClockInfo&)> callback) = 0;
-
-    /**
-     * 设置同步调整回调
-     * @param callback 同步调整回调函数
-     */
-    virtual void setSyncAdjustmentCallback(
-        std::function<void(const std::string&, double)> callback) = 0;
-
-    /**
-     * 设置错误回调
-     * @param callback 错误回调函数
-     */
-    virtual void setErrorCallback(
-        std::function<void(const std::string&, const std::string&)> callback) = 0;
-};
-
-/**
- * 同步控制器工厂接口
- */
-class ISyncControllerFactory {
-public:
-    virtual ~ISyncControllerFactory() = default;
-
-    /**
-     * 创建同步控制器实例
-     * @param name 控制器名称
-     * @return 同步控制器智能指针
-     */
-    virtual std::unique_ptr<ISyncController> createSyncController(const std::string& name = "") = 0;
-
-    /**
-     * 获取默认同步配置
-     * @return 默认配置
-     */
-    virtual Types::SyncConfig getDefaultConfig() = 0;
-
-    /**
-     * 获取支持的同步模式列表
-     * @return 支持的同步模式
-     */
-    virtual std::vector<SyncMode> getSupportedSyncModes() = 0;
-};
-
-} // namespace Core
-} // namespace AVPlayer2
-
-#endif // ISYNCCONTROLLER_H

+ 0 - 286
AvPlayer2/interfaces/IThreadPool.h

@@ -1,286 +0,0 @@
-#ifndef ITHREADPOOL_H
-#define ITHREADPOOL_H
-
-#include <functional>
-#include <memory>
-#include <future>
-#include <chrono>
-#include <string>
-
-namespace AVPlayer2 {
-namespace Core {
-
-/**
- * 线程池状态枚举
- */
-enum class ThreadPoolState {
-    Stopped,    // 停止状态
-    Running,    // 运行状态
-    Stopping    // 正在停止
-};
-
-/**
- * 任务优先级枚举
- */
-enum class TaskPriority {
-    Low,        // 低优先级
-    Normal,     // 普通优先级
-    High,       // 高优先级
-    Critical    // 关键优先级
-};
-
-/**
- * 任务状态枚举
- */
-enum class TaskState {
-    Pending,    // 等待执行
-    Running,    // 正在执行
-    Completed,  // 已完成
-    Cancelled,  // 已取消
-    Failed      // 执行失败
-};
-
-} // namespace Core
-
-namespace Types {
-
-/**
- * 任务信息
- */
-struct TaskInfo {
-    std::string taskId;                     // 任务ID
-    std::string taskName;                   // 任务名称
-    Core::TaskPriority priority;            // 任务优先级
-    Core::TaskState state;                  // 任务状态
-    std::chrono::system_clock::time_point createTime;  // 创建时间
-    std::chrono::system_clock::time_point startTime;   // 开始时间
-    std::chrono::system_clock::time_point endTime;     // 结束时间
-    std::string threadId;                   // 执行线程ID
-    std::string errorMessage;               // 错误信息
-    
-    TaskInfo() {
-        priority = Core::TaskPriority::Normal;
-        state = Core::TaskState::Pending;
-        createTime = std::chrono::system_clock::now();
-    }
-};
-
-/**
- * 线程池统计信息
- */
-struct ThreadPoolStats {
-    int totalThreads;           // 总线程数
-    int activeThreads;          // 活跃线程数
-    int idleThreads;            // 空闲线程数
-    int pendingTasks;           // 等待任务数
-    int completedTasks;         // 已完成任务数
-    int failedTasks;            // 失败任务数
-    double averageTaskTime;     // 平均任务执行时间(毫秒)
-    double threadUtilization;   // 线程利用率(0.0-1.0)
-    
-    ThreadPoolStats() {
-        totalThreads = 0;
-        activeThreads = 0;
-        idleThreads = 0;
-        pendingTasks = 0;
-        completedTasks = 0;
-        failedTasks = 0;
-        averageTaskTime = 0.0;
-        threadUtilization = 0.0;
-    }
-};
-
-/**
- * 线程池配置
- */
-struct ThreadPoolConfig {
-    int minThreads;             // 最小线程数
-    int maxThreads;             // 最大线程数
-    int maxQueueSize;           // 最大队列大小
-    std::chrono::milliseconds keepAliveTime;   // 线程保活时间
-    bool allowCoreThreadTimeout;               // 是否允许核心线程超时
-    std::string threadNamePrefix;              // 线程名称前缀
-    
-    ThreadPoolConfig() {
-        minThreads = 2;
-        maxThreads = 8;
-        maxQueueSize = 100;
-        keepAliveTime = std::chrono::milliseconds(60000);
-        allowCoreThreadTimeout = false;
-        threadNamePrefix = "AVPlayer2-Thread-";
-    }
-};
-
-} // namespace Types
-
-namespace Core {
-
-/**
- * 线程池抽象接口
- * 提供与平台无关的线程池功能
- */
-class IThreadPool {
-public:
-    virtual ~IThreadPool() = default;
-
-    /**
-     * 初始化线程池
-     * @param config 线程池配置
-     * @return 是否初始化成功
-     */
-    virtual bool initialize(const Types::ThreadPoolConfig& config) = 0;
-
-    /**
-     * 启动线程池
-     * @return 是否启动成功
-     */
-    virtual bool start() = 0;
-
-    /**
-     * 停止线程池
-     * @param waitForCompletion 是否等待所有任务完成
-     */
-    virtual void stop(bool waitForCompletion = true) = 0;
-
-    /**
-     * 提交任务(无返回值)
-     * @param task 任务函数
-     * @param priority 任务优先级
-     * @param taskName 任务名称
-     * @return 任务ID
-     */
-    virtual std::string submitTask(std::function<void()> task, 
-                                   TaskPriority priority = TaskPriority::Normal,
-                                   const std::string& taskName = "") = 0;
-
-    /**
-     * 提交任务(有返回值)
-     * @param task 任务函数
-     * @param priority 任务优先级
-     * @param taskName 任务名称
-     * @return 任务结果的future对象
-     */
-    template<typename F, typename... Args>
-    auto submitTaskWithResult(F&& task, TaskPriority priority = TaskPriority::Normal,
-                              const std::string& taskName = "") 
-        -> std::future<typename std::result_of<F(Args...)>::type> {
-        using ReturnType = typename std::result_of<F(Args...)>::type;
-        
-        auto taskPtr = std::make_shared<std::packaged_task<ReturnType()>>(
-            std::bind(std::forward<F>(task))
-        );
-        
-        std::future<ReturnType> result = taskPtr->get_future();
-        
-        submitTask([taskPtr](){ (*taskPtr)(); }, priority, taskName);
-        
-        return result;
-    }
-
-    /**
-     * 取消任务
-     * @param taskId 任务ID
-     * @return 是否取消成功
-     */
-    virtual bool cancelTask(const std::string& taskId) = 0;
-
-    /**
-     * 等待任务完成
-     * @param taskId 任务ID
-     * @param timeout 超时时间(毫秒,-1表示无限等待)
-     * @return 是否在超时前完成
-     */
-    virtual bool waitForTask(const std::string& taskId, int timeout = -1) = 0;
-
-    /**
-     * 等待所有任务完成
-     * @param timeout 超时时间(毫秒,-1表示无限等待)
-     * @return 是否在超时前完成
-     */
-    virtual bool waitForAllTasks(int timeout = -1) = 0;
-
-    /**
-     * 获取任务信息
-     * @param taskId 任务ID
-     * @return 任务信息
-     */
-    virtual Types::TaskInfo getTaskInfo(const std::string& taskId) = 0;
-
-    /**
-     * 获取线程池状态
-     * @return 线程池状态
-     */
-    virtual ThreadPoolState getState() const = 0;
-
-    /**
-     * 获取线程池统计信息
-     * @return 统计信息
-     */
-    virtual Types::ThreadPoolStats getStats() const = 0;
-
-    /**
-     * 调整线程池大小
-     * @param newSize 新的线程数
-     * @return 是否调整成功
-     */
-    virtual bool resize(int newSize) = 0;
-
-    /**
-     * 清空任务队列
-     * @return 被清空的任务数
-     */
-    virtual int clearQueue() = 0;
-
-    /**
-     * 设置任务完成回调
-     * @param callback 任务完成回调函数
-     */
-    virtual void setTaskCompletedCallback(
-        std::function<void(const std::string&, TaskState)> callback) = 0;
-
-    /**
-     * 设置线程池状态变化回调
-     * @param callback 状态变化回调函数
-     */
-    virtual void setStateChangedCallback(
-        std::function<void(ThreadPoolState)> callback) = 0;
-
-    /**
-     * 设置错误回调
-     * @param callback 错误回调函数
-     */
-    virtual void setErrorCallback(
-        std::function<void(const std::string&, const std::string&)> callback) = 0;
-};
-
-/**
- * 线程池工厂接口
- */
-class IThreadPoolFactory {
-public:
-    virtual ~IThreadPoolFactory() = default;
-
-    /**
-     * 创建线程池实例
-     * @param name 线程池名称
-     * @return 线程池智能指针
-     */
-    virtual std::unique_ptr<IThreadPool> createThreadPool(const std::string& name = "") = 0;
-
-    /**
-     * 获取默认线程池配置
-     * @return 默认配置
-     */
-    virtual Types::ThreadPoolConfig getDefaultConfig() = 0;
-
-    /**
-     * 获取推荐的线程数
-     * @return 推荐线程数
-     */
-    virtual int getRecommendedThreadCount() = 0;
-};
-
-} // namespace Core
-} // namespace AVPlayer2
-
-#endif // ITHREADPOOL_H

+ 0 - 210
AvPlayer2/interfaces/IVideoRenderer.h

@@ -1,210 +0,0 @@
-#ifndef IVIDEORENDERER_H
-#define IVIDEORENDERER_H
-
-#include <functional>
-#include <memory>
-#include <vector>
-
-namespace AVPlayer2 {
-namespace Core {
-
-/**
- * 视频渲染器状态枚举
- */
-enum class VideoRendererState {
-    Stopped,    // 停止状态
-    Playing,    // 播放状态
-    Paused,     // 暂停状态
-    Error       // 错误状态
-};
-
-/**
- * 视频像素格式枚举
- */
-enum class PixelFormat {
-    RGB24,      // RGB 24位
-    RGB32,      // RGB 32位
-    YUV420P,    // YUV 4:2:0 平面格式
-    YUV422P,    // YUV 4:2:2 平面格式
-    YUV444P,    // YUV 4:4:4 平面格式
-    NV12,       // NV12 格式
-    NV21        // NV21 格式
-};
-
-} // namespace Core
-
-namespace Types {
-
-/**
- * 视频格式参数
- */
-struct VideoFormat {
-    int width;                          // 视频宽度
-    int height;                         // 视频高度
-    Core::PixelFormat pixelFormat;      // 像素格式
-    float frameRate;                    // 帧率
-    int bitRate;                        // 比特率
-};
-
-/**
- * 视频帧数据
- */
-struct VideoFrame {
-    unsigned char* data[4];             // 视频数据平面指针
-    int lineSize[4];                    // 每个平面的行大小
-    int width;                          // 帧宽度
-    int height;                         // 帧高度
-    Core::PixelFormat pixelFormat;      // 像素格式
-    double timestamp;                   // 时间戳(秒)
-    int64_t pts;                        // 显示时间戳
-};
-
-/**
- * 渲染区域
- */
-struct RenderRect {
-    int x;          // X坐标
-    int y;          // Y坐标
-    int width;      // 宽度
-    int height;     // 高度
-};
-
-} // namespace Types
-
-namespace Core {
-
-/**
- * 视频渲染器抽象接口
- * 提供与平台无关的视频输出功能
- */
-class IVideoRenderer {
-public:
-    virtual ~IVideoRenderer() = default;
-
-    /**
-     * 初始化视频渲染器
-     * @param format 视频格式参数
-     * @return 是否初始化成功
-     */
-    virtual bool initialize(const Types::VideoFormat& format) = 0;
-
-    /**
-     * 开始渲染
-     * @return 是否开始成功
-     */
-    virtual bool start() = 0;
-
-    /**
-     * 停止渲染
-     */
-    virtual void stop() = 0;
-
-    /**
-     * 暂停渲染
-     */
-    virtual void pause() = 0;
-
-    /**
-     * 恢复渲染
-     */
-    virtual void resume() = 0;
-
-    /**
-     * 渲染视频帧
-     * @param frame 视频帧数据
-     * @return 是否渲染成功
-     */
-    virtual bool renderFrame(const Types::VideoFrame& frame) = 0;
-
-    /**
-     * 设置渲染区域
-     * @param rect 渲染区域
-     */
-    virtual void setRenderRect(const Types::RenderRect& rect) = 0;
-
-    /**
-     * 获取渲染区域
-     * @return 当前渲染区域
-     */
-    virtual Types::RenderRect getRenderRect() const = 0;
-
-    /**
-     * 设置缩放模式
-     * @param keepAspectRatio 是否保持宽高比
-     */
-    virtual void setScaleMode(bool keepAspectRatio) = 0;
-
-    /**
-     * 获取当前状态
-     * @return 渲染器状态
-     */
-    virtual VideoRendererState getState() const = 0;
-
-    /**
-     * 获取渲染统计信息
-     * @param framesRendered 已渲染帧数
-     * @param framesDropped 丢弃帧数
-     */
-    virtual void getRenderStats(int& framesRendered, int& framesDropped) const = 0;
-
-    /**
-     * 清空渲染缓冲区
-     */
-    virtual void clearBuffer() = 0;
-
-    /**
-     * 设置状态变化回调
-     * @param callback 状态变化回调函数
-     */
-    virtual void setStateCallback(std::function<void(VideoRendererState)> callback) = 0;
-
-    /**
-     * 设置帧渲染完成回调
-     * @param callback 帧渲染完成回调函数
-     */
-    virtual void setFrameRenderedCallback(std::function<void(const Types::VideoFrame&)> callback) = 0;
-
-    /**
-     * 设置渲染错误回调
-     * @param callback 渲染错误回调函数
-     */
-    virtual void setErrorCallback(std::function<void(const std::string&)> callback) = 0;
-};
-
-/**
- * 视频渲染器工厂接口
- */
-class IVideoRendererFactory {
-public:
-    virtual ~IVideoRendererFactory() = default;
-
-    /**
-     * 创建视频渲染器实例
-     * @return 视频渲染器智能指针
-     */
-    virtual std::unique_ptr<IVideoRenderer> createRenderer() = 0;
-
-    /**
-     * 获取支持的视频格式列表
-     * @return 支持的视频格式列表
-     */
-    virtual std::vector<Types::VideoFormat> getSupportedFormats() = 0;
-
-    /**
-     * 检查是否支持指定格式
-     * @param format 视频格式
-     * @return 是否支持
-     */
-    virtual bool isFormatSupported(const Types::VideoFormat& format) = 0;
-
-    /**
-     * 获取支持的像素格式列表
-     * @return 支持的像素格式列表
-     */
-    virtual std::vector<PixelFormat> getSupportedPixelFormats() = 0;
-};
-
-} // namespace Core
-} // namespace AVPlayer2
-
-#endif // IVIDEORENDERER_H

+ 0 - 205
AvPlayer2/types/ErrorCodes.h

@@ -1,205 +0,0 @@
-#ifndef ERRORCODES_H
-#define ERRORCODES_H
-
-#include <string>
-#include <unordered_map>
-
-namespace AVPlayer2 {
-namespace Types {
-
-/**
- * 错误码枚举
- * 使用分类编码:模块(2位) + 类别(2位) + 具体错误(4位)
- */
-enum class ErrorCode {
-    // 成功
-    Success = 0,
-    
-    // 通用错误 (01xx)
-    UnknownError = 0100,
-    InvalidParameter = 0101,
-    OutOfMemory = 0102,
-    NotImplemented = 0103,
-    NotSupported = 0104,
-    Timeout = 0105,
-    
-    // 文件/IO错误 (02xx)
-    FileNotFound = 0200,
-    FileOpenFailed = 0201,
-    FileReadFailed = 0202,
-    FileWriteFailed = 0203,
-    FileFormatNotSupported = 0204,
-    FileCorrupted = 0205,
-    NetworkError = 0206,
-    
-    // 解码器错误 (03xx)
-    DecoderInitFailed = 0300,
-    DecoderNotFound = 0301,
-    DecodeFailed = 0302,
-    CodecNotSupported = 0303,
-    HardwareAccelFailed = 0304,
-    DecoderConfigError = 0305,
-    
-    // 渲染器错误 (04xx)
-    RendererInitFailed = 0400,
-    RenderFailed = 0401,
-    AudioDeviceError = 0402,
-    VideoDeviceError = 0403,
-    BufferUnderrun = 0404,
-    BufferOverrun = 0405,
-    FormatConversionFailed = 0406,
-    
-    // 播放器错误 (05xx)
-    PlayerNotInitialized = 0500,
-    PlayerAlreadyPlaying = 0501,
-    PlayerNotPlaying = 0502,
-    SeekFailed = 0503,
-    StreamNotFound = 0504,
-    SyncError = 0505,
-    
-    // 线程错误 (06xx)
-    ThreadCreateFailed = 0600,
-    ThreadStartFailed = 0601,
-    ThreadStopFailed = 0602,
-    ThreadSyncError = 0603,
-    DeadlockDetected = 0604,
-    
-    // 内存错误 (07xx)
-    MemoryAllocationFailed = 0700,
-    MemoryLeakDetected = 0701,
-    BufferTooSmall = 0702,
-    BufferOverflow = 0703,
-    
-    // 配置错误 (08xx)
-    ConfigLoadFailed = 0800,
-    ConfigSaveFailed = 0801,
-    ConfigInvalid = 0802,
-    ConfigMissing = 0803,
-    
-    // 网络错误 (09xx)
-    NetworkConnectionFailed = 0900,
-    NetworkTimeout = 0901,
-    NetworkProtocolError = 0902,
-    NetworkAuthFailed = 0903,
-    NetworkDataCorrupted = 0904
-};
-
-/**
- * 错误严重级别
- */
-enum class ErrorSeverity {
-    Info,       // 信息
-    Warning,    // 警告
-    Error,      // 错误
-    Critical,   // 严重错误
-    Fatal       // 致命错误
-};
-
-/**
- * 错误类别
- */
-enum class ErrorCategory {
-    General,    // 通用
-    IO,         // 输入输出
-    Decoder,    // 解码器
-    Renderer,   // 渲染器
-    Player,     // 播放器
-    Thread,     // 线程
-    Memory,     // 内存
-    Config,     // 配置
-    Network     // 网络
-};
-
-/**
- * 错误信息详情
- */
-struct ErrorDetail {
-    ErrorCode code;
-    ErrorSeverity severity;
-    ErrorCategory category;
-    std::string message;
-    std::string description;
-    std::string solution;
-    
-    ErrorDetail(ErrorCode c, ErrorSeverity s, ErrorCategory cat, 
-                const std::string& msg, const std::string& desc = "", 
-                const std::string& sol = "")
-        : code(c), severity(s), category(cat), message(msg), description(desc), solution(sol) {}
-};
-
-/**
- * 错误码管理器
- */
-class ErrorCodeManager {
-public:
-    /**
-     * 获取错误信息
-     * @param code 错误码
-     * @return 错误详情
-     */
-    static ErrorDetail getErrorDetail(ErrorCode code);
-    
-    /**
-     * 获取错误消息
-     * @param code 错误码
-     * @return 错误消息字符串
-     */
-    static std::string getErrorMessage(ErrorCode code);
-    
-    /**
-     * 获取错误严重级别
-     * @param code 错误码
-     * @return 错误严重级别
-     */
-    static ErrorSeverity getErrorSeverity(ErrorCode code);
-    
-    /**
-     * 获取错误类别
-     * @param code 错误码
-     * @return 错误类别
-     */
-    static ErrorCategory getErrorCategory(ErrorCode code);
-    
-    /**
-     * 检查是否为成功状态
-     * @param code 错误码
-     * @return 是否成功
-     */
-    static bool isSuccess(ErrorCode code) {
-        return code == ErrorCode::Success;
-    }
-    
-    /**
-     * 检查是否为错误状态
-     * @param code 错误码
-     * @return 是否为错误
-     */
-    static bool isError(ErrorCode code) {
-        return code != ErrorCode::Success;
-    }
-    
-    /**
-     * 检查是否为致命错误
-     * @param code 错误码
-     * @return 是否为致命错误
-     */
-    static bool isFatal(ErrorCode code) {
-        return getErrorSeverity(code) == ErrorSeverity::Fatal;
-    }
-    
-private:
-    static std::unordered_map<ErrorCode, ErrorDetail> s_errorMap;
-    static void initializeErrorMap();
-    static bool s_initialized;
-};
-
-// 便利宏定义
-#define AVPLAYER2_SUCCESS(code) AVPlayer2::Types::ErrorCodeManager::isSuccess(code)
-#define AVPLAYER2_ERROR(code) AVPlayer2::Types::ErrorCodeManager::isError(code)
-#define AVPLAYER2_FATAL(code) AVPlayer2::Types::ErrorCodeManager::isFatal(code)
-#define AVPLAYER2_ERROR_MSG(code) AVPlayer2::Types::ErrorCodeManager::getErrorMessage(code)
-
-} // namespace Types
-} // namespace AVPlayer2
-
-#endif // ERRORCODES_H

+ 0 - 214
AvPlayer2/types/MediaTypes.h

@@ -1,214 +0,0 @@
-#ifndef MEDIATYPES_H
-#define MEDIATYPES_H
-
-#include <cstdint>
-#include <string>
-#include <vector>
-
-namespace AVPlayer2 {
-namespace Types {
-
-// 常量定义
-const int MAX_AUDIO_CHANNELS = 8;
-const int MAX_VIDEO_PLANES = 4;
-const int DEFAULT_SAMPLE_RATE = 44100;
-const int DEFAULT_BUFFER_SIZE = 4096;
-const float DEFAULT_VOLUME = 1.0f;
-const double INVALID_TIMESTAMP = -1.0;
-
-/**
- * 音频采样格式枚举
- */
-enum class AudioSampleFormat {
-    Unknown,        // 未知格式
-    UInt8,          // 8位无符号整数
-    Int16,          // 16位有符号整数
-    Int32,          // 32位有符号整数
-    Float32,        // 32位浮点数
-    Float64,        // 64位浮点数
-    UInt8Planar,    // 8位无符号整数平面格式
-    Int16Planar,    // 16位有符号整数平面格式
-    Int32Planar,    // 32位有符号整数平面格式
-    Float32Planar,  // 32位浮点数平面格式
-    Float64Planar   // 64位浮点数平面格式
-};
-
-/**
- * 音频帧数据
- */
-struct AudioFrame {
-    unsigned char* data[MAX_AUDIO_CHANNELS];    // 音频数据平面指针
-    int lineSize[MAX_AUDIO_CHANNELS];           // 每个平面的数据大小
-    int sampleRate;                             // 采样率
-    int channels;                               // 声道数
-    int samplesPerChannel;                      // 每声道采样数
-    AudioSampleFormat sampleFormat;             // 采样格式
-    double timestamp;                           // 时间戳(秒)
-    int64_t pts;                               // 显示时间戳
-    bool isPlanar;                             // 是否为平面格式
-    
-    AudioFrame() {
-        for (int i = 0; i < MAX_AUDIO_CHANNELS; ++i) {
-            data[i] = nullptr;
-            lineSize[i] = 0;
-        }
-        sampleRate = DEFAULT_SAMPLE_RATE;
-        channels = 2;
-        samplesPerChannel = 0;
-        sampleFormat = AudioSampleFormat::Int16;
-        timestamp = INVALID_TIMESTAMP;
-        pts = 0;
-        isPlanar = false;
-    }
-};
-
-/**
- * 字幕帧数据
- */
-struct SubtitleFrame {
-    std::string text;           // 字幕文本
-    double startTime;           // 开始时间(秒)
-    double endTime;             // 结束时间(秒)
-    double timestamp;           // 时间戳(秒)
-    int x;                      // X坐标
-    int y;                      // Y坐标
-    int width;                  // 宽度
-    int height;                 // 高度
-    std::string fontFamily;     // 字体族
-    int fontSize;               // 字体大小
-    std::string fontColor;      // 字体颜色
-    std::string backgroundColor; // 背景颜色
-    bool isBold;                // 是否粗体
-    bool isItalic;              // 是否斜体
-    
-    SubtitleFrame() {
-        startTime = INVALID_TIMESTAMP;
-        endTime = INVALID_TIMESTAMP;
-        timestamp = INVALID_TIMESTAMP;
-        x = 0;
-        y = 0;
-        width = 0;
-        height = 0;
-        fontSize = 16;
-        fontColor = "#FFFFFF";
-        backgroundColor = "#000000";
-        isBold = false;
-        isItalic = false;
-    }
-};
-
-/**
- * 媒体流信息
- */
-struct StreamInfo {
-    int index;                  // 流索引
-    std::string codecName;      // 编解码器名称
-    std::string codecLongName;  // 编解码器长名称
-    int64_t duration;           // 持续时间(微秒)
-    int64_t bitRate;            // 比特率
-    std::string language;       // 语言
-    std::string title;          // 标题
-    
-    // 音频流特有属性
-    int sampleRate;             // 采样率
-    int channels;               // 声道数
-    AudioSampleFormat sampleFormat; // 采样格式
-    
-    // 视频流特有属性
-    int width;                  // 宽度
-    int height;                 // 高度
-    float frameRate;            // 帧率
-    float aspectRatio;          // 宽高比
-    
-    StreamInfo() {
-        index = -1;
-        duration = 0;
-        bitRate = 0;
-        sampleRate = 0;
-        channels = 0;
-        sampleFormat = AudioSampleFormat::Unknown;
-        width = 0;
-        height = 0;
-        frameRate = 0.0f;
-        aspectRatio = 0.0f;
-    }
-};
-
-/**
- * 媒体文件信息
- */
-struct MediaInfo {
-    std::string fileName;               // 文件名
-    std::string formatName;             // 格式名称
-    std::string formatLongName;         // 格式长名称
-    int64_t duration;                   // 总持续时间(微秒)
-    int64_t fileSize;                   // 文件大小(字节)
-    int64_t bitRate;                    // 总比特率
-    std::vector<StreamInfo> audioStreams;   // 音频流列表
-    std::vector<StreamInfo> videoStreams;   // 视频流列表
-    std::vector<StreamInfo> subtitleStreams; // 字幕流列表
-    std::string metadata;               // 元数据(JSON格式)
-    
-    MediaInfo() {
-        duration = 0;
-        fileSize = 0;
-        bitRate = 0;
-    }
-};
-
-/**
- * 播放状态信息
- */
-struct PlaybackInfo {
-    double currentTime;         // 当前播放时间(秒)
-    double duration;            // 总时长(秒)
-    double bufferProgress;      // 缓冲进度(0.0-1.0)
-    bool isPlaying;             // 是否正在播放
-    bool isPaused;              // 是否暂停
-    bool isMuted;               // 是否静音
-    float volume;               // 音量(0.0-1.0)
-    float playbackSpeed;        // 播放速度
-    int currentAudioStream;     // 当前音频流索引
-    int currentVideoStream;     // 当前视频流索引
-    int currentSubtitleStream;  // 当前字幕流索引
-    
-    PlaybackInfo() {
-        currentTime = 0.0;
-        duration = 0.0;
-        bufferProgress = 0.0;
-        isPlaying = false;
-        isPaused = false;
-        isMuted = false;
-        volume = DEFAULT_VOLUME;
-        playbackSpeed = 1.0f;
-        currentAudioStream = -1;
-        currentVideoStream = -1;
-        currentSubtitleStream = -1;
-    }
-};
-
-/**
- * 错误信息
- */
-struct ErrorInfo {
-    int code;                   // 错误码
-    std::string message;        // 错误消息
-    std::string detail;         // 详细信息
-    double timestamp;           // 发生时间戳
-    std::string component;      // 发生错误的组件
-    
-    ErrorInfo() {
-        code = 0;
-        timestamp = 0.0;
-    }
-    
-    ErrorInfo(int errorCode, const std::string& errorMessage) 
-        : code(errorCode), message(errorMessage) {
-        timestamp = 0.0; // 应该设置为当前时间
-    }
-};
-
-} // namespace Types
-} // namespace AVPlayer2
-
-#endif // MEDIATYPES_H