Pass time_base as argument to new_chapter() as well.
This fixes the wrong timebase the matroska demuxer had after my previous commits. Maybe we should reduce new_chapter() to just (AVFormatContext, int id) ? Originally committed as revision 13266 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
		
							parent
							
								
									f6e76ba476
								
							
						
					
					
						commit
						abd2256dbe
					
				@ -776,13 +776,13 @@ AVProgram *av_new_program(AVFormatContext *s, int id);
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param s media file handle
 | 
					 * @param s media file handle
 | 
				
			||||||
 * @param id unique id for this chapter
 | 
					 * @param id unique id for this chapter
 | 
				
			||||||
 * @param start chapter start time in AV_TIME_BASE units
 | 
					 * @param start chapter start time in time_base units
 | 
				
			||||||
 * @param end chapter end time in AV_TIME_BASE units
 | 
					 * @param end chapter end time in time_base units
 | 
				
			||||||
 * @param title chapter title
 | 
					 * @param title chapter title
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return AVChapter or NULL if error.
 | 
					 * @return AVChapter or NULL if error.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
AVChapter *ff_new_chapter(AVFormatContext *s, int id, int64_t start, int64_t end, const char *title);
 | 
					AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, int64_t start, int64_t end, const char *title);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Set the pts for a given stream.
 | 
					 * Set the pts for a given stream.
 | 
				
			||||||
 | 
				
			|||||||
@ -2254,10 +2254,7 @@ matroska_parse_chapters(AVFormatContext *s)
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (start != AV_NOPTS_VALUE && uid != -1) {
 | 
					                    if (start != AV_NOPTS_VALUE && uid != -1) {
 | 
				
			||||||
                        start = start * AV_TIME_BASE / 1000000000;
 | 
					                        if(!ff_new_chapter(s, uid, (AVRational){1, 1000000000}, start, end, title))
 | 
				
			||||||
                        if (end != AV_NOPTS_VALUE)
 | 
					 | 
				
			||||||
                            end = end * AV_TIME_BASE / 1000000000;
 | 
					 | 
				
			||||||
                        if(!ff_new_chapter(s, uid, start, end, title))
 | 
					 | 
				
			||||||
                            res= AVERROR(ENOMEM);
 | 
					                            res= AVERROR(ENOMEM);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    av_free(title);
 | 
					                    av_free(title);
 | 
				
			||||||
 | 
				
			|||||||
@ -406,8 +406,9 @@ static int decode_info_header(NUTContext *nut){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if(chapter_id && !stream_id_plus1){
 | 
					    if(chapter_id && !stream_id_plus1){
 | 
				
			||||||
        int64_t start= chapter_start / nut->time_base_count;
 | 
					        int64_t start= chapter_start / nut->time_base_count;
 | 
				
			||||||
        chapter= ff_new_chapter(s, chapter_id, start, start + chapter_len, NULL);
 | 
					        chapter= ff_new_chapter(s, chapter_id,
 | 
				
			||||||
        chapter->time_base= nut->time_base[chapter_start % nut->time_base_count];
 | 
					                                nut->time_base[chapter_start % nut->time_base_count],
 | 
				
			||||||
 | 
					                                start, start + chapter_len, NULL);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for(i=0; i<count; i++){
 | 
					    for(i=0; i<count; i++){
 | 
				
			||||||
 | 
				
			|||||||
@ -2246,7 +2246,7 @@ void av_set_program_name(AVProgram *program, char *provider_name, char *name)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AVChapter *ff_new_chapter(AVFormatContext *s, int id, int64_t start, int64_t end, const char *title)
 | 
					AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, int64_t start, int64_t end, const char *title)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    AVChapter *chapter = NULL;
 | 
					    AVChapter *chapter = NULL;
 | 
				
			||||||
    int i;
 | 
					    int i;
 | 
				
			||||||
@ -2265,6 +2265,7 @@ AVChapter *ff_new_chapter(AVFormatContext *s, int id, int64_t start, int64_t end
 | 
				
			|||||||
        av_free(chapter->title);
 | 
					        av_free(chapter->title);
 | 
				
			||||||
    chapter->title = av_strdup(title);
 | 
					    chapter->title = av_strdup(title);
 | 
				
			||||||
    chapter->id    = id;
 | 
					    chapter->id    = id;
 | 
				
			||||||
 | 
					    chapter->time_base= time_base;
 | 
				
			||||||
    chapter->start = start;
 | 
					    chapter->start = start;
 | 
				
			||||||
    chapter->end   = end;
 | 
					    chapter->end   = end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user