diff options
| author | Mistivia <i@mistivia.com> | 2025-12-20 20:31:31 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-12-20 20:31:31 +0800 |
| commit | ce1f847544cf5638085d02e3ebc5cb1dba062cd8 (patch) | |
| tree | 418311b9aa83f49413ae4a5e539811cd23b57cd1 /transcode_talker.c | |
| parent | b30869239ae0f53bb178c9ef7cb6d22c87e33d7c (diff) | |
fix windows tmp file
Diffstat (limited to 'transcode_talker.c')
| -rw-r--r-- | transcode_talker.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/transcode_talker.c b/transcode_talker.c index 11fa53a..bf196b0 100644 --- a/transcode_talker.c +++ b/transcode_talker.c @@ -11,6 +11,12 @@ #include <time.h> #include <unistd.h> +#if defined(_WIN32) + #define TMP_PREFIX "./tmp" +#else + #define TMP_PREFIX "/tmp/ezlive" +#endif + void HlsList_init(HlsList *lst) { lst->len = 0; } @@ -124,7 +130,7 @@ static void finalize_output_file(AVFormatContext *out_fmt_ctx) { static void update_m3u8(HlsList *lst, int last_seg) { int first_seg = last_seg - lst->len + 1; char out_filename[256]; - tmp_local_filename("/tmp/ezlive", out_filename); + tmp_local_filename(TMP_PREFIX, out_filename); FILE *fp = fopen(out_filename, "w"); if (fp == NULL) { fprintf(stderr, "failed to open %s for output.\n", out_filename); @@ -209,7 +215,7 @@ void* TranscodeTalker_main (void *vself) { int64_t segment_start_pts = 0; char out_filename[256]; - tmp_local_filename("/tmp/ezlive", out_filename); + tmp_local_filename(TMP_PREFIX, out_filename); int64_t pts_time; AVPacket pkt; @@ -249,7 +255,7 @@ void* TranscodeTalker_main (void *vself) { // open new ts segment_start_pts = pts_time; - tmp_local_filename("/tmp/ezlive", out_filename); + tmp_local_filename(TMP_PREFIX, out_filename); output_stream = start_new_output_file(in_fmt_ctx, &out_fmt_ctx, out_filename, audio_stream_index, video_stream_index); if (pkt.stream_index == video_stream_index) out_stream = output_stream.video_stream; |
