summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-02-17 23:57:33 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-02-18 00:41:06 -0700
commita40f9a84922b752a69a255c8eab1ba20ee7e754e (patch)
tree21fbefe4ef471ce91b76cd5a5434bf14a7d81bfc
parent7a316a5a25f9090f1438115a379ec854de316721 (diff)
wip
-rw-r--r--libmkv/nut-3.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/libmkv/nut-3.c b/libmkv/nut-3.c
index f946c0d..2acf3ac 100644
--- a/libmkv/nut-3.c
+++ b/libmkv/nut-3.c
@@ -6,10 +6,10 @@
* - Each pixel in the framebuffer is non-square; it is twice as tall
* as it is wide.
*
- * - The display-resolution of each frame may change between 640x480,
- * 720x480, and 720x576. This is the display-resolution; because
- * of non-square pixels, the framebuffer for each would be 640x240,
- * 720x240, and 720x288, respectively.
+ * - The resolution may change mid-stream, between the values
+ * 640x480, 720x480, and 720x576. This is the display-resolution;
+ * because of non-square pixels, the framebuffer for each would be
+ * 640x240, 720x240, and 720x288, respectively.
*
* - VFR (Variable Frame Rate) - Each frame has its own timestamp.
*/
@@ -98,7 +98,7 @@ uint8_t nut_startcode_info[] = {'N', 'I', 0xAB, 0x68, 0xB5, 0x96, 0xBA, 0x7
#define NUT_FRAMEFLAG_CODED (1<<12)
#define NUT_FRAMEFLAG_INVALID (1<<13)
-#define NUT_UNKNOWN_MATCH_TIME (1ULL-(1ULL<<62))
+#define NUT_UNKNOWN_MATCH_TIME (1-(UINT64_C(1)<<62))
enum nut_stream_class {
NUT_STREAMCLASS_VIDEO = 0,
@@ -261,11 +261,22 @@ bool app_write_intro(int fd, struct app_state *state, uint64_t time_ns) {
append(&out, nut_file_id_string, sizeof(nut_file_id_string));
+ /* Changing resolution mid-stream requires per-fame side-data,
+ * which requires FLAG_SM_DATA, which requires NUT v4.
+ *
+ * If we're pulling in NUT v4 for that, we can also take
+ * advantage of header elision.
+ *
+ * Unfortunately, libnut / nututils does not support v4, so
+ * there goes a good debugging tool.
+ */
+
/* main_header ********************************************************/
#define BOGUS 0
pkt.len = 0;
- nut_append_vu(&pkt, 3); /*! version */
+ nut_append_vu(&pkt, 4); /*! version */
+ nut_append_vu(&pkt, 0); /*! minor_version */
nut_append_vu(&pkt, 1); /*! stream_count */
nut_append_vu(&pkt, APP_FB(720_576) + /*! max_distance */
APP_FRAME_MAX_OVERHEAD);