Commit d06bcb98 authored by conrad's avatar conrad

don't segfault when encountering files with unknown content_types, when

filtering for content_type in oggzmerge -c, oggzdump -c, oggz-scan -k
 + print ??? instead of (null) for unknown content type in oggzinfo


git-svn-id: http://svn.annodex.net/liboggz/trunk@2066 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent 765af261
......@@ -105,7 +105,7 @@ filter_page (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
/* set scanning callback for keyframe calculation on theora pages only */
if (osdata->keyframes && ogg_page_bos ((ogg_page *)og)) {
ident = ot_page_identify (og, NULL);
if (strcasecmp ("theora", ident) == 0) {
if (ident && (strcasecmp ("theora", ident) == 0)) {
oggz_set_read_callback (oggz, serialno, osdata->read_packet, osdata);
}
}
......
......@@ -308,11 +308,13 @@ filter_page (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
if (ogg_page_bos ((ogg_page *)og)) {
ident = ot_page_identify (og, NULL);
n = oggz_table_size (oddata->content_types_table);
for (i = 0; i < n; i++) {
char * c = oggz_table_nth (oddata->content_types_table, i, NULL);
if (strcasecmp (c, ident) == 0) {
oggz_set_read_callback (oggz, serialno, oddata->read_packet, oddata);
if (ident) {
n = oggz_table_size (oddata->content_types_table);
for (i = 0; i < n; i++) {
char * c = oggz_table_nth (oddata->content_types_table, i, NULL);
if (strcasecmp (c, ident) == 0) {
oggz_set_read_callback (oggz, serialno, oddata->read_packet, oddata);
}
}
}
}
......
......@@ -196,7 +196,11 @@ oi_stats_print (OI_Info * info, OI_Stats * stats, char * label)
static void
oit_print (OI_Info * info, OI_TrackInfo * oit, long serialno)
{
printf ("\n%s: serialno %010ld\n", oit->codec_name, serialno);
if (oit->codec_name) {
printf ("\n%s: serialno %010ld\n", oit->codec_name, serialno);
} else {
printf ("\n???: serialno %010ld\n", serialno);
}
printf ("\t%ld packets in %ld pages, %.1f packets/page\n",
oit->packets.count, oit->pages.count,
(double)oit->packets.count / (double)oit->pages.count);
......
......@@ -217,10 +217,10 @@ oggz_merge (OMData * omdata, FILE * outfile)
if (careful_for_theora) {
const char * codec_name;
int is_vorbis;
int is_vorbis = 0;
codec_name = ot_page_identify (input->og, NULL);
is_vorbis = !strcmp (codec_name, "Vorbis");
if ((codec_name = ot_page_identify (input->og, NULL)) != NULL)
is_vorbis = !strcmp (codec_name, "Vorbis");
if (i == 0 && is_vorbis)
careful_for_theora = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment