-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathslice.cpp
47 lines (38 loc) · 933 Bytes
/
slice.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <errno.h>
#include <typeinfo>
#include <stdio.h>
#include "mpegheader.hpp"
#include "file.hpp"
#include "picture.hpp"
Slice::Slice( uint s_val, File *s_file ) {
init();
val = s_val;
file = s_file;
next_slice_in_row = NULL;
picture = NULL;
len = 0;
incomplete = false;
}
void Slice::link( void )
{
MPEGHeader *hdr = get_next();
if ( hdr == NULL ) {
incomplete = true;
return;
}
len = hdr->get_location() - get_location();
if ( typeid( *hdr ) == typeid( Slice ) ) {
Slice *ts = static_cast<Slice *>( hdr );
if ( ts->get_val() == get_val() ) {
next_slice_in_row = ts;
}
}
ahabassert( picture );
picture->register_slice_extent( get_location(), get_location() + len );
}
void Slice::print_info( void ) {
printf( "s(%u,len=%u%s)", val, len, incomplete ? " [incomplete]" : "" );
}
MapHandle *Slice::map_chunk( void ) {
return file->map( get_location(), len );
}