Lines Matching refs:ctx

240     struct dshow_ctx *ctx = s->priv_data;
243 if (ctx->control) {
244 IMediaControl_Stop(ctx->control);
245 IMediaControl_Release(ctx->control);
248 if (ctx->media_event)
249 IMediaEvent_Release(ctx->media_event);
251 if (ctx->graph) {
254 r = IGraphBuilder_EnumFilters(ctx->graph, &fenum);
259 if (IGraphBuilder_RemoveFilter(ctx->graph, f) == S_OK)
266 IGraphBuilder_Release(ctx->graph);
269 if (ctx->capture_pin[VideoDevice])
270 ff_dshow_pin_Release(ctx->capture_pin[VideoDevice]);
271 if (ctx->capture_pin[AudioDevice])
272 ff_dshow_pin_Release(ctx->capture_pin[AudioDevice]);
273 if (ctx->capture_filter[VideoDevice])
274 ff_dshow_filter_Release(ctx->capture_filter[VideoDevice]);
275 if (ctx->capture_filter[AudioDevice])
276 ff_dshow_filter_Release(ctx->capture_filter[AudioDevice]);
278 if (ctx->device_pin[VideoDevice])
279 IPin_Release(ctx->device_pin[VideoDevice]);
280 if (ctx->device_pin[AudioDevice])
281 IPin_Release(ctx->device_pin[AudioDevice]);
282 if (ctx->device_filter[VideoDevice])
283 IBaseFilter_Release(ctx->device_filter[VideoDevice]);
284 if (ctx->device_filter[AudioDevice])
285 IBaseFilter_Release(ctx->device_filter[AudioDevice]);
287 av_freep(&ctx->device_name[0]);
288 av_freep(&ctx->device_name[1]);
289 av_freep(&ctx->device_unique_name[0]);
290 av_freep(&ctx->device_unique_name[1]);
292 if(ctx->mutex)
293 CloseHandle(ctx->mutex);
294 if(ctx->event[0])
295 CloseHandle(ctx->event[0]);
296 if(ctx->event[1])
297 CloseHandle(ctx->event[1]);
299 pktl = ctx->pktl;
324 struct dshow_ctx *ctx = s->priv_data;
327 unsigned int buffer_fullness = (ctx->curbufsize[index]*100)/s->max_picture_buffer;
330 if(dropscore[++ctx->video_frame_num%ndropscores] <= buffer_fullness) {
333 ctx->device_name[devtype], devtypename, buffer_fullness, s->max_picture_buffer);
344 struct dshow_ctx *ctx = s->priv_data;
349 WaitForSingleObject(ctx->mutex, INFINITE);
367 for(ppktl = &ctx->pktl ; *ppktl ; ppktl = &(*ppktl)->next);
369 ctx->curbufsize[index] += buf_size;
371 SetEvent(ctx->event[1]);
372 ReleaseMutex(ctx->mutex);
376 ReleaseMutex(ctx->mutex);
467 struct dshow_ctx *ctx = avctx->priv_data;
471 const char *device_name = ctx->device_name[devtype];
472 int skip = (devtype == VideoDevice) ? ctx->video_device_number
473 : ctx->audio_device_number;
662 struct dshow_ctx *ctx = avctx->priv_data;
664 return (devtype == VideoDevice && (ctx->framerate ||
665 (ctx->requested_width && ctx->requested_height) ||
666 ctx->pixel_format != AV_PIX_FMT_NONE ||
667 ctx->video_codec_id != AV_CODEC_ID_RAWVIDEO))
668 || (devtype == AudioDevice && (ctx->channels || ctx->sample_size || ctx->sample_rate));
797 struct dshow_ctx *ctx = avctx->priv_data;
811 enum AVCodecID requested_video_codec_id = ctx->video_codec_id;
812 enum AVPixelFormat requested_pixel_format = ctx->pixel_format;
813 int64_t requested_framerate = ctx->framerate ? ((int64_t)ctx->requested_framerate.den * 10000000)
814 / ctx->requested_framerate.num : 0;
815 int requested_width = ctx->requested_width;
816 int requested_height = ctx->requested_height;
818 int requested_sample_rate = ctx->sample_rate;
819 int requested_sample_size = ctx->sample_size;
820 int requested_channels = ctx->channels;
1080 struct dshow_ctx *ctx = avctx->priv_data;
1095 * ctx->audio_buffer_size / 1000;
1175 struct dshow_ctx *ctx = avctx->priv_data;
1186 int should_show_properties = (devtype == VideoDevice) ? ctx->show_video_device_dialog : ctx->show_audio_device_dialog;
1210 char *desired_pin_name = devtype == VideoDevice ? ctx->video_pin_name : ctx->audio_pin_name;
1254 if (devtype == AudioDevice && ctx->audio_buffer_size) {
1256 av_log(avctx, AV_LOG_ERROR, "unable to set audio buffer size %d to pin, using pin anyway...", ctx->audio_buffer_size);
1302 struct dshow_ctx *ctx = avctx->priv_data;
1309 ctx->device_filter[devtype] = device_filter;
1310 ctx->device_unique_name[devtype] = device_unique_name;
1320 struct dshow_ctx *ctx = avctx->priv_data;
1323 IGraphBuilder *graph = ctx->graph;
1338 if ( ((ctx->audio_filter_load_file) && (strlen(ctx->audio_filter_load_file)>0) && (sourcetype == AudioSourceDevice)) ||
1339 ((ctx->video_filter_load_file) && (strlen(ctx->video_filter_load_file)>0) && (sourcetype == VideoSourceDevice)) ) {
1344 filename = ctx->audio_filter_load_file;
1346 filename = ctx->video_filter_load_file;
1372 if (ctx->device_filter[otherDevType]) {
1375 if (strcmp(device_filter_unique_name, ctx->device_unique_name[otherDevType]) == 0) {
1378 device_filter = ctx->device_filter[otherDevType];
1379 IBaseFilter_AddRef(ctx->device_filter[otherDevType]);
1381 av_log(avctx, AV_LOG_DEBUG, "not reusing previous graph capture filter %s != %s\n", device_filter_unique_name, ctx->device_unique_name[otherDevType]);
1385 ctx->device_filter [devtype] = device_filter;
1386 ctx->device_unique_name [devtype] = device_filter_unique_name;
1399 ctx->device_pin[devtype] = device_pin;
1406 ctx->capture_filter[devtype] = capture_filter;
1408 if ( ((ctx->audio_filter_save_file) && (strlen(ctx->audio_filter_save_file)>0) && (sourcetype == AudioSourceDevice)) ||
1409 ((ctx->video_filter_save_file) && (strlen(ctx->video_filter_save_file)>0) && (sourcetype == VideoSourceDevice)) ) {
1415 filename = ctx->audio_filter_save_file;
1417 filename = ctx->video_filter_save_file;
1459 ctx->capture_pin[devtype] = capture_pin;
1530 struct dshow_ctx *ctx = avctx->priv_data;
1546 ctx->capture_filter[devtype]->stream_index = st->index;
1548 ff_dshow_pin_ConnectionMediaType(ctx->capture_pin[devtype], &type);
1640 struct dshow_ctx *ctx = avctx->priv_data;
1641 char **device_name = ctx->device_name;
1677 struct dshow_ctx *ctx = avctx->priv_data;
1689 if (!ctx->list_devices && !parse_device_name(avctx)) {
1694 ctx->video_codec_id = avctx->video_codec_id ? avctx->video_codec_id
1696 if (ctx->pixel_format != AV_PIX_FMT_NONE) {
1697 if (ctx->video_codec_id != AV_CODEC_ID_RAWVIDEO) {
1704 if (ctx->framerate) {
1705 r = av_parse_video_rate(&ctx->requested_framerate, ctx->framerate);
1707 av_log(avctx, AV_LOG_ERROR, "Could not parse framerate '%s'.\n", ctx->framerate);
1718 ctx->graph = graph;
1727 if (ctx->list_devices) {
1733 if (ctx->list_options) {
1734 if (ctx->device_name[VideoDevice])
1739 if (ctx->device_name[AudioDevice]) {
1750 if (ctx->device_name[VideoDevice]) {
1757 if (ctx->device_name[AudioDevice]) {
1760 av_log(avctx, AV_LOG_INFO, "Searching for audio device within video devices for %s\n", ctx->device_name[AudioDevice]);
1769 if (ctx->list_options) {
1774 ctx->curbufsize[0] = 0;
1775 ctx->curbufsize[1] = 0;
1776 ctx->mutex = CreateMutex(NULL, 0, NULL);
1777 if (!ctx->mutex) {
1781 ctx->event[1] = CreateEvent(NULL, 1, 0, NULL);
1782 if (!ctx->event[1]) {
1792 ctx->control = control;
1799 ctx->media_event = media_event;
1807 r = DuplicateHandle(proc, media_event_handle, proc, &ctx->event[0],
1859 struct dshow_ctx *ctx = s->priv_data;
1862 while (!ctx->eof && !pktl) {
1863 WaitForSingleObject(ctx->mutex, INFINITE);
1864 pktl = ctx->pktl;
1867 ctx->pktl = ctx->pktl->next;
1869 ctx->curbufsize[pkt->stream_index] -= pkt->size;
1871 ResetEvent(ctx->event[1]);
1872 ReleaseMutex(ctx->mutex);
1874 if (dshow_check_event_queue(ctx->media_event) < 0) {
1875 ctx->eof = 1;
1879 WaitForMultipleObjects(2, ctx->event, 0, INFINITE);
1884 return ctx->eof ? AVERROR(EIO) : pkt->size;