mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
ext/vorbis/vorbisenc.*: Fix EOS handling. Still needs a fix in the ogg muxer to mark the last page as eos somehow.
Original commit message from CVS: 2005-09-15 Thomas Vander Stichele <thomas at apestaart dot org> * ext/vorbis/vorbisenc.c: (gst_vorbisenc_init), (gst_vorbisenc_sink_event), (gst_vorbisenc_chain), (gst_vorbisenc_output_buffers), (gst_vorbisenc_change_state): * ext/vorbis/vorbisenc.h: Fix EOS handling. Still needs a fix in the ogg muxer to mark the last page as eos somehow.
This commit is contained in:
parent
2c3ddfeac7
commit
891fb4943a
3 changed files with 30 additions and 23 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2005-09-15 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
|
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_init),
|
||||||
|
(gst_vorbisenc_sink_event), (gst_vorbisenc_chain),
|
||||||
|
(gst_vorbisenc_output_buffers), (gst_vorbisenc_change_state):
|
||||||
|
* ext/vorbis/vorbisenc.h:
|
||||||
|
Fix EOS handling. Still needs a fix in the ogg muxer to
|
||||||
|
mark the last page as eos somehow.
|
||||||
|
|
||||||
2005-09-15 Thomas Vander Stichele <thomas at apestaart dot org>
|
2005-09-15 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* common/gtk-doc-plugins.mak:
|
* common/gtk-doc-plugins.mak:
|
||||||
|
|
|
@ -96,6 +96,8 @@ enum
|
||||||
ARG_LAST_MESSAGE
|
ARG_LAST_MESSAGE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void gst_vorbisenc_output_buffers (GstVorbisEnc * vorbisenc);
|
||||||
|
|
||||||
/* FIXME:
|
/* FIXME:
|
||||||
* vorbis_granule_time was added between 1.0 and 1.0.1; it's too silly
|
* vorbis_granule_time was added between 1.0 and 1.0.1; it's too silly
|
||||||
* to require a new version for such a simple function, but once we move
|
* to require a new version for such a simple function, but once we move
|
||||||
|
@ -548,7 +550,6 @@ gst_vorbisenc_init (GstVorbisEnc * vorbisenc)
|
||||||
vorbisenc->last_message = NULL;
|
vorbisenc->last_message = NULL;
|
||||||
|
|
||||||
vorbisenc->setup = FALSE;
|
vorbisenc->setup = FALSE;
|
||||||
vorbisenc->eos = FALSE;
|
|
||||||
vorbisenc->header_sent = FALSE;
|
vorbisenc->header_sent = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -862,14 +863,18 @@ gst_vorbisenc_sink_event (GstPad * pad, GstEvent * event)
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
/* end of file. this can be done implicitly in the mainline,
|
/* Tell the library we're at end of stream so that it can handle
|
||||||
but it's easier to see here in non-clever fashion.
|
* the last frame and mark end of stream in the output properly */
|
||||||
Tell the library we're at end of stream so that it can handle
|
GST_DEBUG_OBJECT (vorbisenc, "EOS, clearing state and sending event on");
|
||||||
the last frame and mark end of stream in the output properly */
|
|
||||||
GST_DEBUG_OBJECT (vorbisenc, "received EOS, will process later");
|
|
||||||
vorbis_analysis_wrote (&vorbisenc->vd, 0);
|
vorbis_analysis_wrote (&vorbisenc->vd, 0);
|
||||||
vorbisenc->eos = TRUE;
|
gst_vorbisenc_output_buffers (vorbisenc);
|
||||||
gst_event_unref (event);
|
|
||||||
|
/* clean up and exit. vorbis_info_clear() must be called last */
|
||||||
|
vorbis_block_clear (&vorbisenc->vb);
|
||||||
|
vorbis_dsp_clear (&vorbisenc->vd);
|
||||||
|
vorbis_info_clear (&vorbisenc->vi);
|
||||||
|
|
||||||
|
res = gst_pad_event_default (pad, event);
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_TAG:
|
case GST_EVENT_TAG:
|
||||||
if (vorbisenc->tags) {
|
if (vorbisenc->tags) {
|
||||||
|
@ -978,6 +983,14 @@ gst_vorbisenc_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gst_vorbisenc_output_buffers (vorbisenc);
|
||||||
|
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_vorbisenc_output_buffers (GstVorbisEnc * vorbisenc)
|
||||||
|
{
|
||||||
/* vorbis does some data preanalysis, then divides up blocks for
|
/* vorbis does some data preanalysis, then divides up blocks for
|
||||||
more involved (potentially parallel) processing. Get a single
|
more involved (potentially parallel) processing. Get a single
|
||||||
block for encoding now */
|
block for encoding now */
|
||||||
|
@ -995,17 +1008,6 @@ gst_vorbisenc_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
gst_vorbisenc_push_packet (vorbisenc, &op);
|
gst_vorbisenc_push_packet (vorbisenc, &op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vorbisenc->eos) {
|
|
||||||
GST_DEBUG_OBJECT (vorbisenc, "EOS, clearing state and sending event on");
|
|
||||||
/* clean up and exit. vorbis_info_clear() must be called last */
|
|
||||||
vorbis_block_clear (&vorbisenc->vb);
|
|
||||||
vorbis_dsp_clear (&vorbisenc->vd);
|
|
||||||
vorbis_info_clear (&vorbisenc->vi);
|
|
||||||
gst_pad_push_event (vorbisenc->srcpad, gst_event_new_eos ());
|
|
||||||
//gst_element_set_eos (GST_ELEMENT (vorbisenc));
|
|
||||||
}
|
|
||||||
return GST_FLOW_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1127,8 +1129,6 @@ gst_vorbisenc_change_state (GstElement * element, GstStateChange transition)
|
||||||
vorbisenc->tags = gst_tag_list_new ();
|
vorbisenc->tags = gst_tag_list_new ();
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
vorbisenc->eos = FALSE;
|
|
||||||
break;
|
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -57,8 +57,6 @@ struct _GstVorbisEnc {
|
||||||
vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
|
vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
|
||||||
vorbis_block vb; /* local working space for packet->PCM decode */
|
vorbis_block vb; /* local working space for packet->PCM decode */
|
||||||
|
|
||||||
gboolean eos;
|
|
||||||
|
|
||||||
gboolean managed;
|
gboolean managed;
|
||||||
gint bitrate;
|
gint bitrate;
|
||||||
gint min_bitrate;
|
gint min_bitrate;
|
||||||
|
|
Loading…
Reference in a new issue