mirror of
https://github.com/mpv-player/mpv
synced 2024-12-24 07:33:46 +01:00
Allocate struct demuxer with talloc
Makes it possible to add data to it without explicit freeing code.
This commit is contained in:
parent
e177fc3e8b
commit
4b33422c7b
@ -8,6 +8,7 @@
|
||||
#include "stream/stream.h"
|
||||
#include "demuxer.h"
|
||||
#include "stheader.h"
|
||||
#include "talloc.h"
|
||||
|
||||
typedef struct dd_priv {
|
||||
demuxer_t* vd;
|
||||
@ -21,7 +22,7 @@ demuxer_t* new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd) {
|
||||
demuxer_t* ret;
|
||||
dd_priv_t* priv;
|
||||
|
||||
ret = calloc(1,sizeof(demuxer_t));
|
||||
ret = talloc_zero(NULL, struct demuxer);
|
||||
|
||||
priv = malloc(sizeof(dd_priv_t));
|
||||
priv->vd = vd;
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "options.h"
|
||||
#include "talloc.h"
|
||||
#include "mp_msg.h"
|
||||
#include "help_mp.h"
|
||||
#include "m_config.h"
|
||||
@ -216,8 +217,7 @@ static const demuxer_desc_t *get_demuxer_desc_from_type(int file_format)
|
||||
demuxer_t *new_demuxer(struct MPOpts *opts, stream_t *stream, int type,
|
||||
int a_id, int v_id, int s_id, char *filename)
|
||||
{
|
||||
demuxer_t *d = malloc(sizeof(demuxer_t));
|
||||
memset(d, 0, sizeof(demuxer_t));
|
||||
struct demuxer *d = talloc_zero(NULL, struct demuxer);
|
||||
d->stream = stream;
|
||||
d->stream_pts = MP_NOPTS_VALUE;
|
||||
d->reference_clock = MP_NOPTS_VALUE;
|
||||
@ -386,7 +386,7 @@ void free_demuxer(demuxer_t *demuxer)
|
||||
}
|
||||
free(demuxer->attachments);
|
||||
}
|
||||
free(demuxer);
|
||||
talloc_free(demuxer);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user