mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
demux: remove some unused things
This commit is contained in:
parent
6d938f4838
commit
eb27e14622
@ -116,8 +116,6 @@ static struct demux_packet *create_packet(size_t len)
|
|||||||
dp->stream_pts = MP_NOPTS_VALUE;
|
dp->stream_pts = MP_NOPTS_VALUE;
|
||||||
dp->pos = 0;
|
dp->pos = 0;
|
||||||
dp->keyframe = false;
|
dp->keyframe = false;
|
||||||
dp->refcount = 1;
|
|
||||||
dp->master = NULL;
|
|
||||||
dp->buffer = NULL;
|
dp->buffer = NULL;
|
||||||
dp->avpacket = NULL;
|
dp->avpacket = NULL;
|
||||||
return dp;
|
return dp;
|
||||||
@ -159,34 +157,12 @@ void resize_demux_packet(struct demux_packet *dp, size_t len)
|
|||||||
dp->len = len;
|
dp->len = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct demux_packet *clone_demux_packet(struct demux_packet *pack)
|
|
||||||
{
|
|
||||||
struct demux_packet *dp = malloc(sizeof(struct demux_packet));
|
|
||||||
while (pack->master)
|
|
||||||
pack = pack->master; // find the master
|
|
||||||
memcpy(dp, pack, sizeof(struct demux_packet));
|
|
||||||
dp->next = NULL;
|
|
||||||
dp->refcount = 0;
|
|
||||||
dp->master = pack;
|
|
||||||
pack->refcount++;
|
|
||||||
return dp;
|
|
||||||
}
|
|
||||||
|
|
||||||
void free_demux_packet(struct demux_packet *dp)
|
void free_demux_packet(struct demux_packet *dp)
|
||||||
{
|
{
|
||||||
if (dp->master == NULL) { //dp is a master packet
|
if (dp->avpacket)
|
||||||
dp->refcount--;
|
talloc_free(dp->avpacket);
|
||||||
if (dp->refcount == 0) {
|
else
|
||||||
if (dp->avpacket)
|
free(dp->buffer);
|
||||||
talloc_free(dp->avpacket);
|
|
||||||
else
|
|
||||||
free(dp->buffer);
|
|
||||||
free(dp);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// dp is a clone:
|
|
||||||
free_demux_packet(dp->master);
|
|
||||||
free(dp);
|
free(dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,20 +185,6 @@ static struct demux_stream *new_demuxer_stream(struct demuxer *demuxer,
|
|||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sh_stream *ds_gsh(struct demux_stream *ds)
|
|
||||||
{
|
|
||||||
// Ideally ds would have a gsh field, but since all the old demuxers set
|
|
||||||
// ds->sh themselves and we don't want to change them, enjoy this hack.
|
|
||||||
if (!ds->sh)
|
|
||||||
return NULL;
|
|
||||||
switch (ds->stream_type) {
|
|
||||||
case STREAM_VIDEO: return ((struct sh_video *)ds->sh)->gsh;
|
|
||||||
case STREAM_AUDIO: return ((struct sh_audio *)ds->sh)->gsh;
|
|
||||||
case STREAM_SUB: return ((struct sh_sub *)ds->sh)->gsh;
|
|
||||||
}
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get demuxer description structure for a given demuxer type
|
* Get demuxer description structure for a given demuxer type
|
||||||
*
|
*
|
||||||
|
@ -288,7 +288,6 @@ struct demux_packet *new_demux_packet(size_t len);
|
|||||||
// data must already have suitable padding
|
// data must already have suitable padding
|
||||||
struct demux_packet *new_demux_packet_fromdata(void *data, size_t len);
|
struct demux_packet *new_demux_packet_fromdata(void *data, size_t len);
|
||||||
void resize_demux_packet(struct demux_packet *dp, size_t len);
|
void resize_demux_packet(struct demux_packet *dp, size_t len);
|
||||||
struct demux_packet *clone_demux_packet(struct demux_packet *pack);
|
|
||||||
void free_demux_packet(struct demux_packet *dp);
|
void free_demux_packet(struct demux_packet *dp);
|
||||||
|
|
||||||
#ifndef SIZE_MAX
|
#ifndef SIZE_MAX
|
||||||
@ -309,8 +308,6 @@ struct demuxer *new_demuxer(struct MPOpts *opts, struct stream *stream,
|
|||||||
char *filename);
|
char *filename);
|
||||||
void free_demuxer(struct demuxer *demuxer);
|
void free_demuxer(struct demuxer *demuxer);
|
||||||
|
|
||||||
struct sh_stream *ds_gsh(struct demux_stream *ds);
|
|
||||||
|
|
||||||
void demuxer_add_packet(demuxer_t *demuxer, struct sh_stream *stream,
|
void demuxer_add_packet(demuxer_t *demuxer, struct sh_stream *stream,
|
||||||
demux_packet_t *dp);
|
demux_packet_t *dp);
|
||||||
void ds_add_packet(struct demux_stream *ds, struct demux_packet *dp);
|
void ds_add_packet(struct demux_stream *ds, struct demux_packet *dp);
|
||||||
|
@ -31,8 +31,6 @@ typedef struct demux_packet {
|
|||||||
int64_t pos; // position in index (AVI) or file (MPG)
|
int64_t pos; // position in index (AVI) or file (MPG)
|
||||||
unsigned char *buffer;
|
unsigned char *buffer;
|
||||||
bool keyframe;
|
bool keyframe;
|
||||||
int refcount; // counter for the master packet, if 0, buffer can be free()d
|
|
||||||
struct demux_packet *master; //in clones, pointer to the master packet
|
|
||||||
struct demux_packet *next;
|
struct demux_packet *next;
|
||||||
struct AVPacket *avpacket; // original libavformat packet (demux_lavf)
|
struct AVPacket *avpacket; // original libavformat packet (demux_lavf)
|
||||||
} demux_packet_t;
|
} demux_packet_t;
|
||||||
|
Loading…
Reference in New Issue
Block a user