1
mirror of https://github.com/mpv-player/mpv synced 2024-12-24 07:33:46 +01:00

cleanup: demuxer.[ch]: remove unused code, make functions static

Remove some unused lines from demuxer.h. Make some demuxer.c functions
static. Move new_ds_stream() declaration from demuxer.h to stream.h
(the function is defined in stream.c). Clean up some code in mplayer.c
that had commented-out free_demuxer_stream() calls.
This commit is contained in:
Uoti Urpala 2011-02-10 12:15:21 +02:00
parent 496b09e04d
commit 5177b24b25
4 changed files with 9 additions and 32 deletions

View File

@ -253,13 +253,13 @@ void free_demux_packet(struct demux_packet *dp)
free(dp);
}
void free_demuxer_stream(demux_stream_t *ds)
static void free_demuxer_stream(struct demux_stream *ds)
{
ds_free_packs(ds);
free(ds);
}
demux_stream_t *new_demuxer_stream(struct demuxer *demuxer, int id)
static struct demux_stream *new_demuxer_stream(struct demuxer *demuxer, int id)
{
demux_stream_t *ds = malloc(sizeof(demux_stream_t));
*ds = (demux_stream_t){
@ -906,7 +906,7 @@ void demuxer_help(void)
* May be NULL.
* @return DEMUXER_TYPE_xxx, -1 if error or not found
*/
int get_demuxer_type_from_name(char *demuxer_name, int *force)
static int get_demuxer_type_from_name(char *demuxer_name, int *force)
{
int i;
long type_int;

View File

@ -311,11 +311,9 @@ static inline void *realloc_struct(void *ptr, size_t nmemb, size_t size)
return realloc(ptr, nmemb * size);
}
struct demux_stream *new_demuxer_stream(struct demuxer *demuxer, int id);
struct demuxer *new_demuxer(struct MPOpts *opts, struct stream *stream,
int type, int a_id, int v_id, int s_id,
char *filename);
void free_demuxer_stream(struct demux_stream *ds);
void free_demuxer(struct demuxer *demuxer);
void ds_add_packet(struct demux_stream *ds, struct demux_packet *dp);
@ -342,22 +340,9 @@ int demux_pattern_3(struct demux_stream *ds, unsigned char *mem, int maxlen,
#define demux_peekc(ds) ( \
(likely(ds->buffer_pos<ds->buffer_size)) ? ds->buffer[ds->buffer_pos] \
: ((unlikely(!ds_fill_buffer(ds))) ? (-1) : ds->buffer[ds->buffer_pos]))
#if 1
#define demux_getc(ds) ( \
(likely(ds->buffer_pos<ds->buffer_size)) ? ds->buffer[ds->buffer_pos++] \
: ((unlikely(!ds_fill_buffer(ds))) ? (-1) : ds->buffer[ds->buffer_pos++]))
#else
static inline int demux_getc(demux_stream_t *ds){
if (ds->buffer_pos>=ds->buffer_size) {
if (!ds_fill_buffer(ds)) {
// printf("DEMUX_GETC: EOF reached!\n");
return -1; // EOF
}
}
// printf("[%02X]",ds->buffer[ds->buffer_pos]);
return ds->buffer[ds->buffer_pos++];
}
#endif
void ds_free_packs(struct demux_stream *ds);
int ds_get_packet(struct demux_stream *ds, unsigned char **start);
@ -369,9 +354,6 @@ int ds_parse(struct demux_stream *sh, uint8_t **buffer, int *len, double pts,
off_t pos);
void ds_clear_parser(struct demux_stream *sh);
// This is defined here because demux_stream_t ins't defined in stream.h
stream_t *new_ds_stream(demux_stream_t *ds);
static inline int avi_stream_id(unsigned int id)
{
unsigned char a, b;
@ -397,8 +379,6 @@ extern char *index_file_save, *index_file_load;
extern int force_ni;
extern int pts_from_bps;
extern int extension_parsing;
int demux_info_add(struct demuxer *demuxer, const char *opt, const char *param);
int demux_info_add_bstr(struct demuxer *demuxer, struct bstr opt,
struct bstr param);
@ -412,7 +392,6 @@ int demuxer_switch_video(struct demuxer *demuxer, int index);
int demuxer_type_by_filename(char *filename);
void demuxer_help(void);
int get_demuxer_type_from_name(char *demuxer_name, int *force);
int demuxer_add_attachment(struct demuxer *demuxer, struct bstr name,
struct bstr type, struct bstr data);

View File

@ -4371,14 +4371,9 @@ if (edl_output_filename) {
mpctx->stream=NULL;
mpctx->demuxer=NULL;
if (mpctx->d_audio) {
//free_demuxer_stream(mpctx->d_audio);
mpctx->d_audio=NULL;
}
if (mpctx->d_video) {
//free_demuxer_stream(d_video);
mpctx->d_video=NULL;
}
mpctx->d_audio=NULL;
mpctx->d_video=NULL;
mpctx->d_sub = NULL;
mpctx->sh_audio=NULL;
mpctx->sh_video=NULL;

View File

@ -341,6 +341,9 @@ stream_t *open_stream(const char *filename, struct MPOpts *options,
stream_t *open_stream_full(const char *filename,int mode,
struct MPOpts *options, int *file_format);
stream_t *open_output_stream(const char *filename, struct MPOpts *options);
struct demux_stream;
struct stream *new_ds_stream(struct demux_stream *ds);
/// Set the callback to be used by libstream to check for user
/// interruption during long blocking operations (cache filling, etc).
struct input_ctx;