Skip to content
Snippets Groups Projects
Commit a06512eb authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Remove deprecated packet items

parent 5acb3519
Branches
No related tags found
1 merge request!316Resolves #343 GUI and Frame Refactor
Pipeline #28200 failed
......@@ -17,7 +17,7 @@ extern "C" {
using ftl::codecs::codec_t;
using ftl::codecs::Channel;
static AVStream *add_video_stream(AVFormatContext *oc, const ftl::codecs::Packet &pkt)
static AVStream *add_video_stream(AVFormatContext *oc, const ftl::codecs::Packet &pkt, const ftl::rgbd::Camera &cam)
{
//AVCodecContext *c;
AVStream *st;
......@@ -47,9 +47,9 @@ static AVStream *add_video_stream(AVFormatContext *oc, const ftl::codecs::Packet
//st->nb_frames = 0;
st->codecpar->codec_id = codec_id;
st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
st->codecpar->width = ftl::codecs::getWidth(pkt.definition);
st->codecpar->width = cam.width; //ftl::codecs::getWidth(pkt.definition);
//if (pkt.flags & ftl::codecs::kFlagStereo) st->codecpar->width *= 2;
st->codecpar->height = ftl::codecs::getHeight(pkt.definition);
st->codecpar->height = cam.height; //ftl::codecs::getHeight(pkt.definition);
st->codecpar->format = AV_PIX_FMT_NV12;
st->codecpar->bit_rate = 4000000;
......@@ -149,6 +149,11 @@ int main(int argc, char **argv) {
// TODO: In future, find a better way to discover number of streams...
// Read entire file to find all streams before reading again to write data
bool res = r.read(90000000000000, [&first_ts,&current_stream,&current_channel,&r,&video_st,oc](const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) {
// Extract calibration information to determine frame resolution
if (spkt.channel == ftl::codecs::Channel::Calibration) {
// FIXME: Implement this!!
}
if (spkt.channel != static_cast<ftl::codecs::Channel>(current_channel) && current_channel != -1) return;
if (spkt.frame_number == current_stream || current_stream == 255) {
......@@ -161,7 +166,7 @@ int main(int argc, char **argv) {
if (spkt.timestamp < first_ts) first_ts = spkt.timestamp;
if (video_st[spkt.frame_number][(spkt.channel == Channel::Left) ? 0 : 1] == nullptr) {
video_st[spkt.frame_number][(spkt.channel == Channel::Left) ? 0 : 1] = add_video_stream(oc, pkt);
video_st[spkt.frame_number][(spkt.channel == Channel::Left) ? 0 : 1] = add_video_stream(oc, pkt, {0}); // FIXME: Use real calib data
}
}
});
......
......@@ -36,12 +36,7 @@ struct IndexHeader {
*/
struct Packet {
ftl::codecs::codec_t codec;
union {
[[deprecated]] ftl::codecs::definition_t definition; // Data resolution
uint8_t reserved=7;
};
uint8_t reserved=0;
uint8_t frame_count; // v4+ Frames included in this packet
uint8_t bitrate=0; // v4+ For multi-bitrate encoding, 0=highest
uint8_t flags; // Codec dependent flags (eg. I-Frame or P-Frame)
......@@ -62,12 +57,7 @@ struct StreamPacket {
int64_t timestamp;
uint8_t streamID; // Source number [or v4 frameset id]
union {
[[deprecated]] uint8_t channel_count; // v1-3 Number of channels to expect for this frame(set) to complete (usually 1 or 2)
uint8_t frame_number; // v4+ First frame number (packet may include multiple frames)
};
ftl::codecs::Channel channel; // Actual channel of this current set of packets
inline int frameNumber() const { return (version >= 4) ? frame_number : streamID; }
......
......@@ -220,7 +220,6 @@ LockedFrameSet ForeignBuilder::get(int64_t timestamp) {
auto fs = _get(timestamp);
LockedFrameSet lfs(fs.get(), fs->smtx, [this,fs](ftl::data::FrameSet *d) {
// TODO: schedule completed
if (fs->isComplete()) {
if (bufferSize_ == 0 && !fs->test(ftl::data::FSFlag::STALE)) {
UNIQUE_LOCK(mutex_, lk);
......
......@@ -291,7 +291,7 @@ bool Net::_sendRequest(Channel c, uint8_t frameset, uint8_t frames, uint8_t coun
Packet pkt = {
codec_t::Any, // TODO: Allow specific codec requests
definition_t::Any, // TODO: Allow specific definition requests
0,
count,
bitrate,
ftl::codecs::kFlagRequest
......
......@@ -30,7 +30,7 @@ TEST_CASE("ftl::stream::File write and read", "[stream]") {
REQUIRE( writer->begin() );
REQUIRE( writer->post({4,ftl::timer::get_time(),2,1,ftl::codecs::Channel::Confidence},{ftl::codecs::codec_t::Any, ftl::codecs::definition_t::Any, 0, 0, 0, {'f'}}) );
REQUIRE( writer->post({4,ftl::timer::get_time(),2,1,ftl::codecs::Channel::Confidence},{ftl::codecs::codec_t::Any, 0, 0, 0, 0, {'f'}}) );
writer->end();
......@@ -56,9 +56,9 @@ TEST_CASE("ftl::stream::File write and read", "[stream]") {
REQUIRE( writer->begin() );
REQUIRE( writer->post({4,0,0,1,ftl::codecs::Channel::Confidence},{ftl::codecs::codec_t::Any, ftl::codecs::definition_t::Any, 0, 0, 0, {'f'}}) );
REQUIRE( writer->post({4,0,1,1,ftl::codecs::Channel::Depth},{ftl::codecs::codec_t::Any, ftl::codecs::definition_t::Any, 0, 0, 0, {'f'}}) );
REQUIRE( writer->post({4,0,2,1,ftl::codecs::Channel::Screen},{ftl::codecs::codec_t::Any, ftl::codecs::definition_t::Any, 0, 0, 0, {'f'}}) );
REQUIRE( writer->post({4,0,0,1,ftl::codecs::Channel::Confidence},{ftl::codecs::codec_t::Any, 0, 0, 0, 0, {'f'}}) );
REQUIRE( writer->post({4,0,1,1,ftl::codecs::Channel::Depth},{ftl::codecs::codec_t::Any, 0, 0, 0, 0, {'f'}}) );
REQUIRE( writer->post({4,0,2,1,ftl::codecs::Channel::Screen},{ftl::codecs::codec_t::Any, 0, 0, 0, 0, {'f'}}) );
writer->end();
......@@ -88,9 +88,9 @@ TEST_CASE("ftl::stream::File write and read", "[stream]") {
REQUIRE( writer->begin() );
auto time = ftl::timer::get_time();
REQUIRE( writer->post({4,time,0,1,ftl::codecs::Channel::Confidence},{ftl::codecs::codec_t::Any, ftl::codecs::definition_t::Any, 0, 0, 0, {'f'}}) );
REQUIRE( writer->post({4,time+ftl::timer::getInterval(),0,1,ftl::codecs::Channel::Depth},{ftl::codecs::codec_t::Any, ftl::codecs::definition_t::Any, 0, 0, 0, {'f'}}) );
REQUIRE( writer->post({4,time+2*ftl::timer::getInterval(),0,1,ftl::codecs::Channel::Screen},{ftl::codecs::codec_t::Any, ftl::codecs::definition_t::Any, 0, 0, 0, {'f'}}) );
REQUIRE( writer->post({4,time,0,1,ftl::codecs::Channel::Confidence},{ftl::codecs::codec_t::Any, 0, 0, 0, 0, {'f'}}) );
REQUIRE( writer->post({4,time+ftl::timer::getInterval(),0,1,ftl::codecs::Channel::Depth},{ftl::codecs::codec_t::Any, 0, 0, 0, 0, {'f'}}) );
REQUIRE( writer->post({4,time+2*ftl::timer::getInterval(),0,1,ftl::codecs::Channel::Screen},{ftl::codecs::codec_t::Any, 0, 0, 0, 0, {'f'}}) );
writer->end();
......
......@@ -287,7 +287,7 @@ TEST_CASE( "Sender request to control encoding" ) {
stream.post({
4, 1000, 0, 255, Channel::Colour
},{
codec_t::Any, definition_t::Any, 255, 255, 0, {}
codec_t::Any, 0, 255, 255, 0, {}
});
fs.count = 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment