summaryrefslogtreecommitdiff
path: root/libmkv/nut-3.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmkv/nut-3.c')
-rw-r--r--libmkv/nut-3.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/libmkv/nut-3.c b/libmkv/nut-3.c
index 0441400..2500af5 100644
--- a/libmkv/nut-3.c
+++ b/libmkv/nut-3.c
@@ -254,7 +254,6 @@ bool app_write_intro(int fd, struct app_state *state, uint64_t time_ns) {
struct buf out = {0};
struct buf pkt = {0};
- struct buf hdr = {0};
append(&out, nut_file_id_string, sizeof(nut_file_id_string));
@@ -265,8 +264,8 @@ bool app_write_intro(int fd, struct app_state *state, uint64_t time_ns) {
* there goes a good debugging tool.
*/
+#define BOGUS(n) n
/* main_header ********************************************************/
-#define BOGUS 0
pkt.len = 0;
/* head *******************************************/
@@ -289,13 +288,13 @@ bool app_write_intro(int fd, struct app_state *state, uint64_t time_ns) {
/* frame_code=0 (invalid) */
nut_append_vu(&pkt, NUT_FRAMEFLAG_INVALID); /*! flags */
nut_append_vu(&pkt, 2); /*! field_count */
- nut_append_vu(&pkt, BOGUS); /*! 0: fields.pts */
+ nut_append_vu(&pkt, BOGUS(0)); /*! 0: fields.pts */
nut_append_vu(&pkt, 1); /*! 1: fields.size_msb_nul */
/* frame_code=1 (640x480) */
nut_append_vu(&pkt, APP_COMMON_FLAGS); /*! flags */
nut_append_vu(&pkt, 6); /*! field_count */
- nut_append_vu(&pkt, BOGUS); /*! 0: fields.pts */
+ nut_append_vu(&pkt, BOGUS(0)); /*! 0: fields.pts */
nut_append_vu(&pkt, APP_FRAME_SIZE_MSB_MUL); /*! 1: fields.size_msb_nul */
nut_append_vu(&pkt, 0); /*! 2: fields.stream */
nut_append_vu(&pkt, APP_FRAME_SIZE(640_480) % /*! 3: fields.size_lsb */
@@ -306,7 +305,7 @@ bool app_write_intro(int fd, struct app_state *state, uint64_t time_ns) {
/* frame_code=2 (720x480) */
nut_append_vu(&pkt, APP_COMMON_FLAGS); /*! flags */
nut_append_vu(&pkt, 6); /*! field_count */
- nut_append_vu(&pkt, BOGUS); /*! 0: fields.pts */
+ nut_append_vu(&pkt, BOGUS(0)); /*! 0: fields.pts */
nut_append_vu(&pkt, APP_FRAME_SIZE_MSB_MUL); /*! 1: fields.size_msb_mul */
nut_append_vu(&pkt, 0); /*! 2: fields.stream */
nut_append_vu(&pkt, APP_FRAME_SIZE(720_480) % /*! 3: fields.size_lsb */
@@ -317,7 +316,7 @@ bool app_write_intro(int fd, struct app_state *state, uint64_t time_ns) {
/* frame_code=3 (720x576) */
nut_append_vu(&pkt, APP_COMMON_FLAGS); /*! flags */
nut_append_vu(&pkt, 6); /*! field_count */
- nut_append_vu(&pkt, BOGUS); /*! 0: fields.pts */
+ nut_append_vu(&pkt, BOGUS(0)); /*! 0: fields.pts */
nut_append_vu(&pkt, APP_FRAME_SIZE_MSB_MUL); /*! 1: fields.size_msb_nul */
nut_append_vu(&pkt, 0); /*! 2: fields.stream */
nut_append_vu(&pkt, APP_FRAME_SIZE(720_576) % /*! 3: fields.size_lsb */
@@ -328,7 +327,7 @@ bool app_write_intro(int fd, struct app_state *state, uint64_t time_ns) {
/* frame_code=4-255 (invalid) */
nut_append_vu(&pkt, NUT_FRAMEFLAG_INVALID); /*! flags */
nut_append_vu(&pkt, 2); /*! field_count */
- nut_append_vu(&pkt, BOGUS); /*! 0: fields.pts */
+ nut_append_vu(&pkt, BOGUS(0)); /*! 0: fields.pts */
nut_append_vu(&pkt, 256-4-1); /*! 1: fields.size_msb_nul */
/* tail *******************************************/
@@ -336,31 +335,29 @@ bool app_write_intro(int fd, struct app_state *state, uint64_t time_ns) {
nut_append_vu(&pkt, 0); /*! main_flags */
nut_append_packet(&out, nut_startcode_main, pkt.dat, pkt.len);
-#undef BOGUS
/* stream_header ******************************************************/
-#define BOGUS 1
pkt.len = 0;
nut_append_vu(&pkt, 0); /*! stream_id */
nut_append_vu(&pkt, NUT_STREAMCLASS_VIDEO); /*! stream_class */
nut_append_vb(&pkt, "BGR\x08", 4); /*! fourcc */
nut_append_vu(&pkt, 0); /*! time_base_id */
- nut_append_vu(&pkt, BOGUS); /*! msb_pts_shift (only relevant if FRAMEFLAG_CODED_PTS) */
- nut_append_vu(&pkt, BOGUS); /*! max_pts_distance (all frames have a checksum) */
+ nut_append_vu(&pkt, BOGUS(0)); /*! msb_pts_shift (only relevant if FRAMEFLAG_CODED_PTS) */
+ nut_append_vu(&pkt, BOGUS(0)); /*! max_pts_distance (all frames have a checksum) */
nut_append_vu(&pkt, 0); /*! decode_delay */
nut_append_vu(&pkt, 0); /*! stream_flags */
nut_append_vb(&pkt, NULL, 0); /*! codec_specific_data */
- nut_append_vu(&pkt, BOGUS); /*! width (all frames set width) */
- nut_append_vu(&pkt, BOGUS); /*! height (all frames set height) */
+ nut_append_vu(&pkt, BOGUS(640)); /*! width (all frames set width) */
+ nut_append_vu(&pkt, BOGUS(480)); /*! height (all frames set height) */
nut_append_vu(&pkt, 1); /*! sample_width */
nut_append_vu(&pkt, 2); /*! sample_height */
nut_append_vu(&pkt, NUT_COLORSPACE_UNKNOWN); /*! colorspace_type */
nut_append_packet(&out, nut_startcode_stream, pkt.dat, pkt.len);
-#undef BOGUS
/* flush **************************************************************/
+#undef BOGUS
bool ret = xwrite(fd, out.dat, out.len);
free(out.dat);