aboutsummaryrefslogtreecommitdiffstats
path: root/libavdevice
diff options
context:
space:
mode:
authorThilo Borgmann <thilo.borgmann@mail.de>2014-09-23 16:48:06 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-09-26 05:05:11 +0200
commit92827e186999fe0011c9cf440758d5532b90c31f (patch)
treecc14184cbfbacefda39eb2084625d984fd07fde7 /libavdevice
parenta69c70e148d99240a48969179c0ac1f45f29ce89 (diff)
downloadffmpeg-92827e186999fe0011c9cf440758d5532b90c31f.tar.gz
lavd/avfoundation: Using the actual stream index instead of hardcoded value.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavdevice')
-rw-r--r--libavdevice/avfoundation.m5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index 895bd29964..207d5c9531 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -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);