mirror of
https://github.com/mpv-player/mpv
synced 2025-03-11 04:44:32 +01:00
cosmetics: remove unused code, small formatting tweaks
This commit is contained in:
parent
835d3deea2
commit
4a26b4c024
@ -1484,13 +1484,6 @@ static void bind_keys(struct input_ctx *ictx,
|
||||
memcpy(bind->input,keys,(MP_MAX_KEY_DOWN+1)*sizeof(int));
|
||||
}
|
||||
|
||||
static void add_binds(struct input_ctx *ictx, const mp_cmd_bind_t* list)
|
||||
{
|
||||
int i;
|
||||
for(i = 0 ; list[i].cmd ; i++)
|
||||
bind_keys(ictx, list[i].input,list[i].cmd);
|
||||
}
|
||||
|
||||
static int parse_config(struct input_ctx *ictx, char *file)
|
||||
{
|
||||
int fd;
|
||||
|
@ -480,7 +480,7 @@ void *decode_video(sh_video_t *sh_video, unsigned char *start, int in_size,
|
||||
sh_video->buffered_pts[sh_video->num_buffered_pts];
|
||||
} else {
|
||||
mp_msg(MSGT_CPLAYER, MSGL_ERR,
|
||||
"No pts value from demuxer to " "use for frame!\n");
|
||||
"No pts value from demuxer to use for frame!\n");
|
||||
sh_video->sorted_pts = MP_NOPTS_VALUE;
|
||||
}
|
||||
}
|
||||
|
@ -52,13 +52,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// This is quite experimental, in particular it will mess up the pts values
|
||||
// in the queue - on the other hand it might fix some issues like generating
|
||||
// broken files with mencoder and stream copy.
|
||||
// Better leave it disabled for now, if we find no use for it this code should
|
||||
// just be removed again.
|
||||
#define PARSE_ON_ADD 0
|
||||
|
||||
static void clear_parser(sh_common_t *sh);
|
||||
|
||||
// Demuxer list
|
||||
@ -416,7 +409,7 @@ void free_demuxer(demuxer_t *demuxer)
|
||||
}
|
||||
|
||||
|
||||
static void ds_add_packet_internal(demux_stream_t *ds, demux_packet_t *dp)
|
||||
void ds_add_packet(demux_stream_t *ds, demux_packet_t *dp)
|
||||
{
|
||||
// append packet to DS stream:
|
||||
++ds->packs;
|
||||
@ -541,32 +534,6 @@ void ds_clear_parser(demux_stream_t *ds)
|
||||
}
|
||||
#endif
|
||||
|
||||
void ds_add_packet(demux_stream_t *ds, demux_packet_t *dp)
|
||||
{
|
||||
#if PARSE_ON_ADD && defined(CONFIG_FFMPEG)
|
||||
int len = dp->len;
|
||||
int pos = 0;
|
||||
while (len > 0) {
|
||||
uint8_t *parsed_start = dp->buffer + pos;
|
||||
int parsed_len = len;
|
||||
int consumed = ds_parse(ds->sh, &parsed_start, &parsed_len, dp->pts, dp->pos);
|
||||
pos += consumed;
|
||||
len -= consumed;
|
||||
if (parsed_start == dp->buffer && parsed_len == dp->len) {
|
||||
ds_add_packet_internal(ds, dp);
|
||||
} else if (parsed_len) {
|
||||
demux_packet_t *dp2 = new_demux_packet(parsed_len);
|
||||
dp2->pos = dp->pos;
|
||||
dp2->pts = dp->pts; // should be parser->pts but that works badly
|
||||
memcpy(dp2->buffer, parsed_start, parsed_len);
|
||||
ds_add_packet_internal(ds, dp2);
|
||||
}
|
||||
}
|
||||
#else
|
||||
ds_add_packet_internal(ds, dp);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ds_read_packet(demux_stream_t *ds, stream_t *stream, int len,
|
||||
double pts, off_t pos, int flags)
|
||||
{
|
||||
@ -593,7 +560,6 @@ int demux_fill_buffer(demuxer_t *demux, demux_stream_t *ds)
|
||||
// return value:
|
||||
// 0 = EOF
|
||||
// 1 = successful
|
||||
#define MAX_ACUMULATED_PACKETS 64
|
||||
int ds_fill_buffer(demux_stream_t *ds)
|
||||
{
|
||||
demuxer_t *demux = ds->demuxer;
|
||||
@ -616,16 +582,6 @@ int ds_fill_buffer(demux_stream_t *ds)
|
||||
while (1) {
|
||||
if (ds->packs) {
|
||||
demux_packet_t *p = ds->first;
|
||||
#if 0
|
||||
if (demux->reference_clock != MP_NOPTS_VALUE) {
|
||||
if ( p->pts != MP_NOPTS_VALUE
|
||||
&& p->pts > demux->reference_clock
|
||||
&& ds->packs < MAX_ACUMULATED_PACKETS) {
|
||||
if (demux_fill_buffer(demux, ds))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// copy useful data:
|
||||
ds->buffer = p->buffer;
|
||||
ds->buffer_pos = 0;
|
||||
@ -677,18 +633,6 @@ int ds_fill_buffer(demux_stream_t *ds)
|
||||
break;
|
||||
}
|
||||
if (!demux_fill_buffer(demux, ds)) {
|
||||
#if PARSE_ON_ADD && defined(CONFIG_FFMPEG)
|
||||
uint8_t *parsed_start = NULL;
|
||||
int parsed_len = 0;
|
||||
ds_parse(ds->sh, &parsed_start, &parsed_len, MP_NOPTS_VALUE, 0);
|
||||
if (parsed_len) {
|
||||
demux_packet_t *dp2 = new_demux_packet(parsed_len);
|
||||
dp2->pts = MP_NOPTS_VALUE;
|
||||
memcpy(dp2->buffer, parsed_start, parsed_len);
|
||||
ds_add_packet_internal(ds, dp2);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
mp_dbg(MSGT_DEMUXER, MSGL_DBG2,
|
||||
"ds_fill_buffer()->demux_fill_buffer() failed\n");
|
||||
break; // EOF
|
||||
@ -1191,11 +1135,6 @@ demuxer_t *demux_open(struct MPOpts *opts, stream_t *vs, int file_format,
|
||||
|
||||
void demux_flush(demuxer_t *demuxer)
|
||||
{
|
||||
#if PARSE_ON_ADD
|
||||
ds_clear_parser(demuxer->video);
|
||||
ds_clear_parser(demuxer->audio);
|
||||
ds_clear_parser(demuxer->sub);
|
||||
#endif
|
||||
ds_free_packs(demuxer->video);
|
||||
ds_free_packs(demuxer->audio);
|
||||
ds_free_packs(demuxer->sub);
|
||||
|
@ -461,7 +461,7 @@ static int win_x11_init_vdpau_procs(struct vo *vo)
|
||||
{0, -1}
|
||||
};
|
||||
|
||||
vdp_st = vdp_device_create_x11(x11->display, x11->screen,&vc->vdp_device,
|
||||
vdp_st = vdp_device_create_x11(x11->display, x11->screen, &vc->vdp_device,
|
||||
&vc->vdp_get_proc_address);
|
||||
if (vdp_st != VDP_STATUS_OK) {
|
||||
mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling "
|
||||
@ -747,7 +747,7 @@ static int create_vdp_decoder(struct vo *vo, int max_refs)
|
||||
break;
|
||||
default:
|
||||
mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Unknown image format!\n");
|
||||
goto fail;
|
||||
goto fail;
|
||||
}
|
||||
vdp_st = vdp->decoder_create(vc->vdp_device, vdp_decoder_profile,
|
||||
vc->vid_width, vc->vid_height, max_refs,
|
||||
@ -1099,7 +1099,7 @@ static int size_index(struct eosd_target *r)
|
||||
* free rectangle with corners (13, 20)-(w, 50) is filled recursively.
|
||||
*/
|
||||
static int pack_rectangles(struct eosd_target *rects, int num_rects,
|
||||
int w, int h, int *scratch)
|
||||
int w, int h, int *scratch)
|
||||
{
|
||||
int bins[16 << HEIGHT_SORT_BITS];
|
||||
int sizes[16 << HEIGHT_SORT_BITS] = {};
|
||||
@ -1480,7 +1480,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi, double pts)
|
||||
(const void *const*)destdata,
|
||||
mpi->stride); // pitch
|
||||
CHECK_ST_WARNING("Error when calling "
|
||||
"vdp_video_surface_put_bits_y_cb_cr");
|
||||
"vdp_video_surface_put_bits_y_cb_cr");
|
||||
} else
|
||||
// We don't support slice callbacks so this shouldn't occur -
|
||||
// I think the flags test above in pointless, but I'm adding
|
||||
@ -1727,10 +1727,10 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
||||
|
||||
switch (request) {
|
||||
case VOCTRL_GET_DEINTERLACE:
|
||||
*(int*)data = vc->deint;
|
||||
*(int *)data = vc->deint;
|
||||
return VO_TRUE;
|
||||
case VOCTRL_SET_DEINTERLACE:
|
||||
vc->deint = *(int*)data;
|
||||
vc->deint = *(int *)data;
|
||||
if (vc->deint)
|
||||
vc->deint = vc->deint_type;
|
||||
if (vc->deint_type > 2) {
|
||||
|
@ -1208,7 +1208,7 @@ static struct {
|
||||
{"ac3be", AF_FORMAT_AC3_BE},
|
||||
{"ac3ne", AF_FORMAT_AC3_NE},
|
||||
{"imaadpcm", AF_FORMAT_IMA_ADPCM},
|
||||
// ORIDNARY
|
||||
// ORDINARY
|
||||
{"u8", AF_FORMAT_U8},
|
||||
{"s8", AF_FORMAT_S8},
|
||||
{"u16le", AF_FORMAT_U16_LE},
|
||||
|
@ -2211,8 +2211,7 @@ static int fill_audio_out_buffers(struct MPContext *mpctx)
|
||||
memmove(sh_audio->a_out_buffer, &sh_audio->a_out_buffer[playsize],
|
||||
sh_audio->a_out_buffer_len);
|
||||
mpctx->delay += opts->playback_speed*playsize/(double)ao_data.bps;
|
||||
}
|
||||
else if (audio_eof && mpctx->audio_out->get_delay() < .04) {
|
||||
} else if (audio_eof && mpctx->audio_out->get_delay() < .04) {
|
||||
// Sanity check to avoid hanging in case current ao doesn't output
|
||||
// partial chunks and doesn't check for AOPLAY_FINAL_CHUNK
|
||||
mp_msg(MSGT_CPLAYER, MSGL_WARN, "Audio output truncated at end.\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user