a pastebin project

duplicate audio streams in HB

  1. Index: libhb/reader.c
  2. ===================================================================
  3. --- libhb/reader.c      (revision 1265)
  4. +++ libhb/reader.c      (working copy)
  5. @@ -24,7 +24,7 @@
  6.   * Local prototypes
  7.   **********************************************************************/
  8.  static void        ReaderFunc( void * );
  9. -static hb_fifo_t * GetFifoForId( hb_job_t * job, int id );
  10. +static hb_fifo_t ** GetFifoForId( hb_job_t * job, int id );
  11.  
  12.  /***********************************************************************
  13.   * hb_reader_init
  14. @@ -54,9 +54,11 @@
  15.  static void ReaderFunc( void * _r )
  16.  {
  17.      hb_reader_t  * r = _r;
  18. -    hb_fifo_t    * fifo;
  19. +    hb_fifo_t   ** fifos;
  20.      hb_buffer_t  * buf;
  21. +    hb_buffer_t  * buf_old;
  22.      hb_list_t    * list;
  23. +    int            n;
  24.      int            chapter = -1;
  25.      int            chapter_end = r->job->chapter_end;
  26.  
  27. @@ -160,16 +162,36 @@
  28.          while( ( buf = hb_list_item( list, 0 ) ) )
  29.          {
  30.              hb_list_rem( list, buf );
  31. -            fifo = GetFifoForId( r->job, buf->id );
  32. -            if( fifo )
  33. -            {
  34. -                while( !*r->die && !r->job->done &&
  35. -                       hb_fifo_is_full( fifo ) )
  36. +            fifos = GetFifoForId( r->job, buf->id );
  37. +            if( fifos )
  38. +            { 
  39. +                buf->sequence = r->sequence++;
  40. +                for( n = 0; fifos[n] != NULL; n++)
  41.                  {
  42. -                    hb_snooze( 50 );
  43. +                    if( n != 0 )
  44. +                    {
  45. +                        /*
  46. +                         * Replace the buffer with a new copy of itself for when
  47. +                         * it is being sent down multiple fifos.
  48. +                         */
  49. +                        buf_old = buf;
  50. +                        buf = hb_buffer_init(buf_old->size);
  51. +                        memcpy( buf->data, buf_old->data, buf->size );
  52. +                        hb_buffer_copy_settings( buf, buf_old );
  53. +                    }
  54. +
  55. +                    while( !*r->die && !r->job->done &&
  56. +                           hb_fifo_is_full( fifos[n] ) )
  57. +                    {
  58. +                        /*
  59. +                         * Loop until the incoming fifo is reaqdy to receive
  60. +                         * this buffer.
  61. +                         */
  62. +                        hb_snooze( 50 );
  63. +                    }
  64. +
  65. +                    hb_fifo_push( fifos[n], buf );
  66.                  }
  67. -                buf->sequence = r->sequence++;
  68. -                hb_fifo_push( fifo, buf );
  69.              }
  70.              else
  71.              {
  72. @@ -201,13 +223,16 @@
  73.   ***********************************************************************
  74.   *
  75.   **********************************************************************/
  76. -static hb_fifo_t * GetFifoForId( hb_job_t * job, int id )
  77. +static hb_fifo_t ** GetFifoForId( hb_job_t * job, int id )
  78.  {
  79.      hb_title_t    * title = job->title;
  80.      hb_audio_t    * audio;
  81.      hb_subtitle_t * subtitle;
  82. -    int             i;
  83. +    int             i, n;
  84. +    static hb_fifo_t * fifos[8];
  85.  
  86. +    memset(fifos, 0, sizeof(fifos));
  87. +
  88.      if( id == 0xE0 )
  89.      {
  90.          if( job->indepth_scan )
  91. @@ -220,7 +245,8 @@
  92.          }
  93.          else
  94.          {
  95. -            return job->fifo_mpeg2;
  96. +            fifos[0] = job->fifo_mpeg2;
  97. +            return fifos;
  98.          }
  99.      }
  100.  
  101. @@ -240,7 +266,9 @@
  102.                  subtitle->hits++;
  103.                  if( job->subtitle_force )
  104.                  {
  105. -                    return subtitle->fifo_in;
  106. +                   
  107. +                    fifos[0] = subtitle->fifo_in;
  108. +                    return fifos;
  109.                  }
  110.                  break;
  111.              }
  112. @@ -249,19 +277,26 @@
  113.          if( ( subtitle = hb_list_item( title->list_subtitle, 0 ) ) &&
  114.              id == subtitle->id )
  115.          {
  116. -            return subtitle->fifo_in;
  117. +            fifos[0] = subtitle->fifo_in;
  118. +            return fifos;
  119.          }
  120.      }
  121.      if( !job->indepth_scan )
  122.      {
  123. +        n = 0;
  124.          for( i = 0; i < hb_list_count( title->list_audio ); i++ )
  125.          {
  126.              audio = hb_list_item( title->list_audio, i );
  127.              if( id == audio->id )
  128.              {
  129. -                return audio->fifo_in;
  130. +                fifos[n++] = audio->fifo_in;
  131.              }
  132.          }
  133. +
  134. +        if( n != 0 )
  135. +        {
  136. +            return fifos;
  137. +        }
  138.      }
  139.  
  140.      return NULL;
  141. Index: macosx/Controller.mm
  142. ===================================================================
  143. --- macosx/Controller.mm        (revision 1265)
  144. +++ macosx/Controller.mm        (working copy)
  145. @@ -2786,6 +2786,7 @@
  146.      /* get the index of the selected audio */
  147.      int thisAudioIndex = [sender indexOfSelectedItem] - 1;
  148.  
  149. +#if 0
  150.      /* Handbrake can't currently cope with ripping the same source track twice */
  151.      /* So, if this audio is also selected in the other audio track popup, set that popup's selection to "none" */
  152.      /* get a reference to the two audio track popups */
  153. @@ -2797,6 +2798,7 @@
  154.          [otherAudioPopUp selectItemAtIndex: 0];
  155.          [self audioTrackPopUpChanged: otherAudioPopUp];
  156.      }
  157. +#endif
  158.  
  159.      /* pointer for the hb_audio_s struct we will use later on */
  160.      hb_audio_t * audio;

advertising

Create a Paste

Please enter your new post below (or upload a file instead):





Please note that information posted here will not expire by default. If you want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords.

worth-right
fantasy-obligation