+ /* Hack: if the AVStreams have zero IDs, put some in. We
+ use the IDs so that we can cope with VOBs, in which streams
+ move about in index but remain with the same ID in different
+ VOBs. However, some files have all-zero IDs, hence this hack.
+ */
+
+ uint32_t i = 0;
+ while (i < _format_context->nb_streams && _format_context->streams[i]->id == 0) {
+ ++i;
+ }
+
+ if (i == _format_context->nb_streams) {
+ /* Put in our own IDs */
+ for (uint32_t i = 0; i < _format_context->nb_streams; ++i) {
+ _format_context->streams[i]->id = i;
+ }
+ }
+
+ _frame = av_frame_alloc ();