mpegtsenc: Add an AVClass pointer to the private data

Message ID 1305882144-16023-1-git-send-email-martin@martin.st
State Committed
Commit 50fefa10de920e16036f2be977c39fc0c286d024
Headers show

Commit Message

Martin Storsjö May 20, 2011, 9:02 a.m.
Since a private class is set for this muxer, the callers will
assume that the private data starts with an AVClass pointer.
If no such member exists, the first few bytes of the struct
will be overwritten, and the class pointer may be broken at
any later time.
---
 libavformat/mpegtsenc.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Comments

Luca Barbato May 20, 2011, 9:50 a.m. | #1
On 05/20/2011 11:02 AM, Martin Storsjö wrote:
> Since a private class is set for this muxer, the callers will
> assume that the private data starts with an AVClass pointer.
> If no such member exists, the first few bytes of the struct
> will be overwritten, and the class pointer may be broken at
> any later time.
> ---
>  libavformat/mpegtsenc.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)

Ok, I guess.

Patch

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 2aa9698..393b779 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -53,6 +53,7 @@  typedef struct MpegTSService {
 } MpegTSService;
 
 typedef struct MpegTSWrite {
+    const AVClass *av_class;
     MpegTSSection pat; /* MPEG2 pat table */
     MpegTSSection sdt; /* MPEG2 sdt table context */
     MpegTSService **services;