diff options
author | Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com> | 2009-03-29 15:28:06 +0200 |
---|---|---|
committer | Jan Schmidt <thaytan@noraisin.net> | 2009-06-20 15:21:22 +0100 |
commit | f70ddb66050244bdc0833d7cdc6c1b2e64f425ff (patch) | |
tree | c410ebd1299781df75d7e1a4dfa5fd25a6f763e4 /sys/vdpau/gstvdpaumpegdecoder.c | |
parent | 584b000583c7050689d7a93e5d6dc7083bbdfcbd (diff) | |
download | gst-plugins-bad-f70ddb66050244bdc0833d7cdc6c1b2e64f425ff.tar.gz gst-plugins-bad-f70ddb66050244bdc0833d7cdc6c1b2e64f425ff.tar.bz2 gst-plugins-bad-f70ddb66050244bdc0833d7cdc6c1b2e64f425ff.zip |
vdpau: create VdpDecoder in set_caps add more functions for parsing mpeg
Diffstat (limited to 'sys/vdpau/gstvdpaumpegdecoder.c')
-rw-r--r-- | sys/vdpau/gstvdpaumpegdecoder.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/sys/vdpau/gstvdpaumpegdecoder.c b/sys/vdpau/gstvdpaumpegdecoder.c index e5da459f..6ff9b42a 100644 --- a/sys/vdpau/gstvdpaumpegdecoder.c +++ b/sys/vdpau/gstvdpaumpegdecoder.c @@ -104,13 +104,16 @@ gst_vdpau_mpeg_decoder_set_caps (GstVdpauDecoder * dec, GstCaps * caps) GstVdpauMpegDecoder *mpeg_dec; GstStructure *structure; gint version; + VdpDecoderProfile profile; + VdpauFunctions *f; + VdpStatus status; mpeg_dec = GST_VDPAU_MPEG_DECODER (dec); structure = gst_caps_get_structure (caps, 0); gst_structure_get_int (structure, "mpegversion", &version); if (version == 1) - mpeg_dec->profile = VDP_DECODER_PROFILE_MPEG1; + profile = VDP_DECODER_PROFILE_MPEG1; else { const GValue *value; @@ -123,14 +126,24 @@ gst_vdpau_mpeg_decoder_set_caps (GstVdpauDecoder * dec, GstCaps * caps) GST_BUFFER_DATA (codec_data) + GST_BUFFER_SIZE (codec_data)); switch (hdr.profile) { case 5: - mpeg_dec->profile = VDP_DECODER_PROFILE_MPEG2_SIMPLE; + profile = VDP_DECODER_PROFILE_MPEG2_SIMPLE; break; default: - mpeg_dec->profile = VDP_DECODER_PROFILE_MPEG2_MAIN; + profile = VDP_DECODER_PROFILE_MPEG2_MAIN; break; } } + f = dec->functions; + status = f->vdp_decoder_create (dec->device, profile, dec->width, + dec->height, 2, &mpeg_dec->decoder); + if (status != VDP_STATUS_OK) { + GST_ELEMENT_ERROR (mpeg_dec, RESOURCE, READ, + ("Could not create vdpau decoder"), + ("Error returned from vdpau was: %s", + f->vdp_get_error_string (status))); + return FALSE; + } return TRUE; } @@ -174,10 +187,12 @@ gst_vdpau_mpeg_decoder_class_init (GstVdpauMpegDecoderClass * klass) } static void -gst_vdpau_mpeg_decoder_init (GstVdpauMpegDecoder * filter, +gst_vdpau_mpeg_decoder_init (GstVdpauMpegDecoder * mpeg_dec, GstVdpauMpegDecoderClass * gclass) { - filter->silent = FALSE; + mpeg_dec->silent = FALSE; + + mpeg_dec->decoder = VDP_INVALID_HANDLE; } static void |