OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / libhb / reader.c
index 11cb23b..94ee77e 100644 (file)
@@ -141,7 +141,10 @@ static stream_timing_t *id_to_st( hb_reader_t *r, const hb_buffer_t *buf )
         }
         st->id = buf->id;
         st->average = 30.*90.;
-        st->last = buf->renderOffset - st->average;
+        if ( r->saw_video )
+            st->last = buf->renderOffset - st->average;
+        else
+            st->last = -st->average;
         if ( ( st->is_audio = is_audio( r, buf->id ) ) != 0 )
         {
             r->saw_audio = 1;
@@ -191,12 +194,20 @@ static void ReaderFunc( void * _r )
     int            chapter = -1;
     int            chapter_end = r->job->chapter_end;
 
-    if( !( r->dvd = hb_dvd_init( r->title->dvd ) ) )
+    if ( r->title->type == HB_DVD_TYPE )
     {
-        if ( !( r->stream = hb_stream_open( r->title->dvd, r->title ) ) )
-        {
-          return;
-        }
+        if ( !( r->dvd = hb_dvd_init( r->title->path ) ) )
+            return;
+    }
+    else if ( r->title->type == HB_STREAM_TYPE )
+    {
+        if ( !( r->stream = hb_stream_open( r->title->path, r->title ) ) )
+            return;
+    }
+    else
+    {
+        // Unknown type, should never happen
+        return;
     }
 
     if (r->dvd)