mpeg2dec: use GstVideoFormat instead of custom enum

This commit is contained in:
Tim-Philipp Müller 2010-12-29 20:19:34 +00:00
parent 0f41e3bca0
commit fd68911826
2 changed files with 9 additions and 18 deletions

View file

@ -268,7 +268,7 @@ gst_mpeg2dec_reset (GstMpeg2dec * mpeg2dec)
} }
/* reset the initial video state */ /* reset the initial video state */
mpeg2dec->format = MPEG2DEC_FORMAT_NONE; mpeg2dec->format = GST_VIDEO_FORMAT_UNKNOWN;
mpeg2dec->width = -1; mpeg2dec->width = -1;
mpeg2dec->height = -1; mpeg2dec->height = -1;
gst_segment_init (&mpeg2dec->segment, GST_FORMAT_UNDEFINED); gst_segment_init (&mpeg2dec->segment, GST_FORMAT_UNDEFINED);
@ -424,14 +424,14 @@ crop_buffer (GstMpeg2dec * mpeg2dec, GstBuffer ** buf)
/* If we don't know about the format, we just return the original /* If we don't know about the format, we just return the original
* buffer. * buffer.
*/ */
if (mpeg2dec->format == MPEG2DEC_FORMAT_I422 || if (mpeg2dec->format == GST_VIDEO_FORMAT_Y42B ||
mpeg2dec->format == MPEG2DEC_FORMAT_I420 || mpeg2dec->format == GST_VIDEO_FORMAT_I420 ||
mpeg2dec->format == MPEG2DEC_FORMAT_YV12) { mpeg2dec->format == GST_VIDEO_FORMAT_YV12) {
/*FIXME: I have tried to use gst_buffer_copy_on_write, but it /*FIXME: I have tried to use gst_buffer_copy_on_write, but it
* still have some artifact, so I'me allocating new buffer * still have some artifact, so I'me allocating new buffer
* for each frame decoded... * for each frame decoded...
*/ */
if (mpeg2dec->format == MPEG2DEC_FORMAT_I422) { if (mpeg2dec->format == GST_VIDEO_FORMAT_Y42B) {
outbuf = crop_copy_i422_buffer (mpeg2dec, input); outbuf = crop_copy_i422_buffer (mpeg2dec, input);
} else { } else {
outbuf = crop_copy_i420_buffer (mpeg2dec, input); outbuf = crop_copy_i420_buffer (mpeg2dec, input);
@ -552,7 +552,7 @@ gst_mpeg2dec_negotiate_format (GstMpeg2dec * mpeg2dec)
sequence->height != sequence->chroma_height) { sequence->height != sequence->chroma_height) {
fourcc = GST_STR_FOURCC ("I420"); fourcc = GST_STR_FOURCC ("I420");
mpeg2dec->format = MPEG2DEC_FORMAT_I420; mpeg2dec->format = GST_VIDEO_FORMAT_I420;
mpeg2dec->size = mpeg2dec->size =
I420_SIZE (mpeg2dec->decoded_width, mpeg2dec->decoded_height); I420_SIZE (mpeg2dec->decoded_width, mpeg2dec->decoded_height);
@ -568,7 +568,7 @@ gst_mpeg2dec_negotiate_format (GstMpeg2dec * mpeg2dec)
gint halfsize; gint halfsize;
fourcc = GST_STR_FOURCC ("Y42B"); fourcc = GST_STR_FOURCC ("Y42B");
mpeg2dec->format = MPEG2DEC_FORMAT_I422; mpeg2dec->format = GST_VIDEO_FORMAT_Y42B;
halfsize = mpeg2dec->decoded_width * mpeg2dec->decoded_height; halfsize = mpeg2dec->decoded_width * mpeg2dec->decoded_height;
mpeg2dec->size = halfsize * 2; mpeg2dec->size = halfsize * 2;
mpeg2dec->u_offs = halfsize; mpeg2dec->u_offs = halfsize;
@ -579,7 +579,7 @@ gst_mpeg2dec_negotiate_format (GstMpeg2dec * mpeg2dec)
size = mpeg2dec->decoded_width * mpeg2dec->decoded_height; size = mpeg2dec->decoded_width * mpeg2dec->decoded_height;
fourcc = GST_STR_FOURCC ("Y444"); fourcc = GST_STR_FOURCC ("Y444");
mpeg2dec->format = MPEG2DEC_FORMAT_Y444; mpeg2dec->format = GST_VIDEO_FORMAT_Y444;
mpeg2dec->size = size * 3; mpeg2dec->size = size * 3;
mpeg2dec->u_offs = size; mpeg2dec->u_offs = size;
mpeg2dec->v_offs = size * 2; mpeg2dec->v_offs = size * 2;

View file

@ -45,15 +45,6 @@ G_BEGIN_DECLS
typedef struct _GstMpeg2dec GstMpeg2dec; typedef struct _GstMpeg2dec GstMpeg2dec;
typedef struct _GstMpeg2decClass GstMpeg2decClass; typedef struct _GstMpeg2decClass GstMpeg2decClass;
typedef enum
{
MPEG2DEC_FORMAT_NONE,
MPEG2DEC_FORMAT_I422,
MPEG2DEC_FORMAT_I420,
MPEG2DEC_FORMAT_YV12,
MPEG2DEC_FORMAT_Y444
} Mpeg2decFormat;
typedef enum typedef enum
{ {
MPEG2DEC_DISC_NONE = 0, MPEG2DEC_DISC_NONE = 0,
@ -87,7 +78,7 @@ struct _GstMpeg2dec {
GstSegment segment; GstSegment segment;
/* video state */ /* video state */
Mpeg2decFormat format; GstVideoFormat format;
gint width; gint width;
gint height; gint height;
gint decoded_width; gint decoded_width;