Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
shi-yan committed Apr 21, 2015
1 parent d82667d commit 05e56f5
Show file tree
Hide file tree
Showing 6 changed files with 535 additions and 54 deletions.
531 changes: 491 additions & 40 deletions H264NALListModel.cpp

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions H264NALListModel.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#ifndef H264NALLISTMODEL_H
#define H264NALLISTMODEL_H

#include <QAbstractListModel>
#include <QAbstractTableModel>
#include <QByteArray>
#include <h264_stream.h>
#include <QVector>

class H264NALListModel : public QAbstractListModel
class H264NALListModel : public QAbstractTableModel
{
Q_OBJECT

Expand All @@ -19,6 +19,8 @@ class H264NALListModel : public QAbstractListModel
~H264NALListModel();

int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QVariant data(const QModelIndex &index, int role) const;

private:
Expand Down
18 changes: 17 additions & 1 deletion MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "ui_mainwindow.h"
#include <QFileDialog>
#include <QFileInfo>
#include <QDebug>

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
Expand All @@ -10,6 +11,7 @@ MainWindow::MainWindow(QWidget *parent) :
{
ui->setupUi(this);
connect(ui->openPushButton, SIGNAL(clicked()), this, SLOT(onOpenFile()));
connect(ui->nalTableView, SIGNAL(clicked(QModelIndex)), this, SLOT(onNalTableItemClicked(QModelIndex)));
}

MainWindow::~MainWindow()
Expand All @@ -34,10 +36,24 @@ void MainWindow::onOpenFile()

m_currentH264Model = new H264NALListModel(filename, this);

ui->nalListView->setModel(m_currentH264Model);
ui->nalTableView->setModel(m_currentH264Model);

for (int c = 0; c < ui->nalTableView->horizontalHeader()->count(); ++c)
{
ui->nalTableView->horizontalHeader()->setSectionResizeMode(c, QHeaderView::Stretch);
}

if (oldModel)
{
delete oldModel;
}
}

void MainWindow::onNalTableItemClicked(QModelIndex index)
{
qDebug() << index.row();
if (m_currentH264Model)
{
qDebug() << m_currentH264Model->data(index, Qt::UserRole).toString();
}
}
1 change: 1 addition & 0 deletions MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class MainWindow : public QMainWindow

private slots:
void onOpenFile();
void onNalTableItemClicked(QModelIndex);
};

#endif // MAINWINDOW_H
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# H264Naked
A H264 header viewer

[![Build Status](https://travis-ci.org/shi-yan/H264Naked.svg?branch=master)](https://travis-ci.org/shi-yan/H264Naked)

A H264Naked is a data viewer for H264 video stream. While working on a video decoding project, I found that video decoders are very picky about video stream's format. For unsupported video streams, those decoders usually don't generate any errors or frames. It is difficult to debug this problem. One effective way I found is dumping raw format info and comparing it with a working video. However, there aren't many options available for dumping the H264 raw info.

H264Naked is a wrapper around libh264stream.
26 changes: 16 additions & 10 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,26 @@
</item>
<item>
<widget class="QWidget" name="h264Widget" native="true">
<layout class="QHBoxLayout" name="h264WidgetHorizontalLayout">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QListView" name="nalListView">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<widget class="QSplitter" name="nalSplitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QTableView" name="nalTableView">
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
</widget>
<widget class="QPlainTextEdit" name="nalPlainTextEdit"/>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="nalPlainTextEdit"/>
</item>
</layout>
</widget>
</item>
Expand Down

0 comments on commit 05e56f5

Please sign in to comment.