mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
lavd/avfoundation: Using the actual stream index instead of hardcoded value.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
a69c70e148
commit
92827e1869
@ -89,6 +89,7 @@ typedef struct
|
||||
|
||||
int list_devices;
|
||||
int video_device_index;
|
||||
int video_stream_index;
|
||||
enum AVPixelFormat pixel_format;
|
||||
|
||||
AVCaptureSession *capture_session;
|
||||
@ -295,6 +296,8 @@ static int get_video_config(AVFormatContext *s)
|
||||
return 1;
|
||||
}
|
||||
|
||||
ctx->video_stream_index = stream->index;
|
||||
|
||||
avpriv_set_pts_info(stream, 64, 1, avf_time_base);
|
||||
|
||||
CVImageBufferRef image_buffer = CMSampleBufferGetImageBuffer(ctx->current_frame);
|
||||
@ -423,7 +426,7 @@ static int avf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
pkt->pts = pkt->dts = av_rescale_q(av_gettime() - ctx->first_pts,
|
||||
AV_TIME_BASE_Q,
|
||||
avf_time_base_q);
|
||||
pkt->stream_index = 0;
|
||||
pkt->stream_index = ctx->video_stream_index;
|
||||
pkt->flags |= AV_PKT_FLAG_KEY;
|
||||
|
||||
CVPixelBufferLockBaseAddress(image_buffer, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user