| 135 | static int copy_unknown_streams = 0; |
| 136 | |
| 137 | static void uninit_options(OptionsContext *o) |
| 138 | { |
| 139 | const OptionDef *po = options; |
| 140 | int i; |
| 141 | |
| 142 | /* all OPT_SPEC and OPT_STRING can be freed in generic way */ |
| 143 | while (po->name) { |
| 144 | void *dst = (uint8_t*)o + po->u.off; |
| 145 | |
| 146 | if (po->flags & OPT_SPEC) { |
| 147 | SpecifierOpt **so = dst; |
| 148 | int i, *count = (int*)(so + 1); |
| 149 | for (i = 0; i < *count; i++) { |
| 150 | av_freep(&(*so)[i].specifier); |
| 151 | if (po->flags & OPT_STRING) |
| 152 | av_freep(&(*so)[i].u.str); |
| 153 | } |
| 154 | av_freep(so); |
| 155 | *count = 0; |
| 156 | } else if (po->flags & OPT_OFFSET && po->flags & OPT_STRING) |
| 157 | av_freep(dst); |
| 158 | po++; |
| 159 | } |
| 160 | |
| 161 | for (i = 0; i < o->nb_stream_maps; i++) |
| 162 | av_freep(&o->stream_maps[i].linklabel); |
| 163 | av_freep(&o->stream_maps); |
| 164 | av_freep(&o->audio_channel_maps); |
| 165 | av_freep(&o->streamid_map); |
| 166 | av_freep(&o->attachments); |
| 167 | } |
| 168 | |
| 169 | static void init_options(OptionsContext *o) |
| 170 | { |