20 lines
		
	
	
		
			528 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			528 B
		
	
	
	
		
			Python
		
	
	
	
	
	
# RozK
 | 
						|
 | 
						|
from . import libav
 | 
						|
from .context import Context
 | 
						|
 | 
						|
class Demuxer:
 | 
						|
    __slots__ = 'context', 'video_stream', 'audio_stream'
 | 
						|
 | 
						|
    def __init__(self, path):
 | 
						|
        self.context = Context()
 | 
						|
        self.context.open_input("file:" + path)
 | 
						|
        self.video_stream = self.context.find_stream(libav.AVMEDIA_TYPE_VIDEO)
 | 
						|
        self.audio_stream = self.context.find_stream(libav.AVMEDIA_TYPE_AUDIO)
 | 
						|
 | 
						|
    def read_packet(self):
 | 
						|
        return self.context.read_packet()
 | 
						|
 | 
						|
    def close(self):
 | 
						|
        self.context.close_input()
 |