obs-ffmpeg: Split definition and assignment

master
kc5nra 2015-03-24 00:12:10 -05:00
parent 94e58057fd
commit b091b03291
1 changed files with 10 additions and 4 deletions

View File

@ -244,8 +244,11 @@ static bool video_frame(struct ff_frame *frame, void *opaque)
struct ffmpeg_source *s = opaque; struct ffmpeg_source *s = opaque;
struct obs_source_frame obs_frame = {0}; struct obs_source_frame obs_frame = {0};
double d_pts = ff_get_sync_clock(&s->demuxer->clock) - frame->pts; double d_pts;
uint64_t pts = os_gettime_ns() - (uint64_t)(d_pts * 1000000000.0L); uint64_t pts;
d_pts = ff_get_sync_clock(&s->demuxer->clock) - frame->pts;
pts = os_gettime_ns() - (uint64_t)(d_pts * 1000000000.0L);
obs_frame.timestamp = pts; obs_frame.timestamp = pts;
obs_frame.width = frame->frame->width; obs_frame.width = frame->frame->width;
@ -268,8 +271,11 @@ static bool audio_frame(struct ff_frame *frame, void *opaque)
struct obs_source_audio audio_data = {0}; struct obs_source_audio audio_data = {0};
double d_pts = ff_get_sync_clock(&s->demuxer->clock) - frame->pts; double d_pts;
uint64_t pts = os_gettime_ns() - (uint64_t)(d_pts * 1000000000.0L); uint64_t pts;
d_pts = ff_get_sync_clock(&s->demuxer->clock) - frame->pts;
pts = os_gettime_ns() - (uint64_t)(d_pts * 1000000000.0L);
int channels = av_get_channel_layout_nb_channels( int channels = av_get_channel_layout_nb_channels(
av_frame_get_channel_layout(frame->frame)); av_frame_get_channel_layout(frame->frame));