[xiph-commits] r15328 - in trunk/ffmpeg2theora: . src

j at svn.xiph.org j at svn.xiph.org
Sun Sep 21 03:46:21 PDT 2008


Author: j
Date: 2008-09-21 03:46:21 -0700 (Sun, 21 Sep 2008)
New Revision: 15328

Modified:
   trunk/ffmpeg2theora/
   trunk/ffmpeg2theora/src/ffmpeg2theora.c
   trunk/ffmpeg2theora/src/subtitles.c
Log:
further cleanup of kate support. In particular, empty Kate streams won't be
merged in (happens mostly when there is an error loading an srt file). 
(ogg.k.ogg.k)



Property changes on: trunk/ffmpeg2theora
___________________________________________________________________
Name: bzr:revision-info
   - timestamp: 2008-09-21 12:41:37.572999954 +0200
committer: j
properties: 
	branch-nick: ffmpeg2theora

   + timestamp: 2008-09-21 12:42:42.867000103 +0200
committer: j
properties: 
	branch-nick: ffmpeg2theora

Name: bzr:file-ids
   - src/ffmpeg2theora.c	6863 at 0101bb08-14d6-0310-b084-bc0e0c8e3800:trunk%2Fffmpeg2theora:ffmpeg2theora.c
src/theorautils.c	6863 at 0101bb08-14d6-0310-b084-bc0e0c8e3800:trunk%2Fffmpeg2theora:theorautils.c
src/theorautils.h	6863 at 0101bb08-14d6-0310-b084-bc0e0c8e3800:trunk%2Fffmpeg2theora:theorautils.h

   + src/ffmpeg2theora.c	6863 at 0101bb08-14d6-0310-b084-bc0e0c8e3800:trunk%2Fffmpeg2theora:ffmpeg2theora.c
src/subtitles.c	subtitles.c-20080523092315-berdpbqhudpfrkh7-1

Name: bzr:revision-id:v3-single1-dHJ1bmsvZmZtcGVnMnRoZW9yYQ..
   - 191 j-20080517230830-he5x8v2m8yrfiw35
192 j-20080518224037-pkmoctzf4qce7tog
193 j-20080518224409-6hbfp3k2ssn6egqa
194 j-20080520111939-dhi52qwbqe7a47cu
195 j-20080523092252-gj9k9db0s67vl7dw
196 j-20080523092420-l0850yrq1qkgz9t0
197 j-20080523093057-l5g0ezzy5geu0pey
198 j-20080523094343-kcno1dm2e1lr38q4
199 j-20080523163006-kjl6ewea5sxawmq2
200 j-20080523165904-l2vm52qae0hlqkhp
201 j-20080523175432-2ed953iktnl8c7cr
202 j-20080525100939-7oja8pk08v9fquiw
203 j-20080526111321-nhzaqh6ivzn0vs7b
204 j-20080527100851-2v5eyxxrq1riqi50
205 j-20080527101341-9ynbgth2b15jw792
206 j-20080527205556-19tffvfrxgt3khld
207 j-20080527205840-zeestdde3v1zks9k
208 j-20080527210129-e73y56uwmzbcid00
209 j-20080527211813-5ll680ed1q4byp16
210 j-20080528102006-aeippim0tn70mz3f
211 j-20080528104907-40kiidjojvta8j61
212 j-20080528111329-vkqbt7xkat2o9h4z
213 j-20080529102940-q9xdwm5v9espzomv
214 j-20080529111405-nmh99aon1kmh22qm
215 j-20080530094948-ncq064s4uggd9z95
216 j-20080530095056-hko2vjfwipikwjyu
217 j-20080530171822-bab8sy8lpotf8081
218 j-20080603170442-v0pxspvfcucvsaex
219 j-20080617110355-xwbeg1xidmv8fubp
220 j-20080617110518-khqlhaan52kz3lii
221 j-20080723194934-63m20dc3zmkhwj4o
222 j-20080724140108-ntgbrk6913nvtk4b
223 j-20080802221321-3fcp0s6rehryx0n5
224 j-20080802221340-0s6mh8llk6nyon5d
225 j-20080901112127-tyeax385hwukjt13
226 j-20080915075112-fg3yc8radbplosnc
227 j-20080921103515-w89p8jqwt3oq5u20
228 j-20080921103703-prnl3ls2f6u4g177
229 j-20080921104137-otk3xx827h5cofwl

   + 191 j-20080517230830-he5x8v2m8yrfiw35
192 j-20080518224037-pkmoctzf4qce7tog
193 j-20080518224409-6hbfp3k2ssn6egqa
194 j-20080520111939-dhi52qwbqe7a47cu
195 j-20080523092252-gj9k9db0s67vl7dw
196 j-20080523092420-l0850yrq1qkgz9t0
197 j-20080523093057-l5g0ezzy5geu0pey
198 j-20080523094343-kcno1dm2e1lr38q4
199 j-20080523163006-kjl6ewea5sxawmq2
200 j-20080523165904-l2vm52qae0hlqkhp
201 j-20080523175432-2ed953iktnl8c7cr
202 j-20080525100939-7oja8pk08v9fquiw
203 j-20080526111321-nhzaqh6ivzn0vs7b
204 j-20080527100851-2v5eyxxrq1riqi50
205 j-20080527101341-9ynbgth2b15jw792
206 j-20080527205556-19tffvfrxgt3khld
207 j-20080527205840-zeestdde3v1zks9k
208 j-20080527210129-e73y56uwmzbcid00
209 j-20080527211813-5ll680ed1q4byp16
210 j-20080528102006-aeippim0tn70mz3f
211 j-20080528104907-40kiidjojvta8j61
212 j-20080528111329-vkqbt7xkat2o9h4z
213 j-20080529102940-q9xdwm5v9espzomv
214 j-20080529111405-nmh99aon1kmh22qm
215 j-20080530094948-ncq064s4uggd9z95
216 j-20080530095056-hko2vjfwipikwjyu
217 j-20080530171822-bab8sy8lpotf8081
218 j-20080603170442-v0pxspvfcucvsaex
219 j-20080617110355-xwbeg1xidmv8fubp
220 j-20080617110518-khqlhaan52kz3lii
221 j-20080723194934-63m20dc3zmkhwj4o
222 j-20080724140108-ntgbrk6913nvtk4b
223 j-20080802221321-3fcp0s6rehryx0n5
224 j-20080802221340-0s6mh8llk6nyon5d
225 j-20080901112127-tyeax385hwukjt13
226 j-20080915075112-fg3yc8radbplosnc
227 j-20080921103515-w89p8jqwt3oq5u20
228 j-20080921103703-prnl3ls2f6u4g177
229 j-20080921104137-otk3xx827h5cofwl
230 j-20080921104242-dswny7jm93stokej


Modified: trunk/ffmpeg2theora/src/ffmpeg2theora.c
===================================================================
--- trunk/ffmpeg2theora/src/ffmpeg2theora.c	2008-09-21 10:46:10 UTC (rev 15327)
+++ trunk/ffmpeg2theora/src/ffmpeg2theora.c	2008-09-21 10:46:21 UTC (rev 15328)
@@ -699,6 +699,9 @@
             kate_info *ki = &info.kate_streams[i].ki;
             kate_info_init(ki);
             if (ks->num_subtitles > 0) {
+                if (!ks->subtitles_language[0]) {
+                  fprintf(stderr, "WARNING - Subtitles language not set for input file %d\n",i);
+                }
                 kate_info_set_language(ki, ks->subtitles_language);
                 kate_info_set_category(ki, ks->subtitles_category[0]?ks->subtitles_category:"subtitles");
                 if(this->force_input_fps.num > 0) {
@@ -1694,22 +1697,25 @@
         }
     }
 
-    oggmux_setup_kate_streams(&info, convert->n_kate_streams);
-
     for (n=0; n<convert->n_kate_streams; ++n) {
         ff2theora_kate_stream *ks=convert->kate_streams+n;
-        if (load_subtitles(ks,convert->ignore_non_utf8)>=0) {
+        if (load_subtitles(ks,convert->ignore_non_utf8)>0) {
           printf("Muxing Kate stream %d from %s as %s %s\n",
               n,ks->filename,
               ks->subtitles_language[0]?ks->subtitles_language:"<unknown language>",
               ks->subtitles_category[0]?ks->subtitles_category:"subtitles");
         }
         else {
-          ks->filename = NULL;
-          ks->num_subtitles = 0;
-          ks->subtitles = NULL;
+          if (n!=convert->n_kate_streams) {
+            memmove(convert->kate_streams+n,convert->kate_streams+n+1,(convert->n_kate_streams-n-1)*sizeof(ff2theora_kate_stream));
+            --convert->n_kate_streams;
+            --n;
+          }
         }
     }
+
+    oggmux_setup_kate_streams(&info, convert->n_kate_streams);
+
     //detect image sequences and set framerate if provided
     if(av_guess_image2_codec(inputfile_name) != CODEC_ID_NONE || \
        (input_fmt != NULL && strcmp(input_fmt->name, "video4linux") >= 0)) {

Modified: trunk/ffmpeg2theora/src/subtitles.c
===================================================================
--- trunk/ffmpeg2theora/src/subtitles.c	2008-09-21 10:46:10 UTC (rev 15327)
+++ trunk/ffmpeg2theora/src/subtitles.c	2008-09-21 10:46:21 UTC (rev 15328)
@@ -249,6 +249,12 @@
     unsigned int line=0;
 
     this->subtitles = NULL;
+
+    if (!this->filename) {
+        fprintf(stderr,"WARNING - No subtitles file to load from\n");
+        return -1;
+    }
+
     f = fopen(this->filename, "r");
     if (!f) {
         fprintf(stderr,"WARNING - Failed to open subtitles file %s (%s)\n", this->filename, strerror(errno));
@@ -272,7 +278,7 @@
           }
           else {
             ret=sscanf(str,"%d\n",&id);
-            if (ret!=1) {
+            if (ret!=1 || id<0) {
               fprintf(stderr,"WARNING - %s:%u: Syntax error: %s\n",this->filename,line,str);
               fclose(f);
               free(this->subtitles);
@@ -288,7 +294,7 @@
           break;
         case need_timing:
           ret=sscanf(str,"%d:%d:%d%*[.,]%d --> %d:%d:%d%*[.,]%d\n",&h0,&m0,&s0,&ms0,&h1,&m1,&s1,&ms1);
-          if (ret!=8) {
+          if (ret!=8 || (h0|m0|s0|ms0)<0 || (h1|m1|s1|ms1)<0) {
             fprintf(stderr,"WARNING - %s:%u: Syntax error: %s\n",this->filename,line,str);
             fclose(f);
             free(this->subtitles);
@@ -301,7 +307,7 @@
           need=need_text;
           break;
         case need_text:
-          if (*str=='\n') {
+          if (str[0]=='\n') {
             /* we have all the lines for that subtitle, remove the last \n */
             remove_last_newline(text);
 



More information about the commits mailing list