phoboslab / pl_mpeg

Single file C library for decoding MPEG1 Video and MP2 Audio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Modify public struct typedefs to enable fwd declaration in C++

tomasandrle opened this issue · comments

It would be helpful to change

typedef struct {
...
} plm_frame_t;

into

typedef struct plm_frame_t {
...
} plm_frame_t;

This would make it easier to forward-declare the structs in a C++ header without including pl_mpeg.h from there, exposing it to the rest of the program.

Example my.hpp:

struct plm_frame_t; // trying to not include pl_mpeg.h here

class MyClass {
public:
    void render( plm_frame_t *frame );
};

Example my.cpp:

#include "my.hpp"
#define PL_MPEG_IMPLEMENTATION
#include "pl_mpeg.h"

MyClass::render( plm_frame_t *frame ) {
...
}