2012-01-23 3 views
3

나는 phonon 미디어 객체에서 프레임을 잡는 데 며칠 동안 일했습니다. 내 목표는 사용자가 지정한 일정 간격으로 프레임을 캡처하는 것입니다. 우선 Phonon :: MediaObject와 관련된 틱 신호 슬롯을 구현하려고했습니다. 그러나 진드기 신호가 첫 번째 기회에 방출되기 때문에 때로는 시간 차이에 약간의 다양성이있을 수 있습니다 ... 그렇게 많은 것은 실행 가능한 해결책이 아니지만 계속 조사하고 탐색 및 grabWidget의 조합을 시도했지만 나타납니다 그 노력은 완료하는 데 시간이 걸리고 비디오가 다시 잘 실행중인 응용 프로그램을 알릴 수있는 방법이없는,이Qt Phonon & QPixmap :: GrabWidget

obj->seek(i*m_grabInterval); 
QPixmap image = QPixmap::grabWidget(m_ui.videoPlayer); 

과 같은 코드가 시간의 검은 이미지 90 %를 저장하는 원인이 있지만, 제대로 나머지 시간은 프레임을 잡아라.

내 질문은 나를 위해 더 잘 작동하도록 만드는이 두 가지 아이디어 중 하나에 대해 할 수있는 것이 무엇입니까? 아니면 내가 틀린 나무 위로 크게 짖고 있습니다. 그리고 내가 완전히 놓친 훨씬 더 명백한 것이 있습니까?

미리 감사드립니다. 당신은 잘못 짚었하는

답변

2

this 내가 사안을 상세히 조사했다 포논 :: VideoWidget

편집

에서 스냅 샷() FUNC를 사용하여 QImage를 생성, 작동합니다. 스냅 샷 기능이 구현되지 않았습니다. (videowidgetinterface.h에서) 다음과 같이

QImage VideoWidget::snapshot() const { 
    P_D(const VideoWidget); 
    ConstIface<IFACES4> iface(d); 
    if(iface) return iface->snapshot(); 
    return QImage(); // TODO not implemented in VideoInterface 
} 

IFACES4가 VideoWidgetInterface44 지칭 포논 4.4 정의된다 :

class VideoWidgetInterface 
{ 

    public: 
     virtual ~VideoWidgetInterface() {} 
     virtual Phonon::VideoWidget::AspectRatio aspectRatio() const = 0; 
     virtual void setAspectRatio(Phonon::VideoWidget::AspectRatio) = 0; 
     virtual qreal brightness() const = 0; 
     virtual void setBrightness(qreal) = 0; 
     virtual Phonon::VideoWidget::ScaleMode scaleMode() const = 0; 
     virtual void setScaleMode(Phonon::VideoWidget::ScaleMode) = 0; 
     virtual qreal contrast() const = 0; 
     virtual void setContrast(qreal) = 0; 
     virtual qreal hue() const = 0; 
     virtual void setHue(qreal) = 0; 
     virtual qreal saturation() const = 0; 
     virtual void setSaturation(qreal) = 0; 
     virtual QWidget *widget() = 0; 
     virtual int overlayCapabilities() const = 0; 
     virtual bool createOverlay(QWidget *widget, int type) = 0; 
     }; 

    class VideoWidgetInterface44 : public VideoWidgetInterface 
    { 
     public: 
     virtual QImage snapshot() const = 0; 
    }; 
} 

#ifdef PHONON_BACKEND_VERSION_4_4 
    namespace Phonon { typedef VideoWidgetInterface44 VideoWidgetInterfaceLatest; } 
#else 
    namespace Phonon { typedef VideoWidgetInterface VideoWidgetInterfaceLatest; } 
#endif 

또한 살펴본 다음 포논의 src videowidget.cpp의 구현은 gstreamer 및 vlc 백엔드 구현 그들은 phonon 4.4의 스냅 샷 기능을 아직 지원하지 않습니다. 그래서 시간을내어 스냅 샷을 만드는 다른 방법을 살펴 보겠습니다.

+0

나는 [This] (http://developer.qt.nokia.com/forums/viewthread/2487)와 [this] (https://bugreports.qt.nokia.com/browse/QTBUG)도 시도했다. -21491)는 내가 고군분투하는 유일한 사람이 아니라는 것을 나타냅니다. qt ffmpeg 래퍼를 사용하기로 결정한 유사한 피클에있는 사람들을 다시보고합니다. – Sixx

+0

답장을 보내 주셔서 감사합니다. :) – Sixx