From: Tim-Philipp Müller Date: Sun, 23 Jun 2013 15:38:49 +0000 (+0100) Subject: mpeg2enc: store video encoder instance directly in stream writer class X-Git-Tag: 1.19.3~507^2~1497 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c9d10e22772a16f39e9226cd77a97afe88bc7681;p=platform%2Fupstream%2Fgstreamer.git mpeg2enc: store video encoder instance directly in stream writer class Instead of storing the pad and then only using it to get the element. Part-of: --- diff --git a/ext/mpeg2enc/gstmpeg2encoder.cc b/ext/mpeg2enc/gstmpeg2encoder.cc index 441735a..ada07ad 100644 --- a/ext/mpeg2enc/gstmpeg2encoder.cc +++ b/ext/mpeg2enc/gstmpeg2encoder.cc @@ -84,7 +84,7 @@ gboolean GstMpeg2Encoder::setup () return FALSE; } - writer = new GstMpeg2EncStreamWriter (video_encoder->srcpad, &parms); + writer = new GstMpeg2EncStreamWriter (video_encoder, &parms); /* encoding internals */ quantizer = new Quantizer (parms); diff --git a/ext/mpeg2enc/gstmpeg2encstreamwriter.cc b/ext/mpeg2enc/gstmpeg2encstreamwriter.cc index de8cf82..9f48aa0 100644 --- a/ext/mpeg2enc/gstmpeg2encstreamwriter.cc +++ b/ext/mpeg2enc/gstmpeg2encstreamwriter.cc @@ -32,16 +32,15 @@ * Class init stuff. */ -GstMpeg2EncStreamWriter::GstMpeg2EncStreamWriter (GstPad * in_pad, +GstMpeg2EncStreamWriter::GstMpeg2EncStreamWriter (GstVideoEncoder * venc, EncoderParams * params) { - pad = in_pad; - gst_object_ref (pad); + video_encoder = GST_VIDEO_ENCODER_CAST (gst_object_ref (venc)); } GstMpeg2EncStreamWriter::~GstMpeg2EncStreamWriter () { - gst_object_unref (pad); + gst_object_unref (video_encoder); } void @@ -50,7 +49,6 @@ GstMpeg2EncStreamWriter::WriteOutBufferUpto (const guint8 * buffer, { GstVideoCodecFrame *frame; GstBuffer *buf; - GstVideoEncoder *video_encoder = GST_VIDEO_ENCODER (GST_PAD_PARENT (pad)); GstMpeg2enc *enc = GST_MPEG2ENC (video_encoder); frame = gst_video_encoder_get_oldest_frame (video_encoder); diff --git a/ext/mpeg2enc/gstmpeg2encstreamwriter.hh b/ext/mpeg2enc/gstmpeg2encstreamwriter.hh index 2470591..84152ed 100644 --- a/ext/mpeg2enc/gstmpeg2encstreamwriter.hh +++ b/ext/mpeg2enc/gstmpeg2encstreamwriter.hh @@ -23,13 +23,13 @@ #ifndef __GST_MPEG2ENCSTREAMWRITER_H__ #define __GST_MPEG2ENCSTREAMWRITER_H__ -#include +#include #include class GstMpeg2EncStreamWriter : public ElemStrmWriter { public: - GstMpeg2EncStreamWriter (GstPad *pad, EncoderParams *params); + GstMpeg2EncStreamWriter (GstVideoEncoder *venc, EncoderParams *params); ~GstMpeg2EncStreamWriter (); /* output functions */ @@ -38,7 +38,7 @@ class GstMpeg2EncStreamWriter : public ElemStrmWriter { guint64 BitCount (); private: - GstPad *pad; + GstVideoEncoder *video_encoder; }; #endif /* __GST_MPEG2ENCSTREAMWRITER_H__ */