summaryrefslogtreecommitdiff
path: root/ext/daala
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2013-08-15 15:46:58 +0200
committerSebastian Dröge <slomo@circular-chaos.org>2013-08-15 15:46:58 +0200
commit2e8af6973fb2cf9c239305d56b3a290fcaa93216 (patch)
tree4185463b202c8cd23b0e9549dd458fa2bf908fab /ext/daala
parentd0ab9172c57379263c019bb4ae835de71e690038 (diff)
downloadgstreamer-plugins-bad-2e8af6973fb2cf9c239305d56b3a290fcaa93216.tar.gz
ext: Use new flush vfunc of video codec base classes and remove reset implementations
Diffstat (limited to 'ext/daala')
-rw-r--r--ext/daala/gstdaaladec.c43
-rw-r--r--ext/daala/gstdaalaenc.c13
2 files changed, 25 insertions, 31 deletions
diff --git a/ext/daala/gstdaaladec.c b/ext/daala/gstdaaladec.c
index a08e8a833..0057c5339 100644
--- a/ext/daala/gstdaaladec.c
+++ b/ext/daala/gstdaaladec.c
@@ -89,7 +89,7 @@ static gboolean daala_dec_start (GstVideoDecoder * decoder);
static gboolean daala_dec_stop (GstVideoDecoder * decoder);
static gboolean daala_dec_set_format (GstVideoDecoder * decoder,
GstVideoCodecState * state);
-static gboolean daala_dec_reset (GstVideoDecoder * decoder, gboolean hard);
+static gboolean daala_dec_flush (GstVideoDecoder * decoder);
static GstFlowReturn daala_dec_parse (GstVideoDecoder * decoder,
GstVideoCodecFrame * frame, GstAdapter * adapter, gboolean at_eos);
static GstFlowReturn daala_dec_handle_frame (GstVideoDecoder * decoder,
@@ -117,7 +117,7 @@ gst_daala_dec_class_init (GstDaalaDecClass * klass)
video_decoder_class->start = GST_DEBUG_FUNCPTR (daala_dec_start);
video_decoder_class->stop = GST_DEBUG_FUNCPTR (daala_dec_stop);
- video_decoder_class->reset = GST_DEBUG_FUNCPTR (daala_dec_reset);
+ video_decoder_class->flush = GST_DEBUG_FUNCPTR (daala_dec_flush);
video_decoder_class->set_format = GST_DEBUG_FUNCPTR (daala_dec_set_format);
video_decoder_class->parse = GST_DEBUG_FUNCPTR (daala_dec_parse);
video_decoder_class->handle_frame =
@@ -137,7 +137,7 @@ gst_daala_dec_init (GstDaalaDec * dec)
}
static void
-gst_daala_dec_reset (GstDaalaDec * dec)
+daala_dec_reset (GstDaalaDec * dec)
{
dec->need_keyframe = TRUE;
}
@@ -152,7 +152,7 @@ daala_dec_start (GstVideoDecoder * decoder)
daala_comment_clear (&dec->comment);
GST_DEBUG_OBJECT (dec, "Setting have_header to FALSE");
dec->have_header = FALSE;
- gst_daala_dec_reset (dec);
+ daala_dec_reset (dec);
return TRUE;
}
@@ -169,7 +169,7 @@ daala_dec_stop (GstVideoDecoder * decoder)
dec->setup = NULL;
daala_decode_free (dec->decoder);
dec->decoder = NULL;
- gst_daala_dec_reset (dec);
+ daala_dec_reset (dec);
if (dec->input_state) {
gst_video_codec_state_unref (dec->input_state);
dec->input_state = NULL;
@@ -182,14 +182,6 @@ daala_dec_stop (GstVideoDecoder * decoder)
return TRUE;
}
-/* FIXME : Do we want to handle hard resets differently ? */
-static gboolean
-daala_dec_reset (GstVideoDecoder * bdec, gboolean hard)
-{
- gst_daala_dec_reset (GST_DAALA_DEC (bdec));
- return TRUE;
-}
-
static GstFlowReturn
daala_dec_parse (GstVideoDecoder * decoder,
GstVideoCodecFrame * frame, GstAdapter * adapter, gboolean at_eos)
@@ -338,7 +330,8 @@ daala_handle_type_packet (GstDaalaDec * dec)
/* If we have a default PAR, see if the decoder specified a different one */
if (par_num == 1 && par_den == 1 &&
- (dec->info.pixel_aspect_numerator != 0 && dec->info.pixel_aspect_denominator != 0)) {
+ (dec->info.pixel_aspect_numerator != 0
+ && dec->info.pixel_aspect_denominator != 0)) {
par_num = dec->info.pixel_aspect_numerator;
par_den = dec->info.pixel_aspect_denominator;
}
@@ -355,16 +348,14 @@ daala_handle_type_packet (GstDaalaDec * dec)
dec->info.plane_info[0].ydec == 0 &&
dec->info.plane_info[1].xdec == 1 &&
dec->info.plane_info[1].ydec == 1 &&
- dec->info.plane_info[2].xdec == 1 &&
- dec->info.plane_info[2].ydec == 1) {
+ dec->info.plane_info[2].xdec == 1 && dec->info.plane_info[2].ydec == 1) {
fmt = GST_VIDEO_FORMAT_I420;
} else if (dec->info.nplanes == 3 && dec->info.plane_info[0].xdec == 0 &&
dec->info.plane_info[0].ydec == 0 &&
dec->info.plane_info[1].xdec == 0 &&
dec->info.plane_info[1].ydec == 0 &&
- dec->info.plane_info[2].xdec == 0 &&
- dec->info.plane_info[2].ydec == 0) {
- fmt = GST_VIDEO_FORMAT_Y444;
+ dec->info.plane_info[2].xdec == 0 && dec->info.plane_info[2].ydec == 0) {
+ fmt = GST_VIDEO_FORMAT_Y444;
} else {
goto unsupported_format;
}
@@ -440,8 +431,7 @@ header_read_error:
/* Allocate buffer and copy image data into Y444 format */
static GstFlowReturn
-daala_handle_image (GstDaalaDec * dec, od_img * img,
- GstVideoCodecFrame * frame)
+daala_handle_image (GstDaalaDec * dec, od_img * img, GstVideoCodecFrame * frame)
{
GstVideoDecoder *decoder = GST_VIDEO_DECODER (dec);
gint width, height, stride;
@@ -467,10 +457,8 @@ daala_handle_image (GstDaalaDec * dec, od_img * img,
goto invalid_frame;
for (comp = 0; comp < 3; comp++) {
- width =
- GST_VIDEO_FRAME_COMP_WIDTH (&vframe, comp);
- height =
- GST_VIDEO_FRAME_COMP_HEIGHT (&vframe, comp);
+ width = GST_VIDEO_FRAME_COMP_WIDTH (&vframe, comp);
+ height = GST_VIDEO_FRAME_COMP_HEIGHT (&vframe, comp);
stride = GST_VIDEO_FRAME_COMP_STRIDE (&vframe, comp);
dest = GST_VIDEO_FRAME_COMP_DATA (&vframe, comp);
@@ -527,7 +515,7 @@ daala_handle_data_packet (GstDaalaDec * dec, ogg_packet * packet,
goto dropping_qos;
if (G_UNLIKELY ((img.width != dec->info.pic_width
- || img.height != dec->info.pic_height)))
+ || img.height != dec->info.pic_height)))
goto wrong_dimensions;
result = daala_handle_image (dec, &img, frame);
@@ -643,7 +631,8 @@ daala_dec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
GstBufferPool *pool;
GstStructure *config;
- if (!GST_VIDEO_DECODER_CLASS (parent_class)->decide_allocation (decoder, query))
+ if (!GST_VIDEO_DECODER_CLASS (parent_class)->decide_allocation (decoder,
+ query))
return FALSE;
g_assert (gst_query_get_n_allocation_pools (query) > 0);
diff --git a/ext/daala/gstdaalaenc.c b/ext/daala/gstdaalaenc.c
index 810632ec5..9d51842f0 100644
--- a/ext/daala/gstdaalaenc.c
+++ b/ext/daala/gstdaalaenc.c
@@ -87,6 +87,7 @@ G_DEFINE_TYPE (GstDaalaEnc, gst_daala_enc, GST_TYPE_VIDEO_ENCODER);
static gboolean daala_enc_start (GstVideoEncoder * enc);
static gboolean daala_enc_stop (GstVideoEncoder * enc);
+static gboolean daala_enc_flush (GstVideoEncoder * enc);
static gboolean daala_enc_set_format (GstVideoEncoder * enc,
GstVideoCodecState * state);
static GstFlowReturn daala_enc_handle_frame (GstVideoEncoder * enc,
@@ -137,6 +138,7 @@ gst_daala_enc_class_init (GstDaalaEncClass * klass)
gstvideo_encoder_class->start = GST_DEBUG_FUNCPTR (daala_enc_start);
gstvideo_encoder_class->stop = GST_DEBUG_FUNCPTR (daala_enc_stop);
+ gstvideo_encoder_class->flush = GST_DEBUG_FUNCPTR (daala_enc_flush);
gstvideo_encoder_class->set_format = GST_DEBUG_FUNCPTR (daala_enc_set_format);
gstvideo_encoder_class->handle_frame =
GST_DEBUG_FUNCPTR (daala_enc_handle_frame);
@@ -174,7 +176,7 @@ daala_enc_finalize (GObject * object)
}
static void
-daala_enc_reset (GstDaalaEnc * enc)
+daala_enc_flush (GstDaalaEnc * enc)
{
int quant;
@@ -200,9 +202,8 @@ daala_enc_start (GstVideoEncoder * benc)
GST_DEBUG_OBJECT (benc, "start: init daala");
enc = GST_DAALA_ENC (benc);
- daala_info_init (&enc->info);
- daala_comment_init (&enc->comment);
enc->packetno = 0;
+ enc->initialised = FALSE;
return TRUE;
}
@@ -222,6 +223,10 @@ daala_enc_stop (GstVideoEncoder * benc)
daala_comment_clear (&enc->comment);
daala_info_clear (&enc->info);
+ if (enc->input_state)
+ gst_video_codec_state_unref (enc->input_state);
+ enc->input_state = NULL;
+
enc->initialised = FALSE;
return TRUE;
@@ -356,7 +361,7 @@ daala_enc_set_format (GstVideoEncoder * benc, GstVideoCodecState * state)
gst_video_codec_state_unref (enc->input_state);
enc->input_state = gst_video_codec_state_ref (state);
- daala_enc_reset (enc);
+ daala_enc_flush (enc);
enc->initialised = TRUE;
return TRUE;