mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
wavenc: small cleanups for toc handling
Don't add empty labl/note chunks. Always pass instance as the first param. Add more logging.
This commit is contained in:
parent
b17750ed9e
commit
f4577ff492
1 changed files with 26 additions and 12 deletions
|
@ -651,7 +651,7 @@ gst_wavenc_is_cue_id_unique (guint32 id, GList * list)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_wavenc_parse_cue (guint32 id, GstTocEntry * entry, GstWavEnc * wavenc)
|
gst_wavenc_parse_cue (GstWavEnc * wavenc, guint32 id, GstTocEntry * entry)
|
||||||
{
|
{
|
||||||
gint64 start;
|
gint64 start;
|
||||||
GstWavEncCue *cue;
|
GstWavEncCue *cue;
|
||||||
|
@ -673,7 +673,7 @@ gst_wavenc_parse_cue (guint32 id, GstTocEntry * entry, GstWavEnc * wavenc)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_wavenc_parse_labl (guint32 id, GstTocEntry * entry, GstWavEnc * wavenc)
|
gst_wavenc_parse_labl (GstWavEnc * wavenc, guint32 id, GstTocEntry * entry)
|
||||||
{
|
{
|
||||||
gchar *tag;
|
gchar *tag;
|
||||||
GstTagList *tags;
|
GstTagList *tags;
|
||||||
|
@ -682,23 +682,30 @@ gst_wavenc_parse_labl (guint32 id, GstTocEntry * entry, GstWavEnc * wavenc)
|
||||||
g_return_val_if_fail (entry != NULL, FALSE);
|
g_return_val_if_fail (entry != NULL, FALSE);
|
||||||
|
|
||||||
tags = gst_toc_entry_get_tags (entry);
|
tags = gst_toc_entry_get_tags (entry);
|
||||||
if (tags != NULL) {
|
if (!tags) {
|
||||||
if (!gst_tag_list_get_string (tags, GST_TAG_TITLE, &tag))
|
GST_INFO_OBJECT (wavenc, "no tags for entry: %d", id);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
if (!gst_tag_list_get_string (tags, GST_TAG_TITLE, &tag)) {
|
||||||
|
GST_INFO_OBJECT (wavenc, "no title tag for entry: %d", id);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
labl = g_new (GstWavEncLabl, 1);
|
labl = g_new (GstWavEncLabl, 1);
|
||||||
memcpy (labl->chunk_id, "labl", 4);
|
memcpy (labl->chunk_id, "labl", 4);
|
||||||
labl->chunk_data_size = 4 + strlen (tag) + 1;
|
labl->chunk_data_size = 4 + strlen (tag) + 1;
|
||||||
labl->cue_point_id = id;
|
labl->cue_point_id = id;
|
||||||
labl->text = tag;
|
labl->text = tag;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (wavenc, "got labl: '%s'", tag);
|
||||||
|
|
||||||
wavenc->labls = g_list_append (wavenc->labls, labl);
|
wavenc->labls = g_list_append (wavenc->labls, labl);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_wavenc_parse_note (guint32 id, GstTocEntry * entry, GstWavEnc * wavenc)
|
gst_wavenc_parse_note (GstWavEnc * wavenc, guint32 id, GstTocEntry * entry)
|
||||||
{
|
{
|
||||||
gchar *tag;
|
gchar *tag;
|
||||||
GstTagList *tags;
|
GstTagList *tags;
|
||||||
|
@ -706,9 +713,13 @@ gst_wavenc_parse_note (guint32 id, GstTocEntry * entry, GstWavEnc * wavenc)
|
||||||
|
|
||||||
g_return_val_if_fail (entry != NULL, FALSE);
|
g_return_val_if_fail (entry != NULL, FALSE);
|
||||||
tags = gst_toc_entry_get_tags (entry);
|
tags = gst_toc_entry_get_tags (entry);
|
||||||
if (tags != NULL) {
|
if (!tags) {
|
||||||
if (!gst_tag_list_get_string (tags, GST_TAG_COMMENT, &tag))
|
GST_INFO_OBJECT (wavenc, "no tags for entry: %d", id);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (!gst_tag_list_get_string (tags, GST_TAG_COMMENT, &tag)) {
|
||||||
|
GST_INFO_OBJECT (wavenc, "no comment tag for entry: %d", id);
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
note = g_new (GstWavEncNote, 1);
|
note = g_new (GstWavEncNote, 1);
|
||||||
|
@ -717,6 +728,8 @@ gst_wavenc_parse_note (guint32 id, GstTocEntry * entry, GstWavEnc * wavenc)
|
||||||
note->cue_point_id = id;
|
note->cue_point_id = id;
|
||||||
note->text = tag;
|
note->text = tag;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (wavenc, "got note: '%s'", tag);
|
||||||
|
|
||||||
wavenc->notes = g_list_append (wavenc->notes, note);
|
wavenc->notes = g_list_append (wavenc->notes, note);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -825,6 +838,7 @@ gst_wavenc_write_toc (GstWavEnc * wavenc)
|
||||||
}
|
}
|
||||||
|
|
||||||
ncues = g_list_length (list);
|
ncues = g_list_length (list);
|
||||||
|
GST_DEBUG_OBJECT (wavenc, "number of cue entries: %d", ncues);
|
||||||
|
|
||||||
while (list) {
|
while (list) {
|
||||||
guint32 id = 0;
|
guint32 id = 0;
|
||||||
|
@ -842,9 +856,9 @@ gst_wavenc_write_toc (GstWavEnc * wavenc)
|
||||||
id = g_random_int ();
|
id = g_random_int ();
|
||||||
} while (!gst_wavenc_is_cue_id_unique (id, wavenc->cues));
|
} while (!gst_wavenc_is_cue_id_unique (id, wavenc->cues));
|
||||||
}
|
}
|
||||||
gst_wavenc_parse_cue (id, entry, wavenc);
|
gst_wavenc_parse_cue (wavenc, id, entry);
|
||||||
gst_wavenc_parse_labl (id, entry, wavenc);
|
gst_wavenc_parse_labl (wavenc, id, entry);
|
||||||
gst_wavenc_parse_note (id, entry, wavenc);
|
gst_wavenc_parse_note (wavenc, id, entry);
|
||||||
list = g_list_next (list);
|
list = g_list_next (list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue