流adb屏幕记录到QMediaPlayer

时间:2019-02-08 20:16:39

标签: python qt pyqt adb

我正在使用以下adb exec-out screenrecord --output-format=h264 -命令记录手机的屏幕: ffplay -framerate 60 -framedrop -bufsize 16M -。 它给了我一个输出,可以通过管道输出到ffplay并用QMediaPlayer复制。

我现在想要的是使用adb来重现widget = QVideoWidget() widget.show() adb_cmd = ['adb', 'exec-out', 'screenrecord', '--output-format=h264', '-'] stream = sp.Popen(adb_cmd, stdout=sp.PIPE) buffer = QBuffer(QByteArray(stream.stdout.read())) player = QMediaPlayer(None, QMediaPlayer.StreamPlayback) player.setVideoOutput(widget) player.setMedia(QMediaContent(), buffer) player.play() screen = QVBoxLayout() screen.addWidget(widget) 命令的输出,但是到目前为止我什么都没有。 我所做的是以下代码:

private StudentRepository repository;

private LiveData<List<Student>> allStudents;

private LiveData<List<Student>> studentsByLevel;

public StudentViewModel(@NonNull Application application) {
    super(application);
    repository = new StudentRepository(application);

    int stLevel = 0;
    studentsByLevel = repository.getStudentsByLevel(stLevel);
    allStudents = repository.getAllStudents();
}

.
.
.
public LiveData<List<Student>> getAllStudents() {
    return allStudents;
}

public LiveData<List<Student>> getStudentsByLevel() {
    return studentsByLevel;
}

我在这里想念的是什么?有更简单的方法吗?

0 个答案:

没有答案