summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-04-14 23:01:10 +0200
committerwm4 <wm4@nowhere>2013-04-20 23:28:25 +0200
commiteb27e1462282af0c7a04b8c1cec2d6eded3dd968 (patch)
treeee0227e9ba5dc9ba59b472c0b6b362b157f0172d
parent6d938f483871957a6289c97e0183d61481467538 (diff)
downloadmpv-eb27e1462282af0c7a04b8c1cec2d6eded3dd968.tar.bz2
mpv-eb27e1462282af0c7a04b8c1cec2d6eded3dd968.tar.xz
demux: remove some unused things
-rw-r--r--demux/demux.c46
-rw-r--r--demux/demux.h3
-rw-r--r--demux/demux_packet.h2
3 files changed, 4 insertions, 47 deletions
diff --git a/demux/demux.c b/demux/demux.c
index eb120d874e..858078cfac 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -116,8 +116,6 @@ static struct demux_packet *create_packet(size_t len)
dp->stream_pts = MP_NOPTS_VALUE;
dp->pos = 0;
dp->keyframe = false;
- dp->refcount = 1;
- dp->master = NULL;
dp->buffer = NULL;
dp->avpacket = NULL;
return dp;
@@ -159,34 +157,12 @@ void resize_demux_packet(struct demux_packet *dp, size_t 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)
{
- if (dp->master == NULL) { //dp is a master packet
- dp->refcount--;
- if (dp->refcount == 0) {
- if (dp->avpacket)
- talloc_free(dp->avpacket);
- else
- free(dp->buffer);
- free(dp);
- }
- return;
- }
- // dp is a clone:
- free_demux_packet(dp->master);
+ if (dp->avpacket)
+ talloc_free(dp->avpacket);
+ else
+ free(dp->buffer);
free(dp);
}
@@ -209,20 +185,6 @@ static struct demux_stream *new_demuxer_stream(struct demuxer *demuxer,
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
*
diff --git a/demux/demux.h b/demux/demux.h
index f3dee7bf86..5c4e899199 100644
--- a/demux/demux.h
+++ b/demux/demux.h
@@ -288,7 +288,6 @@ struct demux_packet *new_demux_packet(size_t len);
// data must already have suitable padding
struct demux_packet *new_demux_packet_fromdata(void *data, 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);
#ifndef SIZE_MAX
@@ -309,8 +308,6 @@ struct demuxer *new_demuxer(struct MPOpts *opts, struct stream *stream,
char *filename);
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,
demux_packet_t *dp);
void ds_add_packet(struct demux_stream *ds, struct demux_packet *dp);
diff --git a/demux/demux_packet.h b/demux/demux_packet.h
index db5d41402c..39f10b9b74 100644
--- a/demux/demux_packet.h
+++ b/demux/demux_packet.h
@@ -31,8 +31,6 @@ typedef struct demux_packet {
int64_t pos; // position in index (AVI) or file (MPG)
unsigned char *buffer;
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 AVPacket *avpacket; // original libavformat packet (demux_lavf)
} demux_packet_t;