Lines Matching refs:vdec
77 vdec);
79 vdec);
82 vdec, const GUID subtype, VIDEOINFOHEADER ** format, guint * size);
435 gst_dshowvideodec_com_thread (GstDshowVideoDec * vdec) in gst_dshowvideodec_com_thread() argument
439 g_mutex_lock (&vdec->com_init_lock); in gst_dshowvideodec_com_thread()
447 GST_WARNING_OBJECT (vdec, "COM has been already initialized in the same process"); in gst_dshowvideodec_com_thread()
449 GST_WARNING_OBJECT (vdec, "The concurrency model of COM has changed."); in gst_dshowvideodec_com_thread()
451 GST_INFO_OBJECT (vdec, "COM initialized successfully"); in gst_dshowvideodec_com_thread()
453 vdec->comInitialized = TRUE; in gst_dshowvideodec_com_thread()
456 g_cond_signal (&vdec->com_initialized); in gst_dshowvideodec_com_thread()
458 g_mutex_unlock (&vdec->com_init_lock); in gst_dshowvideodec_com_thread()
461 g_mutex_lock (&vdec->com_deinit_lock); in gst_dshowvideodec_com_thread()
462 g_cond_wait (&vdec->com_uninitialize, &vdec->com_deinit_lock); in gst_dshowvideodec_com_thread()
465 GST_INFO_OBJECT (vdec, "COM uninitialized successfully"); in gst_dshowvideodec_com_thread()
466 vdec->comInitialized = FALSE; in gst_dshowvideodec_com_thread()
467 g_cond_signal (&vdec->com_uninitialized); in gst_dshowvideodec_com_thread()
468 g_mutex_unlock (&vdec->com_deinit_lock); in gst_dshowvideodec_com_thread()
472 gst_dshowvideodec_init (GstDshowVideoDec * vdec) in gst_dshowvideodec_init() argument
474 GstElementClass *element_class = GST_ELEMENT_GET_CLASS (vdec); in gst_dshowvideodec_init()
477 vdec->sinkpad = in gst_dshowvideodec_init()
481 gst_pad_set_event_function (vdec->sinkpad, gst_dshowvideodec_sink_event); in gst_dshowvideodec_init()
482 gst_pad_set_chain_function (vdec->sinkpad, gst_dshowvideodec_chain); in gst_dshowvideodec_init()
483 gst_element_add_pad (GST_ELEMENT (vdec), vdec->sinkpad); in gst_dshowvideodec_init()
485 vdec->srcpad = in gst_dshowvideodec_init()
491 gst_element_add_pad (GST_ELEMENT (vdec), vdec->srcpad); in gst_dshowvideodec_init()
493 vdec->fakesrc = NULL; in gst_dshowvideodec_init()
494 vdec->fakesink = NULL; in gst_dshowvideodec_init()
495 vdec->decfilter = NULL; in gst_dshowvideodec_init()
497 vdec->last_ret = GST_FLOW_OK; in gst_dshowvideodec_init()
499 vdec->filtergraph = NULL; in gst_dshowvideodec_init()
500 vdec->mediafilter = NULL; in gst_dshowvideodec_init()
501 vdec->srccaps = NULL; in gst_dshowvideodec_init()
502 vdec->segment = gst_segment_new (); in gst_dshowvideodec_init()
504 vdec->setup = FALSE; in gst_dshowvideodec_init()
505 vdec->buffer_pool = NULL; in gst_dshowvideodec_init()
507 g_mutex_init (&vdec->com_init_lock); in gst_dshowvideodec_init()
508 g_mutex_init (&vdec->com_deinit_lock); in gst_dshowvideodec_init()
509 g_cond_init (&vdec->com_initialized); in gst_dshowvideodec_init()
510 g_cond_init (&vdec->com_uninitialize); in gst_dshowvideodec_init()
511 g_cond_init (&vdec->com_uninitialized); in gst_dshowvideodec_init()
513 g_mutex_lock (&vdec->com_init_lock); in gst_dshowvideodec_init()
517 vdec); in gst_dshowvideodec_init()
520 g_cond_wait (&vdec->com_initialized, &vdec->com_init_lock); in gst_dshowvideodec_init()
521 g_mutex_unlock (&vdec->com_init_lock); in gst_dshowvideodec_init()
527 GstDshowVideoDec *vdec = (GstDshowVideoDec *) (object); in gst_dshowvideodec_finalize() local
529 if (vdec->segment) { in gst_dshowvideodec_finalize()
530 gst_segment_free (vdec->segment); in gst_dshowvideodec_finalize()
531 vdec->segment = NULL; in gst_dshowvideodec_finalize()
534 if(vdec->buffer_pool) { in gst_dshowvideodec_finalize()
535 gst_object_unref(vdec->buffer_pool); in gst_dshowvideodec_finalize()
536 vdec->buffer_pool = NULL; in gst_dshowvideodec_finalize()
540 if (vdec->comInitialized) { in gst_dshowvideodec_finalize()
541 g_mutex_lock (&vdec->com_deinit_lock); in gst_dshowvideodec_finalize()
542 g_cond_signal (&vdec->com_uninitialize); in gst_dshowvideodec_finalize()
543 g_cond_wait (&vdec->com_uninitialized, &vdec->com_deinit_lock); in gst_dshowvideodec_finalize()
544 g_mutex_unlock (&vdec->com_deinit_lock); in gst_dshowvideodec_finalize()
547 g_mutex_clear (&vdec->com_init_lock); in gst_dshowvideodec_finalize()
548 g_mutex_clear (&vdec->com_deinit_lock); in gst_dshowvideodec_finalize()
549 g_cond_clear (&vdec->com_initialized); in gst_dshowvideodec_finalize()
550 g_cond_clear (&vdec->com_uninitialize); in gst_dshowvideodec_finalize()
551 g_cond_clear (&vdec->com_uninitialized); in gst_dshowvideodec_finalize()
559 GstDshowVideoDec *vdec = (GstDshowVideoDec *) (element); in gst_dshowvideodec_change_state() local
563 if (!gst_dshowvideodec_create_graph_and_filters (vdec)) in gst_dshowvideodec_change_state()
575 if (!gst_dshowvideodec_destroy_graph_and_filters (vdec)) in gst_dshowvideodec_change_state()
591 GstDshowVideoDec *vdec = (GstDshowVideoDec *) gst_pad_get_parent (pad); in gst_dshowvideodec_sink_setcaps() local
593 (GstDshowVideoDecClass *) G_OBJECT_GET_CLASS (vdec); in gst_dshowvideodec_sink_setcaps()
613 if (!gst_structure_get_int (s, "width", &vdec->width) || in gst_dshowvideodec_sink_setcaps()
614 !gst_structure_get_int (s, "height", &vdec->height)) { in gst_dshowvideodec_sink_setcaps()
615 GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION, in gst_dshowvideodec_sink_setcaps()
621 vdec->fps_n = gst_value_get_fraction_numerator (fps); in gst_dshowvideodec_sink_setcaps()
622 vdec->fps_d = gst_value_get_fraction_denominator (fps); in gst_dshowvideodec_sink_setcaps()
627 vdec->fps_n = 25; in gst_dshowvideodec_sink_setcaps()
628 vdec->fps_d = 1; in gst_dshowvideodec_sink_setcaps()
633 vdec->par_n = gst_value_get_fraction_numerator (par); in gst_dshowvideodec_sink_setcaps()
634 vdec->par_d = gst_value_get_fraction_denominator (par); in gst_dshowvideodec_sink_setcaps()
637 vdec->par_n = vdec->par_d = 1; in gst_dshowvideodec_sink_setcaps()
680 input_vheader->rcSource.right = vdec->width; in gst_dshowvideodec_sink_setcaps()
681 input_vheader->rcSource.bottom = vdec->height; in gst_dshowvideodec_sink_setcaps()
683 input_vheader->bmiHeader.biWidth = vdec->width; in gst_dshowvideodec_sink_setcaps()
684 input_vheader->bmiHeader.biHeight = vdec->height; in gst_dshowvideodec_sink_setcaps()
689 (vdec->width * vdec->height) * (input_vheader->bmiHeader.biBitCount / 8); in gst_dshowvideodec_sink_setcaps()
695 vdec->fakesrc->GetOutputPin()->SetMediaType(&input_mediatype); in gst_dshowvideodec_sink_setcaps()
698 vdec->fakesrc->GetOutputPin()->SetSampleSize(input_mediatype.lSampleSize); in gst_dshowvideodec_sink_setcaps()
701 hres = vdec->fakesrc->QueryInterface(IID_IBaseFilter, in gst_dshowvideodec_sink_setcaps()
704 GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION, in gst_dshowvideodec_sink_setcaps()
711 GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION, in gst_dshowvideodec_sink_setcaps()
715 input_pin = gst_dshow_get_pin_from_filter (vdec->decfilter, PINDIR_INPUT); in gst_dshowvideodec_sink_setcaps()
717 GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION, in gst_dshowvideodec_sink_setcaps()
722 hres = vdec->filtergraph->ConnectDirect (output_pin, input_pin, NULL); in gst_dshowvideodec_sink_setcaps()
724 GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION, in gst_dshowvideodec_sink_setcaps()
730 if (!gst_dshowvideodec_get_filter_output_format (vdec, in gst_dshowvideodec_sink_setcaps()
732 GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION, in gst_dshowvideodec_sink_setcaps()
747 vdec->fakesink->SetMediaType (&output_mediatype); in gst_dshowvideodec_sink_setcaps()
750 output_pin = gst_dshow_get_pin_from_filter (vdec->decfilter, PINDIR_OUTPUT); in gst_dshowvideodec_sink_setcaps()
752 GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION, in gst_dshowvideodec_sink_setcaps()
757 hres = vdec->fakesink->QueryInterface(IID_IBaseFilter, in gst_dshowvideodec_sink_setcaps()
760 GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION, in gst_dshowvideodec_sink_setcaps()
767 GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION, in gst_dshowvideodec_sink_setcaps()
772 hres = vdec->filtergraph->ConnectDirect(output_pin, input_pin, in gst_dshowvideodec_sink_setcaps()
775 GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION, in gst_dshowvideodec_sink_setcaps()
783 "width", G_TYPE_INT, vdec->width, in gst_dshowvideodec_sink_setcaps()
784 "height", G_TYPE_INT, vdec->height, NULL); in gst_dshowvideodec_sink_setcaps()
786 if (vdec->fps_n && vdec->fps_d) { in gst_dshowvideodec_sink_setcaps()
788 "framerate", GST_TYPE_FRACTION, vdec->fps_n, vdec->fps_d, NULL); in gst_dshowvideodec_sink_setcaps()
792 "pixel-aspect-ratio", GST_TYPE_FRACTION, vdec->par_n, vdec->par_d, NULL); in gst_dshowvideodec_sink_setcaps()
794 if (!gst_pad_set_caps (vdec->srcpad, caps_out)) { in gst_dshowvideodec_sink_setcaps()
795 GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION, in gst_dshowvideodec_sink_setcaps()
801 if (vdec->buffer_pool) { in gst_dshowvideodec_sink_setcaps()
802 gst_object_unref (vdec->buffer_pool); in gst_dshowvideodec_sink_setcaps()
806 gst_pad_peer_query(vdec->srcpad, query); in gst_dshowvideodec_sink_setcaps()
824 GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION, in gst_dshowvideodec_sink_setcaps()
835 GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION, in gst_dshowvideodec_sink_setcaps()
840 vdec->buffer_pool = pool; in gst_dshowvideodec_sink_setcaps()
842 hres = vdec->mediafilter->Run (-1); in gst_dshowvideodec_sink_setcaps()
844 GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION, in gst_dshowvideodec_sink_setcaps()
853 gst_object_unref (vdec); in gst_dshowvideodec_sink_setcaps()
868 GstDshowVideoDec *vdec = (GstDshowVideoDec *) gst_pad_get_parent (pad); in gst_dshowvideodec_sink_event() local
878 gst_dshowvideodec_flush (vdec); in gst_dshowvideodec_sink_event()
888 gst_segment_copy_into(segment, vdec->segment); in gst_dshowvideodec_sink_event()
890 GST_CAT_DEBUG_OBJECT (dshowvideodec_debug, vdec, in gst_dshowvideodec_sink_event()
892 GST_TIME_FORMAT, GST_TIME_ARGS (vdec->segment->start), in gst_dshowvideodec_sink_event()
893 GST_TIME_ARGS (vdec->segment->stop)); in gst_dshowvideodec_sink_event()
903 gst_object_unref (vdec); in gst_dshowvideodec_sink_event()
911 GstDshowVideoDec *vdec = (GstDshowVideoDec *) gst_pad_get_parent (pad); in gst_dshowvideodec_chain() local
916 if (!vdec->setup) { in gst_dshowvideodec_chain()
918 GST_WARNING_OBJECT (vdec, "Decoder not set up, failing"); in gst_dshowvideodec_chain()
919 vdec->last_ret = GST_FLOW_FLUSHING; in gst_dshowvideodec_chain()
923 if (vdec->last_ret != GST_FLOW_OK) { in gst_dshowvideodec_chain()
924 GST_DEBUG_OBJECT (vdec, "last decoding iteration generated a fatal error " in gst_dshowvideodec_chain()
925 "%s", gst_flow_get_name (vdec->last_ret)); in gst_dshowvideodec_chain()
937 GST_CAT_LOG_OBJECT (dshowvideodec_debug, vdec, in gst_dshowvideodec_chain()
944 GST_CAT_DEBUG_OBJECT (dshowvideodec_debug, vdec, in gst_dshowvideodec_chain()
947 gst_dshowvideodec_flush (vdec); in gst_dshowvideodec_chain()
953 vdec->fakesrc->GetOutputPin()->PushBuffer( in gst_dshowvideodec_chain()
960 gst_object_unref (vdec); in gst_dshowvideodec_chain()
962 return vdec->last_ret; in gst_dshowvideodec_chain()
968 GstDshowVideoDec *vdec = (GstDshowVideoDec *) gst_pad_get_parent (pad); in gst_dshowvideodec_src_getcaps() local
971 if (!vdec->srccaps) in gst_dshowvideodec_src_getcaps()
972 vdec->srccaps = gst_caps_new_empty (); in gst_dshowvideodec_src_getcaps()
974 if (vdec->decfilter) { in gst_dshowvideodec_src_getcaps()
980 output_pin = gst_dshow_get_pin_from_filter (vdec->decfilter, PINDIR_OUTPUT); in gst_dshowvideodec_src_getcaps()
982 GST_ELEMENT_ERROR (vdec, STREAM, FAILED, in gst_dshowvideodec_src_getcaps()
1018 vdec->mediatypes = g_list_append (vdec->mediatypes, mediatype); in gst_dshowvideodec_src_getcaps()
1019 gst_caps_append (vdec->srccaps, mediacaps); in gst_dshowvideodec_src_getcaps()
1031 if (vdec->srccaps) in gst_dshowvideodec_src_getcaps()
1032 caps = gst_caps_ref (vdec->srccaps); in gst_dshowvideodec_src_getcaps()
1035 gst_object_unref (vdec); in gst_dshowvideodec_src_getcaps()
1049 gst_dshowvideodec_flush (GstDshowVideoDec * vdec) in gst_dshowvideodec_flush() argument
1051 if (!vdec->fakesrc) in gst_dshowvideodec_flush()
1055 vdec->fakesrc->GetOutputPin()->Flush(); in gst_dshowvideodec_flush()
1056 vdec->last_ret = GST_FLOW_OK; in gst_dshowvideodec_flush()
1062 gst_dshowvideodec_get_filter_output_format (GstDshowVideoDec * vdec, in gst_dshowvideodec_get_filter_output_format() argument
1071 if (!vdec->decfilter) in gst_dshowvideodec_get_filter_output_format()
1074 output_pin = gst_dshow_get_pin_from_filter (vdec->decfilter, PINDIR_OUTPUT); in gst_dshowvideodec_get_filter_output_format()
1076 GST_ELEMENT_ERROR (vdec, CORE, NEGOTIATION, in gst_dshowvideodec_get_filter_output_format()
1108 gst_dshowvideodec_create_graph_and_filters (GstDshowVideoDec * vdec) in gst_dshowvideodec_create_graph_and_filters() argument
1112 (GstDshowVideoDecClass *) G_OBJECT_GET_CLASS (vdec); in gst_dshowvideodec_create_graph_and_filters()
1119 IID_IFilterGraph, (LPVOID *) & vdec->filtergraph); in gst_dshowvideodec_create_graph_and_filters()
1120 if (hres != S_OK || !vdec->filtergraph) { in gst_dshowvideodec_create_graph_and_filters()
1121 GST_ELEMENT_ERROR (vdec, STREAM, FAILED, ("Can't create an instance " in gst_dshowvideodec_create_graph_and_filters()
1126 hres = vdec->filtergraph->QueryInterface(IID_IMediaFilter, in gst_dshowvideodec_create_graph_and_filters()
1127 (void **) &vdec->mediafilter); in gst_dshowvideodec_create_graph_and_filters()
1128 if (hres != S_OK || !vdec->mediafilter) { in gst_dshowvideodec_create_graph_and_filters()
1129 GST_ELEMENT_ERROR (vdec, STREAM, FAILED, in gst_dshowvideodec_create_graph_and_filters()
1136 vdec->fakesrc = new FakeSrc(); in gst_dshowvideodec_create_graph_and_filters()
1138 vdec->fakesrc->AddRef(); in gst_dshowvideodec_create_graph_and_filters()
1140 hres = vdec->fakesrc->QueryInterface(IID_IBaseFilter, in gst_dshowvideodec_create_graph_and_filters()
1143 GST_WARNING_OBJECT (vdec, "Failed to QI fakesrc to IBaseFilter"); in gst_dshowvideodec_create_graph_and_filters()
1148 vdec->decfilter = gst_dshow_find_filter ( in gst_dshowvideodec_create_graph_and_filters()
1154 if (vdec->decfilter == NULL) { in gst_dshowvideodec_create_graph_and_filters()
1155 GST_ELEMENT_ERROR (vdec, STREAM, FAILED, ("Can't create an instance " in gst_dshowvideodec_create_graph_and_filters()
1161 vdec->fakesink = new VideoFakeSink(vdec); in gst_dshowvideodec_create_graph_and_filters()
1163 vdec->fakesink->AddRef(); in gst_dshowvideodec_create_graph_and_filters()
1165 hres = vdec->fakesink->QueryInterface(IID_IBaseFilter, in gst_dshowvideodec_create_graph_and_filters()
1168 GST_WARNING_OBJECT (vdec, "Failed to QI fakesink to IBaseFilter"); in gst_dshowvideodec_create_graph_and_filters()
1173 hres = vdec->filtergraph->AddFilter (srcfilter, L"src"); in gst_dshowvideodec_create_graph_and_filters()
1175 GST_ELEMENT_ERROR (vdec, STREAM, FAILED, ("Can't add fakesrc filter " in gst_dshowvideodec_create_graph_and_filters()
1180 hres = vdec->filtergraph->AddFilter(vdec->decfilter, L"decoder"); in gst_dshowvideodec_create_graph_and_filters()
1182 GST_ELEMENT_ERROR (vdec, STREAM, FAILED, ("Can't add decoder filter " in gst_dshowvideodec_create_graph_and_filters()
1187 hres = vdec->filtergraph->AddFilter(sinkfilter, L"sink"); in gst_dshowvideodec_create_graph_and_filters()
1189 GST_ELEMENT_ERROR (vdec, STREAM, FAILED, ("Can't add fakesink filter " in gst_dshowvideodec_create_graph_and_filters()
1194 vdec->setup = TRUE; in gst_dshowvideodec_create_graph_and_filters()
1206 if (vdec->fakesrc) { in gst_dshowvideodec_create_graph_and_filters()
1207 vdec->fakesrc->Release(); in gst_dshowvideodec_create_graph_and_filters()
1208 vdec->fakesrc = NULL; in gst_dshowvideodec_create_graph_and_filters()
1210 if (vdec->decfilter) { in gst_dshowvideodec_create_graph_and_filters()
1211 vdec->decfilter->Release(); in gst_dshowvideodec_create_graph_and_filters()
1212 vdec->decfilter = NULL; in gst_dshowvideodec_create_graph_and_filters()
1214 if (vdec->fakesink) { in gst_dshowvideodec_create_graph_and_filters()
1215 vdec->fakesink->Release(); in gst_dshowvideodec_create_graph_and_filters()
1216 vdec->fakesink = NULL; in gst_dshowvideodec_create_graph_and_filters()
1218 if (vdec->mediafilter) { in gst_dshowvideodec_create_graph_and_filters()
1219 vdec->mediafilter->Release(); in gst_dshowvideodec_create_graph_and_filters()
1220 vdec->mediafilter = NULL; in gst_dshowvideodec_create_graph_and_filters()
1222 if (vdec->filtergraph) { in gst_dshowvideodec_create_graph_and_filters()
1223 vdec->filtergraph->Release(); in gst_dshowvideodec_create_graph_and_filters()
1224 vdec->filtergraph = NULL; in gst_dshowvideodec_create_graph_and_filters()
1231 gst_dshowvideodec_destroy_graph_and_filters (GstDshowVideoDec * vdec) in gst_dshowvideodec_destroy_graph_and_filters() argument
1235 if (vdec->mediafilter) { in gst_dshowvideodec_destroy_graph_and_filters()
1236 vdec->mediafilter->Stop(); in gst_dshowvideodec_destroy_graph_and_filters()
1239 if (vdec->fakesrc) { in gst_dshowvideodec_destroy_graph_and_filters()
1240 if (vdec->filtergraph) { in gst_dshowvideodec_destroy_graph_and_filters()
1242 hres = vdec->fakesrc->QueryInterface(IID_IBaseFilter, in gst_dshowvideodec_destroy_graph_and_filters()
1245 vdec->filtergraph->RemoveFilter(filter); in gst_dshowvideodec_destroy_graph_and_filters()
1250 vdec->fakesrc->Release(); in gst_dshowvideodec_destroy_graph_and_filters()
1251 vdec->fakesrc = NULL; in gst_dshowvideodec_destroy_graph_and_filters()
1253 if (vdec->decfilter) { in gst_dshowvideodec_destroy_graph_and_filters()
1254 if (vdec->filtergraph) in gst_dshowvideodec_destroy_graph_and_filters()
1255 vdec->filtergraph->RemoveFilter(vdec->decfilter); in gst_dshowvideodec_destroy_graph_and_filters()
1256 vdec->decfilter->Release(); in gst_dshowvideodec_destroy_graph_and_filters()
1257 vdec->decfilter = NULL; in gst_dshowvideodec_destroy_graph_and_filters()
1259 if (vdec->fakesink) { in gst_dshowvideodec_destroy_graph_and_filters()
1260 if (vdec->filtergraph) { in gst_dshowvideodec_destroy_graph_and_filters()
1262 hres = vdec->fakesink->QueryInterface(IID_IBaseFilter, in gst_dshowvideodec_destroy_graph_and_filters()
1265 vdec->filtergraph->RemoveFilter(filter); in gst_dshowvideodec_destroy_graph_and_filters()
1270 vdec->fakesink->Release(); in gst_dshowvideodec_destroy_graph_and_filters()
1271 vdec->fakesink = NULL; in gst_dshowvideodec_destroy_graph_and_filters()
1273 if (vdec->mediafilter) { in gst_dshowvideodec_destroy_graph_and_filters()
1274 vdec->mediafilter->Release(); in gst_dshowvideodec_destroy_graph_and_filters()
1275 vdec->mediafilter = NULL; in gst_dshowvideodec_destroy_graph_and_filters()
1277 if (vdec->filtergraph) { in gst_dshowvideodec_destroy_graph_and_filters()
1278 vdec->filtergraph->Release(); in gst_dshowvideodec_destroy_graph_and_filters()
1279 vdec->filtergraph = NULL; in gst_dshowvideodec_destroy_graph_and_filters()
1282 vdec->setup = FALSE; in gst_dshowvideodec_destroy_graph_and_filters()