mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
mpeg2dec: Implement interlaced support.
Expand the debugging statements to show more picture information.
This commit is contained in:
parent
40c87181c5
commit
8905e8c81e
2 changed files with 26 additions and 3 deletions
|
@ -601,7 +601,8 @@ gst_mpeg2dec_negotiate_format (GstMpeg2dec * mpeg2dec)
|
||||||
"height", G_TYPE_INT, mpeg2dec->height,
|
"height", G_TYPE_INT, mpeg2dec->height,
|
||||||
"pixel-aspect-ratio", GST_TYPE_FRACTION, mpeg2dec->pixel_width,
|
"pixel-aspect-ratio", GST_TYPE_FRACTION, mpeg2dec->pixel_width,
|
||||||
mpeg2dec->pixel_height,
|
mpeg2dec->pixel_height,
|
||||||
"framerate", GST_TYPE_FRACTION, mpeg2dec->fps_n, mpeg2dec->fps_d, NULL);
|
"framerate", GST_TYPE_FRACTION, mpeg2dec->fps_n, mpeg2dec->fps_d,
|
||||||
|
"interlaced", G_TYPE_BOOLEAN, mpeg2dec->interlaced, NULL);
|
||||||
|
|
||||||
gst_pad_set_caps (mpeg2dec->srcpad, caps);
|
gst_pad_set_caps (mpeg2dec->srcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
@ -658,6 +659,9 @@ handle_sequence (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
|
||||||
mpeg2dec->fps_d = info->sequence->frame_period;
|
mpeg2dec->fps_d = info->sequence->frame_period;
|
||||||
mpeg2dec->frame_period = info->sequence->frame_period * GST_USECOND / 27;
|
mpeg2dec->frame_period = info->sequence->frame_period * GST_USECOND / 27;
|
||||||
|
|
||||||
|
mpeg2dec->interlaced =
|
||||||
|
!(info->sequence->flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (mpeg2dec,
|
GST_DEBUG_OBJECT (mpeg2dec,
|
||||||
"sequence flags: %d, frame period: %d (%g), frame rate: %d/%d",
|
"sequence flags: %d, frame period: %d (%g), frame rate: %d/%d",
|
||||||
info->sequence->flags, info->sequence->frame_period,
|
info->sequence->flags, info->sequence->frame_period,
|
||||||
|
@ -668,6 +672,13 @@ handle_sequence (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
|
||||||
GST_DEBUG_OBJECT (mpeg2dec, "transfer chars: %d, matrix coef: %d",
|
GST_DEBUG_OBJECT (mpeg2dec, "transfer chars: %d, matrix coef: %d",
|
||||||
info->sequence->transfer_characteristics,
|
info->sequence->transfer_characteristics,
|
||||||
info->sequence->matrix_coefficients);
|
info->sequence->matrix_coefficients);
|
||||||
|
GST_DEBUG_OBJECT (mpeg2dec,
|
||||||
|
"FLAGS: CONSTRAINED_PARAMETERS:%d, PROGRESSIVE_SEQUENCE:%d",
|
||||||
|
info->sequence->flags & SEQ_FLAG_CONSTRAINED_PARAMETERS,
|
||||||
|
info->sequence->flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE);
|
||||||
|
GST_DEBUG_OBJECT (mpeg2dec, "FLAGS: LOW_DELAY:%d, COLOUR_DESCRIPTION:%d",
|
||||||
|
info->sequence->flags & SEQ_FLAG_LOW_DELAY,
|
||||||
|
info->sequence->flags & SEQ_FLAG_COLOUR_DESCRIPTION);
|
||||||
|
|
||||||
if (!gst_mpeg2dec_negotiate_format (mpeg2dec))
|
if (!gst_mpeg2dec_negotiate_format (mpeg2dec))
|
||||||
goto negotiate_failed;
|
goto negotiate_failed;
|
||||||
|
@ -927,11 +938,20 @@ handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
|
||||||
}
|
}
|
||||||
mpeg2dec->next_time += GST_BUFFER_DURATION (outbuf);
|
mpeg2dec->next_time += GST_BUFFER_DURATION (outbuf);
|
||||||
|
|
||||||
|
if (picture->flags & PIC_FLAG_TOP_FIELD_FIRST)
|
||||||
|
GST_BUFFER_FLAG_SET (outbuf, GST_VIDEO_BUFFER_TFF);
|
||||||
|
|
||||||
|
if (picture->flags & PIC_FLAG_REPEAT_FIRST_FIELD)
|
||||||
|
GST_BUFFER_FLAG_SET (outbuf, GST_VIDEO_BUFFER_RFF);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (mpeg2dec,
|
GST_DEBUG_OBJECT (mpeg2dec,
|
||||||
"picture: %s %s fields:%d off:%" G_GINT64_FORMAT " ts:%"
|
"picture: %s %s %s %s %s fields:%d off:%" G_GINT64_FORMAT " ts:%"
|
||||||
GST_TIME_FORMAT,
|
GST_TIME_FORMAT,
|
||||||
(picture->flags & PIC_FLAG_TOP_FIELD_FIRST ? "tff " : " "),
|
|
||||||
(picture->flags & PIC_FLAG_PROGRESSIVE_FRAME ? "prog" : " "),
|
(picture->flags & PIC_FLAG_PROGRESSIVE_FRAME ? "prog" : " "),
|
||||||
|
(picture->flags & PIC_FLAG_TOP_FIELD_FIRST ? "tff" : " "),
|
||||||
|
(picture->flags & PIC_FLAG_REPEAT_FIRST_FIELD ? "rff" : " "),
|
||||||
|
(picture->flags & PIC_FLAG_SKIP ? "skip" : " "),
|
||||||
|
(picture->flags & PIC_FLAG_COMPOSITE_DISPLAY ? "composite" : " "),
|
||||||
picture->nb_fields, GST_BUFFER_OFFSET (outbuf),
|
picture->nb_fields, GST_BUFFER_OFFSET (outbuf),
|
||||||
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)));
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)));
|
||||||
|
|
||||||
|
@ -989,6 +1009,7 @@ handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
|
||||||
outbuf,
|
outbuf,
|
||||||
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
|
||||||
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)));
|
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)));
|
||||||
|
GST_LOG_OBJECT (mpeg2dec, "... with flags %x", GST_BUFFER_FLAGS (outbuf));
|
||||||
|
|
||||||
ret = gst_pad_push (mpeg2dec->srcpad, outbuf);
|
ret = gst_pad_push (mpeg2dec->srcpad, outbuf);
|
||||||
GST_DEBUG_OBJECT (mpeg2dec, "pushed with result %s",
|
GST_DEBUG_OBJECT (mpeg2dec, "pushed with result %s",
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
#include <gst/video/video.h>
|
||||||
#include <mpeg2.h>
|
#include <mpeg2.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
@ -96,6 +97,7 @@ struct _GstMpeg2dec {
|
||||||
gint frame_rate_code;
|
gint frame_rate_code;
|
||||||
gint64 total_frames;
|
gint64 total_frames;
|
||||||
gint64 frame_period;
|
gint64 frame_period;
|
||||||
|
gboolean interlaced;
|
||||||
|
|
||||||
gint size;
|
gint size;
|
||||||
gint u_offs;
|
gint u_offs;
|
||||||
|
|
Loading…
Reference in a new issue