New upstream version 21.1.2+dfsg1
This commit is contained in:
parent
baafb6325b
commit
665f64a933
152 changed files with 3957 additions and 356 deletions
9
deps/media-playback/media-playback/decode.c
vendored
9
deps/media-playback/media-playback/decode.c
vendored
|
|
@ -338,6 +338,15 @@ bool mp_decode_next(struct mp_decode *d)
|
|||
d->stream->time_base,
|
||||
(AVRational){1, 1000000000});
|
||||
|
||||
if (d->m->speed != 100) {
|
||||
d->frame_pts = av_rescale_q(d->frame_pts,
|
||||
(AVRational){1, d->m->speed},
|
||||
(AVRational){1, 100});
|
||||
duration = av_rescale_q(duration,
|
||||
(AVRational){1, d->m->speed},
|
||||
(AVRational){1, 100});
|
||||
}
|
||||
|
||||
d->last_duration = duration;
|
||||
d->next_pts = d->frame_pts + duration;
|
||||
}
|
||||
|
|
|
|||
47
deps/media-playback/media-playback/media.c
vendored
47
deps/media-playback/media-playback/media.c
vendored
|
|
@ -271,7 +271,7 @@ static void mp_media_next_audio(mp_media_t *m)
|
|||
for (size_t i = 0; i < MAX_AV_PLANES; i++)
|
||||
audio.data[i] = f->data[i];
|
||||
|
||||
audio.samples_per_sec = f->sample_rate;
|
||||
audio.samples_per_sec = f->sample_rate * m->speed / 100;
|
||||
audio.speakers = convert_speaker_layout(f->channels);
|
||||
audio.format = convert_sample_format(f->format);
|
||||
audio.frames = f->nb_samples;
|
||||
|
|
@ -652,9 +652,7 @@ static void *mp_media_thread_start(void *opaque)
|
|||
}
|
||||
|
||||
static inline bool mp_media_init_internal(mp_media_t *m,
|
||||
const char *path,
|
||||
const char *format_name,
|
||||
bool hw)
|
||||
const struct mp_media_info *info)
|
||||
{
|
||||
if (pthread_mutex_init(&m->mutex, NULL) != 0) {
|
||||
blog(LOG_WARNING, "MP: Failed to init mutex");
|
||||
|
|
@ -665,9 +663,9 @@ static inline bool mp_media_init_internal(mp_media_t *m,
|
|||
return false;
|
||||
}
|
||||
|
||||
m->path = path ? bstrdup(path) : NULL;
|
||||
m->format_name = format_name ? bstrdup(format_name) : NULL;
|
||||
m->hw = hw;
|
||||
m->path = info->path ? bstrdup(info->path) : NULL;
|
||||
m->format_name = info->format ? bstrdup(info->format) : NULL;
|
||||
m->hw = info->hardware_decoding;
|
||||
|
||||
if (pthread_create(&m->thread, NULL, mp_media_thread_start, m) != 0) {
|
||||
blog(LOG_WARNING, "MP: Could not create media thread");
|
||||
|
|
@ -678,29 +676,22 @@ static inline bool mp_media_init_internal(mp_media_t *m,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool mp_media_init(mp_media_t *media,
|
||||
const char *path,
|
||||
const char *format,
|
||||
int buffering,
|
||||
void *opaque,
|
||||
mp_video_cb v_cb,
|
||||
mp_audio_cb a_cb,
|
||||
mp_stop_cb stop_cb,
|
||||
mp_video_cb v_preload_cb,
|
||||
bool hw_decoding,
|
||||
bool is_local_file,
|
||||
enum video_range_type force_range)
|
||||
bool mp_media_init(mp_media_t *media, const struct mp_media_info *info)
|
||||
{
|
||||
memset(media, 0, sizeof(*media));
|
||||
pthread_mutex_init_value(&media->mutex);
|
||||
media->opaque = opaque;
|
||||
media->v_cb = v_cb;
|
||||
media->a_cb = a_cb;
|
||||
media->stop_cb = stop_cb;
|
||||
media->v_preload_cb = v_preload_cb;
|
||||
media->force_range = force_range;
|
||||
media->buffering = buffering;
|
||||
media->is_local_file = is_local_file;
|
||||
media->opaque = info->opaque;
|
||||
media->v_cb = info->v_cb;
|
||||
media->a_cb = info->a_cb;
|
||||
media->stop_cb = info->stop_cb;
|
||||
media->v_preload_cb = info->v_preload_cb;
|
||||
media->force_range = info->force_range;
|
||||
media->buffering = info->buffering;
|
||||
media->speed = info->speed;
|
||||
media->is_local_file = info->is_local_file;
|
||||
|
||||
if (!info->is_local_file || media->speed < 1 || media->speed > 200)
|
||||
media->speed = 100;
|
||||
|
||||
static bool initialized = false;
|
||||
if (!initialized) {
|
||||
|
|
@ -714,7 +705,7 @@ bool mp_media_init(mp_media_t *media,
|
|||
if (!base_sys_ts)
|
||||
base_sys_ts = (int64_t)os_gettime_ns();
|
||||
|
||||
if (!mp_media_init_internal(media, path, format, hw_decoding)) {
|
||||
if (!mp_media_init_internal(media, info)) {
|
||||
mp_media_free(media);
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
31
deps/media-playback/media-playback/media.h
vendored
31
deps/media-playback/media-playback/media.h
vendored
|
|
@ -54,6 +54,7 @@ struct mp_media {
|
|||
char *path;
|
||||
char *format_name;
|
||||
int buffering;
|
||||
int speed;
|
||||
|
||||
enum AVPixelFormat scale_format;
|
||||
struct SwsContext *swscale;
|
||||
|
|
@ -96,18 +97,24 @@ struct mp_media {
|
|||
|
||||
typedef struct mp_media mp_media_t;
|
||||
|
||||
extern bool mp_media_init(mp_media_t *media,
|
||||
const char *path,
|
||||
const char *format,
|
||||
int buffering,
|
||||
void *opaque,
|
||||
mp_video_cb v_cb,
|
||||
mp_audio_cb a_cb,
|
||||
mp_stop_cb stop_cb,
|
||||
mp_video_cb v_preload_cb,
|
||||
bool hardware_decoding,
|
||||
bool is_local_file,
|
||||
enum video_range_type force_range);
|
||||
struct mp_media_info {
|
||||
void *opaque;
|
||||
|
||||
mp_video_cb v_cb;
|
||||
mp_video_cb v_preload_cb;
|
||||
mp_audio_cb a_cb;
|
||||
mp_stop_cb stop_cb;
|
||||
|
||||
const char *path;
|
||||
const char *format;
|
||||
int buffering;
|
||||
int speed;
|
||||
enum video_range_type force_range;
|
||||
bool hardware_decoding;
|
||||
bool is_local_file;
|
||||
};
|
||||
|
||||
extern bool mp_media_init(mp_media_t *media, const struct mp_media_info *info);
|
||||
extern void mp_media_free(mp_media_t *media);
|
||||
|
||||
extern void mp_media_play(mp_media_t *media, bool loop);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue