MCPcopy Create free account
hub / github.com/byhook/ffmpeg4android / dump_attachment

Function dump_attachment

ffmpeg-single-cmd/src/main/cpp/ffmpeg_opt.c:862–892  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

860}
861
862static void dump_attachment(AVStream *st, const char *filename)
863{
864 int ret;
865 AVIOContext *out = NULL;
866 AVDictionaryEntry *e;
867
868 if (!st->codecpar->extradata_size) {
869 av_log(NULL, AV_LOG_WARNING, "No extradata to dump in stream #%d:%d.\n",
870 nb_input_files - 1, st->index);
871 return;
872 }
873 if (!*filename && (e = av_dict_get(st->metadata, "filename", NULL, 0)))
874 filename = e->value;
875 if (!*filename) {
876 av_log(NULL, AV_LOG_FATAL, "No filename specified and no 'filename' tag"
877 "in stream #%d:%d.\n", nb_input_files - 1, st->index);
878 exit_program(1);
879 }
880
881 assert_file_overwrite(filename);
882
883 if ((ret = avio_open2(&out, filename, AVIO_FLAG_WRITE, &int_cb, NULL)) < 0) {
884 av_log(NULL, AV_LOG_FATAL, "Could not open file %s for writing.\n",
885 filename);
886 exit_program(1);
887 }
888
889 avio_write(out, st->codecpar->extradata, st->codecpar->extradata_size);
890 avio_flush(out);
891 avio_close(out);
892}
893
894static int open_input_file(OptionsContext *o, const char *filename)
895{

Callers 1

open_input_fileFunction · 0.85

Calls 2

exit_programFunction · 0.85
assert_file_overwriteFunction · 0.85

Tested by

no test coverage detected